From owner-svn-src-head@freebsd.org Sun Nov 10 01:08:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 065361A3632; Sun, 10 Nov 2019 01:08:15 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479bV66PwTz4LyS; Sun, 10 Nov 2019 01:08:14 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB2AE1F38F; Sun, 10 Nov 2019 01:08:14 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA18E1D065465; Sun, 10 Nov 2019 01:08:14 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA18EMa065464; Sun, 10 Nov 2019 01:08:14 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201911100108.xAA18EMa065464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 10 Nov 2019 01:08:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354574 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 01:08:15 -0000 Author: rmacklem Date: Sun Nov 10 01:08:14 2019 New Revision: 354574 URL: https://svnweb.freebsd.org/changeset/base/354574 Log: Update copy_file_range(2) to be Linux5 compatible. The current linux man page and testing done on a fairly recent linux5.n kernel have identified two changes to the semantics of the linux copy_file_range system call. Since the copy_file_range(2) system call is intended to be linux compatible and is only currently in head/current and not used by any commands, it seems appropriate to update the system call to be compatible with the current linux one. The first of these semantic changes was changed to be compatible with linux5.n by r354564. For the second semantic change, the old linux man page stated that, if infd and outfd referred to the same file, EBADF should be returned. Now, the semantics is to allow infd and outfd to refer to the same file so long as the byte ranges defined by the input file offset, output file offset and len does not overlap. If the byte ranges do overlap, EINVAL should be returned. This patch modifies copy_file_range(2) to be linux5.n compatible for this semantic change. Modified: head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Nov 9 22:25:45 2019 (r354573) +++ head/sys/kern/vfs_syscalls.c Sun Nov 10 01:08:14 2019 (r354574) @@ -4838,7 +4838,7 @@ kern_copy_file_range(struct thread *td, int infd, off_ outvp = outfp->f_vnode; /* Sanity check the f_flag bits. */ if ((outfp->f_flag & (FWRITE | FAPPEND)) != FWRITE || - (infp->f_flag & FREAD) == 0 || invp == outvp) { + (infp->f_flag & FREAD) == 0) { error = EBADF; goto out; } @@ -4846,6 +4846,17 @@ kern_copy_file_range(struct thread *td, int infd, off_ /* If len == 0, just return 0. */ if (len == 0) goto out; + + /* + * If infp and outfp refer to the same file, the byte ranges cannot + * overlap. + */ + if (invp == outvp && ((savinoff <= savoutoff && savinoff + len > + savoutoff) || (savinoff > savoutoff && savoutoff + len > + savinoff))) { + error = EINVAL; + goto out; + } /* Range lock the byte ranges for both invp and outvp. */ for (;;) { Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sat Nov 9 22:25:45 2019 (r354573) +++ head/sys/kern/vfs_vnops.c Sun Nov 10 01:08:14 2019 (r354574) @@ -2699,8 +2699,6 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, uvalout < (uint64_t)*outoffp || invp->v_type != VREG || outvp->v_type != VREG) error = EINVAL; - else if (invp == outvp) - error = EBADF; if (error != 0) goto out; From owner-svn-src-head@freebsd.org Sun Nov 10 01:13:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B00E01A4004; Sun, 10 Nov 2019 01:13:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479bcP46Knz4Md8; Sun, 10 Nov 2019 01:13:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 703451F56F; Sun, 10 Nov 2019 01:13:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA1DfuZ071014; Sun, 10 Nov 2019 01:13:41 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA1Dfla071013; Sun, 10 Nov 2019 01:13:41 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201911100113.xAA1Dfla071013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 10 Nov 2019 01:13:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354575 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 354575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 01:13:41 -0000 Author: rmacklem Date: Sun Nov 10 01:13:41 2019 New Revision: 354575 URL: https://svnweb.freebsd.org/changeset/base/354575 Log: Update the copy_file_range man page to reflect the semantic change done by r354574. This is a content change. Modified: head/lib/libc/sys/copy_file_range.2 Modified: head/lib/libc/sys/copy_file_range.2 ============================================================================== --- head/lib/libc/sys/copy_file_range.2 Sun Nov 10 01:08:14 2019 (r354574) +++ head/lib/libc/sys/copy_file_range.2 Sun Nov 10 01:13:41 2019 (r354575) @@ -25,12 +25,13 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2019 +.Dd November 9, 2019 .Dt COPY_FILE_RANGE 2 .Os .Sh NAME .Nm copy_file_range .Nd kernel copy of a byte range from one file to another +or within one file .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -61,6 +62,14 @@ It may do this using a file system specific technique and .Fa outfd are on the same file system. +If +.Fa infd +and +.Fa outfd +refer to the same file, the byte ranges defined by +the input file offset, output file offset and +.Fa len +cannot overlap. The .Fa infd argument must be opened for reading and the @@ -162,6 +171,10 @@ and .Fa outoffp are reset to the initial values for the system call. .It Bq Er EINVAL +.Fa infd +and +.Fa outfd +refer to the same file and the byte ranges overlap or .Fa flags is not zero. From owner-svn-src-head@freebsd.org Sun Nov 10 01:21:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9655F1A4A02; Sun, 10 Nov 2019 01:21:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479bn33VZXz4N9R; Sun, 10 Nov 2019 01:21:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B5021F6E1; Sun, 10 Nov 2019 01:21:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA1LBil075395; Sun, 10 Nov 2019 01:21:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA1LBat075394; Sun, 10 Nov 2019 01:21:11 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201911100121.xAA1LBat075394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 10 Nov 2019 01:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354576 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 354576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 01:21:11 -0000 Author: rmacklem Date: Sun Nov 10 01:21:10 2019 New Revision: 354576 URL: https://svnweb.freebsd.org/changeset/base/354576 Log: Update the VOP_COPY_FILE_RANGE man page to reflect the semantic change made by r354574. This is a content change. Modified: head/share/man/man9/VOP_COPY_FILE_RANGE.9 Modified: head/share/man/man9/VOP_COPY_FILE_RANGE.9 ============================================================================== --- head/share/man/man9/VOP_COPY_FILE_RANGE.9 Sun Nov 10 01:13:41 2019 (r354575) +++ head/share/man/man9/VOP_COPY_FILE_RANGE.9 Sun Nov 10 01:21:10 2019 (r354576) @@ -25,12 +25,13 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2019 +.Dd November 9, 2019 .Dt VOP_COPY_FILE_RANGE 9 .Os .Sh NAME .Nm VOP_COPY_FILE_RANGE -.Nd copy a byte range from one regular file to another within a file system +.Nd copy a byte range from one file to another or within one file +in a single file system .Sh SYNOPSIS .In sys/param.h .In sys/vnode.h @@ -46,8 +47,17 @@ .Fa "struct ucred *outcred" .Fa "struct thread *fsize_td" .Sh DESCRIPTION -This entry point copies a byte range from one regular file to another within a -file system. +This entry point copies a byte range from one regular file to another +or within one file in a single file system. +.Fa invp +and +.Fa outvp +can refer to the same file. +For this case, the byte ranges defined by +.Fa *inoff , +.Fa *outoff and +.Fa *len +will not overlap. .Pp The arguments are: .Bl -tag -width ioflag From owner-svn-src-head@freebsd.org Sun Nov 10 01:43:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1BBB1A5B9B; Sun, 10 Nov 2019 01:43:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479cHD3BJXz4PNh; Sun, 10 Nov 2019 01:43:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36A341FB51; Sun, 10 Nov 2019 01:43:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA1hqXS088718; Sun, 10 Nov 2019 01:43:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA1hpTa088716; Sun, 10 Nov 2019 01:43:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911100143.xAA1hpTa088716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 10 Nov 2019 01:43:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354577 - in head/sys: arm64/conf conf X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: arm64/conf conf X-SVN-Commit-Revision: 354577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 01:43:52 -0000 Author: kevans Date: Sun Nov 10 01:43:51 2019 New Revision: 354577 URL: https://svnweb.freebsd.org/changeset/base/354577 Log: arm64: add SOC_BRCM_BCM2838, build it in GENERIC BCM2838/BCM2711 is the Raspberry Pi 4, which we will soon be able to boot on once some ports bits are worked out. Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 head/sys/conf/options.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Sun Nov 10 01:21:10 2019 (r354576) +++ head/sys/arm64/conf/GENERIC Sun Nov 10 01:43:51 2019 (r354577) @@ -115,6 +115,7 @@ options SOC_CAVM_THUNDERX options SOC_HISI_HI6220 options SOC_INTEL_STRATIX10 options SOC_BRCM_BCM2837 +options SOC_BRCM_BCM2838 options SOC_MARVELL_8K options SOC_ROCKCHIP_RK3328 options SOC_ROCKCHIP_RK3399 Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sun Nov 10 01:21:10 2019 (r354576) +++ head/sys/conf/files.arm64 Sun Nov 10 01:43:51 2019 (r354577) @@ -89,21 +89,23 @@ arm/arm/physmem.c standard arm/broadcom/bcm2835/bcm2835_audio.c optional sound vchiq fdt \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc fdt -arm/broadcom/bcm2835/bcm2835_cpufreq.c optional soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_dma.c optional soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_fbd.c optional vt soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_clkman.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_cpufreq.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_dma.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_fbd.c optional vt soc_brcm_bcm2837 fdt | vt soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_ft5406.c optional evdev bcm2835_ft5406 fdt -arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_intr.c optional soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_mbox.c optional soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_rng.c optional !random_loadable soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_sdhost.c optional sdhci soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio soc_brcm_bcm2837 fdt | gpio soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_intr.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_mbox.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_rng.c optional !random_loadable soc_brcm_bcm2837 fdt | !random_loadable soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci soc_brcm_bcm2837 fdt | sdhci soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_sdhost.c optional sdhci soc_brcm_bcm2837 fdt | sdhci soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi fdt -arm/broadcom/bcm2835/bcm2835_vcio.c optional soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt soc_brcm_bcm2837 +arm/broadcom/bcm2835/bcm2835_vcbus.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_vcio.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt +arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt soc_brcm_bcm2837 | dwcotg fdt soc_brcm_bcm2838 arm/mv/a37x0_gpio.c optional a37x0_gpio gpio fdt arm/mv/armada38x/armada38x_rtc.c optional mv_rtc fdt arm/mv/gpio.c optional mv_gpio fdt Modified: head/sys/conf/options.arm64 ============================================================================== --- head/sys/conf/options.arm64 Sun Nov 10 01:21:10 2019 (r354576) +++ head/sys/conf/options.arm64 Sun Nov 10 01:43:51 2019 (r354577) @@ -18,6 +18,7 @@ SOC_ALLWINNER_A64 opt_soc.h SOC_ALLWINNER_H5 opt_soc.h SOC_ALLWINNER_H6 opt_soc.h SOC_BRCM_BCM2837 opt_soc.h +SOC_BRCM_BCM2838 opt_soc.h SOC_CAVM_THUNDERX opt_soc.h SOC_HISI_HI6220 opt_soc.h SOC_INTEL_STRATIX10 opt_soc.h From owner-svn-src-head@freebsd.org Sun Nov 10 02:31:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 799B11A71EB; Sun, 10 Nov 2019 02:31:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479dLB2j21z4RF8; Sun, 10 Nov 2019 02:31:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4186A203FE; Sun, 10 Nov 2019 02:31:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA2VUuY015502; Sun, 10 Nov 2019 02:31:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA2VU1x015501; Sun, 10 Nov 2019 02:31:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911100231.xAA2VU1x015501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 10 Nov 2019 02:31:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354578 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 02:31:30 -0000 Author: kevans Date: Sun Nov 10 02:31:29 2019 New Revision: 354578 URL: https://svnweb.freebsd.org/changeset/base/354578 Log: Revert premature part of r354577 bcm2835_vcbus.c will be the future home to some I/O address mapping routines, but it has neither been committed nor reviewed. Modified: head/sys/conf/files.arm64 Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sun Nov 10 01:43:51 2019 (r354577) +++ head/sys/conf/files.arm64 Sun Nov 10 02:31:29 2019 (r354578) @@ -101,7 +101,6 @@ arm/broadcom/bcm2835/bcm2835_rng.c optional !random_l arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci soc_brcm_bcm2837 fdt | sdhci soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_sdhost.c optional sdhci soc_brcm_bcm2837 fdt | sdhci soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi fdt -arm/broadcom/bcm2835/bcm2835_vcbus.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_vcio.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt From owner-svn-src-head@freebsd.org Sun Nov 10 03:06:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFD911A80AF; Sun, 10 Nov 2019 03:06:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479f6369sGz4T7p; Sun, 10 Nov 2019 03:06:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B842220A37; Sun, 10 Nov 2019 03:06:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA363Am036950; Sun, 10 Nov 2019 03:06:03 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA363xI036949; Sun, 10 Nov 2019 03:06:03 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911100306.xAA363xI036949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 10 Nov 2019 03:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354579 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 03:06:04 -0000 Author: kevans Date: Sun Nov 10 03:06:03 2019 New Revision: 354579 URL: https://svnweb.freebsd.org/changeset/base/354579 Log: bcm2835_sdhci: don't panic in DMA interrupt if curcmd went away This is an exceptional case; generally found during controller errors. A panic when we attempt to acess slot->curcmd->data is less ideal than warning, and other verbiage will be emitted to indicate the exact error. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Nov 10 02:31:29 2019 (r354578) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Nov 10 03:06:03 2019 (r354579) @@ -570,6 +570,13 @@ bcm_sdhci_dma_intr(int ch, void *arg) mtx_lock(&slot->mtx); + if (slot->curcmd == NULL) { + mtx_unlock(&slot->mtx); + device_printf(sc->sc_dev, + "command aborted in the middle of DMA\n"); + return; + } + /* * If there are more segments for the current dma, start the next one. * Otherwise unload the dma map and decide what to do next based on the From owner-svn-src-head@freebsd.org Sun Nov 10 03:24:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCC7B1A8796; Sun, 10 Nov 2019 03:24:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479fWp52fqz4V8D; Sun, 10 Nov 2019 03:24:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C6D120DF8; Sun, 10 Nov 2019 03:24:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA3OsJv048743; Sun, 10 Nov 2019 03:24:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA3Osg3048741; Sun, 10 Nov 2019 03:24:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911100324.xAA3Osg3048741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 10 Nov 2019 03:24:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354580 - in head: share/man/man4 sys/dev/ntb/ntb_hw X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 354580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 03:24:54 -0000 Author: mav Date: Sun Nov 10 03:24:53 2019 New Revision: 354580 URL: https://svnweb.freebsd.org/changeset/base/354580 Log: Allow splitting PLX NTB BAR2 into several memory windows. Address Lookup Table (A-LUT) being enabled allows to specify separate translation for each 1/128th or 1/256th of the BAR2. Previously it was used only to limit effective window size by blocking access through some of A-LUT elements. This change allows A-LUT elements to also point different memory locations, providing to upper layers several (up to 128) independent memory windows. A-LUT hardware allows even more flexible configurations than this, but NTB KPI have no way to manage that now. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/share/man/man4/ntb_hw_plx.4 head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Modified: head/share/man/man4/ntb_hw_plx.4 ============================================================================== --- head/share/man/man4/ntb_hw_plx.4 Sun Nov 10 03:06:03 2019 (r354579) +++ head/share/man/man4/ntb_hw_plx.4 Sun Nov 10 03:24:53 2019 (r354580) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2017 Alexander Motin +.\" Copyright (c) 2017-2019 Alexander Motin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 30, 2017 +.Dd November 9, 2019 .Dt NTB_HW_PLX 4 .Os .Sh NAME @@ -54,6 +54,9 @@ NTB that it works in NTB-to-NTB (back-to-back) mode, 0 Driver attached to Link Interface (visible from Root Port side) switches to NTB-to-Root Port mode automatically, but one attached to Virtual Interface can't detect what is on the other side and require external knowledge. +.It Va hint.ntb_hw. Ns Ar X Ns Va .split +Being set above zero splits BAR2 into 2^x memory windows using Address +Lookup Table (A-LUT). .El .Sh DESCRIPTION The @@ -70,6 +73,8 @@ subsystem. Each PLX NTB provides up to 2 64-bit or 4 32-bit memory windows to the other system's memory, 6 or 12 scratchpad registers and 16 doorbells to interrupt the other system. +If Address Lookup Table (A-LUT) is enabled, BAR2 can be split into several +(up to 128) memory windows. In NTB-to-NTB mode one of memory windows (or half of it, if bigger then 1MB) is consumed by the driver itself to access scratchpad and doorbell registers of the other side. Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Sun Nov 10 03:06:03 2019 (r354579) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Sun Nov 10 03:24:53 2019 (r354580) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017 Alexander Motin + * Copyright (c) 2017-2019 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #define PLX_NUM_SPAD 8 /* There are 8 scratchpads. */ #define PLX_NUM_SPAD_PATT 4 /* Use test pattern as 4 more. */ #define PLX_NUM_DB 16 /* There are 16 doorbells. */ +#define PLX_MAX_SPLIT 128 /* Allow are at most 128 splits. */ struct ntb_plx_mw_info { int mw_bar; @@ -65,9 +66,11 @@ struct ntb_plx_mw_info { vm_paddr_t mw_pbase; caddr_t mw_vbase; vm_size_t mw_size; - vm_memattr_t mw_map_mode; - bus_addr_t mw_xlat_addr; - size_t mw_xlat_size; + struct { + vm_memattr_t mw_map_mode; + bus_addr_t mw_xlat_addr; + bus_size_t mw_xlat_size; + } splits[PLX_MAX_SPLIT]; }; struct ntb_plx_softc { @@ -81,6 +84,7 @@ struct ntb_plx_softc { u_int link; /* Link v/s Virtual side. */ u_int port; /* Port number within chip. */ u_int alut; /* A-LUT is enabled for NTx */ + u_int split; /* split BAR2 into 2^x parts */ int int_rid; struct resource *int_res; @@ -222,11 +226,8 @@ ntb_plx_init(device_t dev) NTX_WRITE(sc, sc->link ? 0xdbc : 0xd9c, 0xc0218021); /* Set Link to Virtual address translation. */ - for (i = 0; i < sc->mw_count; i++) { - mw = &sc->mw_info[i]; - if (mw->mw_xlat_size != 0) - ntb_plx_mw_set_trans_internal(dev, i); - } + for (i = 0; i < sc->mw_count; i++) + ntb_plx_mw_set_trans_internal(dev, i); pci_enable_busmaster(dev); if (sc->b2b_mw >= 0) @@ -319,7 +320,7 @@ ntb_plx_attach(device_t dev) { struct ntb_plx_softc *sc = device_get_softc(dev); struct ntb_plx_mw_info *mw; - int error = 0, i; + int error = 0, i, j; uint32_t val; char buf[32]; @@ -361,7 +362,8 @@ ntb_plx_attach(device_t dev) mw->mw_pbase = rman_get_start(mw->mw_res); mw->mw_size = rman_get_size(mw->mw_res); mw->mw_vbase = rman_get_virtual(mw->mw_res); - mw->mw_map_mode = VM_MEMATTR_UNCACHEABLE; + for (j = 0; j < PLX_MAX_SPLIT; j++) + mw->splits[j].mw_map_mode = VM_MEMATTR_UNCACHEABLE; sc->mw_count++; /* Skip over adjacent BAR for 64-bit BARs. */ @@ -402,6 +404,26 @@ ntb_plx_attach(device_t dev) sc->b2b_off = 0; } + snprintf(buf, sizeof(buf), "hint.%s.%d.split", device_get_name(dev), + device_get_unit(dev)); + TUNABLE_INT_FETCH(buf, &sc->split); + if (sc->split > 7) { + device_printf(dev, "Split value is too high (%u)\n", sc->split); + sc->split = 0; + } else if (sc->split > 0 && sc->alut == 0) { + device_printf(dev, "Can't split with disabled A-LUT\n"); + sc->split = 0; + } else if (sc->split > 0 && (sc->mw_count == 0 || sc->mw_info[0].mw_bar != 2)) { + device_printf(dev, "Can't split disabled BAR2\n"); + sc->split = 0; + } else if (sc->split > 0 && (sc->b2b_mw == 0 && sc->b2b_off == 0)) { + device_printf(dev, "Can't split BAR2 consumed by B2B\n"); + sc->split = 0; + } else if (sc->split > 0) { + device_printf(dev, "Splitting BAR2 into %d memory windows\n", + 1 << sc->split); + } + /* * Use Physical Layer User Test Pattern as additional scratchpad. * Make sure they are present and enabled by writing to them. @@ -582,12 +604,29 @@ static uint8_t ntb_plx_mw_count(device_t dev) { struct ntb_plx_softc *sc = device_get_softc(dev); + uint8_t res; + res = sc->mw_count; + res += (1 << sc->split) - 1; if (sc->b2b_mw >= 0 && sc->b2b_off == 0) - return (sc->mw_count - 1); /* B2B consumed whole window. */ - return (sc->mw_count); + res--; /* B2B consumed whole window. */ + return (res); } +static unsigned +ntb_plx_user_mw_to_idx(struct ntb_plx_softc *sc, unsigned uidx, unsigned *sp) +{ + unsigned t; + + t = 1 << sc->split; + if (uidx < t) { + *sp = uidx; + return (0); + } + *sp = 0; + return (uidx - (t - 1)); +} + static int ntb_plx_mw_get_range(device_t dev, unsigned mw_idx, vm_paddr_t *base, caddr_t *vbase, size_t *size, size_t *align, size_t *align_size, @@ -595,8 +634,10 @@ ntb_plx_mw_get_range(device_t dev, unsigned mw_idx, vm { struct ntb_plx_softc *sc = device_get_softc(dev); struct ntb_plx_mw_info *mw; - size_t off; + size_t off, ss; + unsigned sp, split; + mw_idx = ntb_plx_user_mw_to_idx(sc, mw_idx, &sp); if (mw_idx >= sc->mw_count) return (EINVAL); off = 0; @@ -606,14 +647,16 @@ ntb_plx_mw_get_range(device_t dev, unsigned mw_idx, vm off = sc->b2b_off; } mw = &sc->mw_info[mw_idx]; + split = (mw->mw_bar == 2) ? sc->split : 0; + ss = (mw->mw_size - off) >> split; /* Local to remote memory window parameters. */ if (base != NULL) - *base = mw->mw_pbase + off; + *base = mw->mw_pbase + off + ss * sp; if (vbase != NULL) - *vbase = mw->mw_vbase + off; + *vbase = mw->mw_vbase + off + ss * sp; if (size != NULL) - *size = mw->mw_size - off; + *size = ss; /* * Remote to local memory window translation address alignment. @@ -660,91 +703,72 @@ ntb_plx_mw_set_trans_internal(device_t dev, unsigned m struct ntb_plx_mw_info *mw; uint64_t addr, eaddr, off, size, bsize, esize, val64; uint32_t val; - int i; + unsigned i, sp, split; mw = &sc->mw_info[mw_idx]; - addr = mw->mw_xlat_addr; - size = mw->mw_xlat_size; - off = 0; - if (mw_idx == sc->b2b_mw) { - off = sc->b2b_off; - KASSERT(off != 0, ("user shouldn't get non-shared b2b mw")); + off = (mw_idx == sc->b2b_mw) ? sc->b2b_off : 0; + split = (mw->mw_bar == 2) ? sc->split : 0; - /* - * While generally we can set any BAR size on link side, - * for B2B shared window we can't go above preconfigured - * size due to BAR address alignment requirements. - */ - if (size > mw->mw_size - off) - return (EINVAL); - } - - if (size > 0) { - /* Round BAR size to next power of 2 or at least 1MB. */ - bsize = size; + /* Get BAR size. In case of split or B2RP we can't change it. */ + if (split || sc->b2b_mw < 0) { + bsize = mw->mw_size - off; + } else { + bsize = mw->splits[0].mw_xlat_size; if (!powerof2(bsize)) bsize = 1LL << flsll(bsize); - if (bsize < 1024 * 1024) + if (bsize > 0 && bsize < 1024 * 1024) bsize = 1024 * 1024; + } - /* A-LUT has 128 or 256 times better granularity. */ - esize = bsize; - if (sc->alut && mw->mw_bar == 2) - esize /= 128 * sc->alut; + /* + * While for B2B we can set any BAR size on a link side, for shared + * window we can't go above preconfigured size due to BAR address + * alignment requirements. + */ + if ((off & (bsize - 1)) != 0) + return (EINVAL); - /* addr should be aligned to BAR or A-LUT element size. */ - if ((addr & (esize - 1)) != 0) - return (EINVAL); - } else - esize = bsize = 0; + /* In B2B mode set Link Interface BAR size/address. */ + if (sc->b2b_mw >= 0 && mw->mw_64bit) { + val64 = 0; + if (bsize > 0) + val64 = (~(bsize - 1) & ~0xfffff); + val64 |= 0xc; + PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val64); + PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4 + 4, val64 >> 32); - if (mw->mw_64bit) { - if (sc->b2b_mw >= 0) { - /* Set Link Interface BAR size and enable/disable it. */ - val64 = 0; - if (bsize > 0) - val64 = (~(bsize - 1) & ~0xfffff); - val64 |= 0xc; - PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val64); - PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4 + 4, val64 >> 32); + val64 = 0x2000000000000000 * mw->mw_bar + off; + PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64); + PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar) + 4, val64 >> 32); + } else if (sc->b2b_mw >= 0) { + val = 0; + if (bsize > 0) + val = (~(bsize - 1) & ~0xfffff); + PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val); - /* Set Link Interface BAR address. */ - val64 = 0x2000000000000000 * mw->mw_bar + off; - PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64); - PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar) + 4, val64 >> 32); - } + val64 = 0x20000000 * mw->mw_bar + off; + PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64); + } - /* Set Virtual Interface BARs address translation */ + /* Set BARs address translation */ + addr = split ? UINT64_MAX : mw->splits[0].mw_xlat_addr; + if (mw->mw_64bit) { PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr); PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4 + 4, addr >> 32); } else { - /* Make sure we fit into 32-bit address space. */ - if ((addr & UINT32_MAX) != addr) - return (ERANGE); - if (((addr + bsize) & UINT32_MAX) != (addr + bsize)) - return (ERANGE); - - if (sc->b2b_mw >= 0) { - /* Set Link Interface BAR size and enable/disable it. */ - val = 0; - if (bsize > 0) - val = (~(bsize - 1) & ~0xfffff); - PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val); - - /* Set Link Interface BAR address. */ - val64 = 0x20000000 * mw->mw_bar + off; - PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64); - } - - /* Set Virtual Interface BARs address translation */ PNTX_WRITE(sc, 0xc3c + (mw->mw_bar - 2) * 4, addr); } - /* Configure and enable Link to Virtual A-LUT if we need it. */ - if (sc->alut && mw->mw_bar == 2 && - ((addr & (bsize - 1)) != 0 || size != bsize)) { - eaddr = addr; - for (i = 0; i < 128 * sc->alut; i++) { + /* Configure and enable A-LUT if we need it. */ + size = split ? 0 : mw->splits[0].mw_xlat_size; + if (sc->alut && mw->mw_bar == 2 && (sc->split > 0 || + ((addr & (bsize - 1)) != 0 || size != bsize))) { + esize = bsize / (128 * sc->alut); + for (i = sp = 0; i < 128 * sc->alut; i++) { + if (i % (128 * sc->alut >> sc->split) == 0) { + eaddr = addr = mw->splits[sp].mw_xlat_addr; + size = mw->splits[sp++].mw_xlat_size; + } val = sc->link ? 0 : 1; if (sc->alut == 1) val += 2 * sc->ntx; @@ -768,12 +792,18 @@ ntb_plx_mw_set_trans(device_t dev, unsigned mw_idx, bu { struct ntb_plx_softc *sc = device_get_softc(dev); struct ntb_plx_mw_info *mw; + unsigned sp; + mw_idx = ntb_plx_user_mw_to_idx(sc, mw_idx, &sp); if (mw_idx >= sc->mw_count) return (EINVAL); mw = &sc->mw_info[mw_idx]; - mw->mw_xlat_addr = addr; - mw->mw_xlat_size = size; + if (!mw->mw_64bit && + ((addr & UINT32_MAX) != addr || + ((addr + size) & UINT32_MAX) != (addr + size))) + return (ERANGE); + mw->splits[sp].mw_xlat_addr = addr; + mw->splits[sp].mw_xlat_size = size; return (ntb_plx_mw_set_trans_internal(dev, mw_idx)); } @@ -785,43 +815,49 @@ ntb_plx_mw_clear_trans(device_t dev, unsigned mw_idx) } static int -ntb_plx_mw_get_wc(device_t dev, unsigned idx, vm_memattr_t *mode) +ntb_plx_mw_get_wc(device_t dev, unsigned mw_idx, vm_memattr_t *mode) { struct ntb_plx_softc *sc = device_get_softc(dev); struct ntb_plx_mw_info *mw; + unsigned sp; - if (idx >= sc->mw_count) + mw_idx = ntb_plx_user_mw_to_idx(sc, mw_idx, &sp); + if (mw_idx >= sc->mw_count) return (EINVAL); - mw = &sc->mw_info[idx]; - *mode = mw->mw_map_mode; + mw = &sc->mw_info[mw_idx]; + *mode = mw->splits[sp].mw_map_mode; return (0); } static int -ntb_plx_mw_set_wc(device_t dev, unsigned idx, vm_memattr_t mode) +ntb_plx_mw_set_wc(device_t dev, unsigned mw_idx, vm_memattr_t mode) { struct ntb_plx_softc *sc = device_get_softc(dev); struct ntb_plx_mw_info *mw; - uint64_t off; + uint64_t off, ss; int rc; + unsigned sp, split; - if (idx >= sc->mw_count) + mw_idx = ntb_plx_user_mw_to_idx(sc, mw_idx, &sp); + if (mw_idx >= sc->mw_count) return (EINVAL); - mw = &sc->mw_info[idx]; - if (mw->mw_map_mode == mode) + mw = &sc->mw_info[mw_idx]; + if (mw->splits[sp].mw_map_mode == mode) return (0); off = 0; - if (idx == sc->b2b_mw) { + if (mw_idx == sc->b2b_mw) { KASSERT(sc->b2b_off != 0, ("user shouldn't get non-shared b2b mw")); off = sc->b2b_off; } - rc = pmap_change_attr((vm_offset_t)mw->mw_vbase + off, - mw->mw_size - off, mode); + split = (mw->mw_bar == 2) ? sc->split : 0; + ss = (mw->mw_size - off) >> split; + rc = pmap_change_attr((vm_offset_t)mw->mw_vbase + off + ss * sp, + ss, mode); if (rc == 0) - mw->mw_map_mode = mode; + mw->splits[sp].mw_map_mode = mode; return (rc); } From owner-svn-src-head@freebsd.org Sun Nov 10 03:37:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAD381A8B36; Sun, 10 Nov 2019 03:37:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479fpf4Zdkz4VcG; Sun, 10 Nov 2019 03:37:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8083820FD3; Sun, 10 Nov 2019 03:37:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA3bkta054701; Sun, 10 Nov 2019 03:37:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA3bkrg054699; Sun, 10 Nov 2019 03:37:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911100337.xAA3bkrg054699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 10 Nov 2019 03:37:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354581 - in head: share/man/man4 sys/dev/ntb X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/ntb X-SVN-Commit-Revision: 354581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 03:37:46 -0000 Author: mav Date: Sun Nov 10 03:37:45 2019 New Revision: 354581 URL: https://svnweb.freebsd.org/changeset/base/354581 Log: Add compact scraptchpad protocol for ntb_transport(4). Previously ntb_transport(4) required at least 6 scratchpad registers, plus 2 more for each additional memory window. That is too much for some configurations, where several drivers have to share resources of the same NTB hardware. This patch introduces new compact version of the protocol, requiring only 3 scratchpad registers, plus one more for each additional memory window. The optimization is based on fact that neither of version, number of windows or number of queue pairs really need more then one byte each, and window sizes of 4GB are not very useful now. The new protocol is activated automatically when the configuration is low on scratchpad registers, or it can be activated explicitly with loader tunable. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/share/man/man4/ntb_transport.4 head/sys/dev/ntb/ntb_transport.c Modified: head/share/man/man4/ntb_transport.4 ============================================================================== --- head/share/man/man4/ntb_transport.4 Sun Nov 10 03:24:53 2019 (r354580) +++ head/share/man/man4/ntb_transport.4 Sun Nov 10 03:37:45 2019 (r354581) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 29, 2019 +.Dd November 9, 2019 .Dt NTB_TRANSPORT 4 .Os .Sh NAME @@ -64,6 +64,12 @@ is a name of the driver to attach (empty means any), is a number of queues to allocate (empty means automatic). The default configuration is empty string, which means single consumer with one queue per memory window, allowing any driver to attach. +.It Va hint.ntb_transport. Ns Ar X Ns Va .compact +Non-zero value enables compact version of sratchpad protocol, using twice +less registers. +Enabled automatically if there is not enough registers to negotiate all +available memory windows. +The compact version does not support memory windows of 4GB and above. .El .Sh DESCRIPTION The @@ -85,7 +91,8 @@ instance: .It 1 or more memory windows; .It -6 scratchpads, plus 2 more for each additional memory window; +6 scratchpads, plus 2 more for each additional memory window, +or 3 plus 1 in case of compact protocol; .It 1 doorbell for each memory window or configured queue. .El Modified: head/sys/dev/ntb/ntb_transport.c ============================================================================== --- head/sys/dev/ntb/ntb_transport.c Sun Nov 10 03:24:53 2019 (r354580) +++ head/sys/dev/ntb/ntb_transport.c Sun Nov 10 03:37:45 2019 (r354581) @@ -203,6 +203,7 @@ struct ntb_transport_ctx { struct ntb_transport_child *child; struct ntb_transport_mw *mw_vec; struct ntb_transport_qp *qp_vec; + int compact; unsigned mw_count; unsigned qp_count; uint64_t qp_bitmap; @@ -252,6 +253,15 @@ enum { NTBT_WATCHDOG_SPAD = 15 }; +/* + * Compart version of sratchpad protocol, using twice less registers. + */ +enum { + NTBTC_PARAMS = 0, /* NUM_QPS << 24 + NUM_MWS << 16 + VERSION */ + NTBTC_QP_LINKS, /* QP links status */ + NTBTC_MW0_SZ, /* MW size limited to 32 bits. */ +}; + #define QP_TO_MW(nt, qp) ((qp) % nt->mw_count) #define NTB_QP_DEF_NUM_ENTRIES 100 #define NTB_LINK_DOWN_TIMEOUT 100 @@ -352,15 +362,31 @@ ntb_transport_attach(device_t dev) device_printf(dev, "At least 1 memory window required.\n"); return (ENXIO); } - if (spad_count < 6) { - device_printf(dev, "At least 6 scratchpads required.\n"); - return (ENXIO); + nt->compact = (spad_count < 4 + 2 * nt->mw_count); + snprintf(buf, sizeof(buf), "hint.%s.%d.compact", device_get_name(dev), + device_get_unit(dev)); + TUNABLE_INT_FETCH(buf, &nt->compact); + if (nt->compact) { + if (spad_count < 3) { + device_printf(dev, "At least 3 scratchpads required.\n"); + return (ENXIO); + } + if (spad_count < 2 + nt->mw_count) { + nt->mw_count = spad_count - 2; + device_printf(dev, "Scratchpads enough only for %d " + "memory windows.\n", nt->mw_count); + } + } else { + if (spad_count < 6) { + device_printf(dev, "At least 6 scratchpads required.\n"); + return (ENXIO); + } + if (spad_count < 4 + 2 * nt->mw_count) { + nt->mw_count = (spad_count - 4) / 2; + device_printf(dev, "Scratchpads enough only for %d " + "memory windows.\n", nt->mw_count); + } } - if (spad_count < 4 + 2 * nt->mw_count) { - nt->mw_count = (spad_count - 4) / 2; - device_printf(dev, "Scratchpads enough only for %d " - "memory windows.\n", nt->mw_count); - } if (db_bitmap == 0) { device_printf(dev, "At least one doorbell required.\n"); return (ENXIO); @@ -380,10 +406,16 @@ ntb_transport_attach(device_t dev) mw->tx_size = mw->phys_size; if (max_mw_size != 0 && mw->tx_size > max_mw_size) { device_printf(dev, "Memory window %d limited from " - "%ju to %ju\n", i, (uintmax_t)mw->phys_size, + "%ju to %ju\n", i, (uintmax_t)mw->tx_size, max_mw_size); mw->tx_size = max_mw_size; } + if (nt->compact && mw->tx_size > UINT32_MAX) { + device_printf(dev, "Memory window %d is too big " + "(%ju)\n", i, (uintmax_t)mw->tx_size); + rc = ENXIO; + goto err; + } mw->rx_size = 0; mw->buff_size = 0; @@ -1110,37 +1142,61 @@ ntb_transport_link_work(void *arg) int rc; /* send the local info, in the opposite order of the way we read it */ - for (i = 0; i < nt->mw_count; i++) { - size = nt->mw_vec[i].tx_size; - ntb_peer_spad_write(dev, NTBT_MW0_SZ_HIGH + (i * 2), - size >> 32); - ntb_peer_spad_write(dev, NTBT_MW0_SZ_LOW + (i * 2), size); + if (nt->compact) { + for (i = 0; i < nt->mw_count; i++) { + size = nt->mw_vec[i].tx_size; + KASSERT(size <= UINT32_MAX, ("size too big (%jx)", size)); + ntb_peer_spad_write(dev, NTBTC_MW0_SZ + i, size); + } + ntb_peer_spad_write(dev, NTBTC_QP_LINKS, 0); + ntb_peer_spad_write(dev, NTBTC_PARAMS, + (nt->qp_count << 24) | (nt->mw_count << 16) | + NTB_TRANSPORT_VERSION); + } else { + for (i = 0; i < nt->mw_count; i++) { + size = nt->mw_vec[i].tx_size; + ntb_peer_spad_write(dev, NTBT_MW0_SZ_HIGH + (i * 2), + size >> 32); + ntb_peer_spad_write(dev, NTBT_MW0_SZ_LOW + (i * 2), size); + } + ntb_peer_spad_write(dev, NTBT_NUM_MWS, nt->mw_count); + ntb_peer_spad_write(dev, NTBT_NUM_QPS, nt->qp_count); + ntb_peer_spad_write(dev, NTBT_QP_LINKS, 0); + ntb_peer_spad_write(dev, NTBT_VERSION, NTB_TRANSPORT_VERSION); } - ntb_peer_spad_write(dev, NTBT_NUM_MWS, nt->mw_count); - ntb_peer_spad_write(dev, NTBT_NUM_QPS, nt->qp_count); - ntb_peer_spad_write(dev, NTBT_QP_LINKS, 0); - ntb_peer_spad_write(dev, NTBT_VERSION, NTB_TRANSPORT_VERSION); /* Query the remote side for its info */ val = 0; - ntb_spad_read(dev, NTBT_VERSION, &val); - if (val != NTB_TRANSPORT_VERSION) - goto out; + if (nt->compact) { + ntb_spad_read(dev, NTBTC_PARAMS, &val); + if (val != ((nt->qp_count << 24) | (nt->mw_count << 16) | + NTB_TRANSPORT_VERSION)) + goto out; + } else { + ntb_spad_read(dev, NTBT_VERSION, &val); + if (val != NTB_TRANSPORT_VERSION) + goto out; - ntb_spad_read(dev, NTBT_NUM_QPS, &val); - if (val != nt->qp_count) - goto out; + ntb_spad_read(dev, NTBT_NUM_QPS, &val); + if (val != nt->qp_count) + goto out; - ntb_spad_read(dev, NTBT_NUM_MWS, &val); - if (val != nt->mw_count) - goto out; + ntb_spad_read(dev, NTBT_NUM_MWS, &val); + if (val != nt->mw_count) + goto out; + } for (i = 0; i < nt->mw_count; i++) { - ntb_spad_read(dev, NTBT_MW0_SZ_HIGH + (i * 2), &val); - val64 = (uint64_t)val << 32; + if (nt->compact) { + ntb_spad_read(dev, NTBTC_MW0_SZ + i, &val); + val64 = val; + } else { + ntb_spad_read(dev, NTBT_MW0_SZ_HIGH + (i * 2), &val); + val64 = (uint64_t)val << 32; - ntb_spad_read(dev, NTBT_MW0_SZ_LOW + (i * 2), &val); - val64 |= val; + ntb_spad_read(dev, NTBT_MW0_SZ_LOW + (i * 2), &val); + val64 |= val; + } mw = &nt->mw_vec[i]; mw->rx_size = val64; From owner-svn-src-head@freebsd.org Sun Nov 10 04:24:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24EF01A97A5; Sun, 10 Nov 2019 04:24:37 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479grh6QSCz4XQJ; Sun, 10 Nov 2019 04:24:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCA5C218D6; Sun, 10 Nov 2019 04:24:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA4Oa8O083812; Sun, 10 Nov 2019 04:24:36 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA4OaPb083810; Sun, 10 Nov 2019 04:24:36 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911100424.xAA4OaPb083810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 10 Nov 2019 04:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354584 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 354584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 04:24:37 -0000 Author: jhibbits Date: Sun Nov 10 04:24:36 2019 New Revision: 354584 URL: https://svnweb.freebsd.org/changeset/base/354584 Log: powerpc64/powernv: Use OPAL call for non-POWER8 PCI TCE reset According to the OPAL documentation, only the POWER8 (PHB3) should use the register write TCE reset method. All others should use the OPAL call. On POWER9 the call is semantically identical to the register write, with a wait for completion. Modified: head/sys/powerpc/powernv/opal.h head/sys/powerpc/powernv/opal_pci.c Modified: head/sys/powerpc/powernv/opal.h ============================================================================== --- head/sys/powerpc/powernv/opal.h Sun Nov 10 03:45:16 2019 (r354583) +++ head/sys/powerpc/powernv/opal.h Sun Nov 10 04:24:36 2019 (r354584) @@ -129,6 +129,11 @@ int opal_call(uint64_t token, ...); #define OPAL_IGNORE_RID_FUNC_NUMBER 0 #define OPAL_COMPARE_RID_FUNC_NUMBER 1 +/* For OPAL_PCI_TCE_KILL */ +#define OPAL_PCI_TCE_KILL_PAGE 0 +#define OPAL_PCI_TCE_KILL_PE 1 +#define OPAL_PCI_TCE_KILL_ALL 2 + #define OPAL_SUCCESS 0 #define OPAL_PARAMETER -1 #define OPAL_BUSY -2 Modified: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- head/sys/powerpc/powernv/opal_pci.c Sun Nov 10 03:45:16 2019 (r354583) +++ head/sys/powerpc/powernv/opal_pci.c Sun Nov 10 04:24:36 2019 (r354584) @@ -409,10 +409,12 @@ opalpci_attach(device_t dev) /* * Invalidate all previous TCE entries. - * - * TODO: add support for other PHBs than PHB3 */ - pci_phb3_tce_invalidate_entire(sc); + if (ofw_bus_is_compatible(dev, "power8-pciex")) + pci_phb3_tce_invalidate_entire(sc); + else + opal_call(OPAL_PCI_TCE_KILL, sc->phb_id, OPAL_PCI_TCE_KILL_ALL, + OPAL_PCI_DEFAULT_PE, 0, 0, 0); /* * Get MSI properties From owner-svn-src-head@freebsd.org Sun Nov 10 05:22:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A9721AA58B; Sun, 10 Nov 2019 05:22:02 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479j6x6bvYz4ZKd; Sun, 10 Nov 2019 05:22:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C770B2232F; Sun, 10 Nov 2019 05:22:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA5M1qP016916; Sun, 10 Nov 2019 05:22:01 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA5M1ON016915; Sun, 10 Nov 2019 05:22:01 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201911100522.xAA5M1ON016915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 10 Nov 2019 05:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354585 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 05:22:02 -0000 Author: alc Date: Sun Nov 10 05:22:01 2019 New Revision: 354585 URL: https://svnweb.freebsd.org/changeset/base/354585 Log: Eliminate a redundant pmap_load() from pmap_remove_pages(). There is no reason why the pmap_invalidate_all() in pmap_remove_pages() must be performed before the final PV list lock release. Move it past the lock release. Eliminate a stale comment from pmap_page_test_mappings(). We implemented a modified bit in r350004. MFC after: 1 week Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Nov 10 04:24:36 2019 (r354584) +++ head/sys/arm64/arm64/pmap.c Sun Nov 10 05:22:01 2019 (r354585) @@ -4434,7 +4434,6 @@ pmap_remove_pages(pmap_t pmap) L2_BLOCK, ("Attempting to remove an invalid " "block: %lx", tpte)); - tpte = pmap_load(pte); break; case 2: pte = pmap_l2_to_l3(pde, pv->pv_va); @@ -4552,17 +4551,15 @@ pmap_remove_pages(pmap_t pmap) free_pv_chunk(pc); } } - pmap_invalidate_all(pmap); if (lock != NULL) rw_wunlock(lock); + pmap_invalidate_all(pmap); PMAP_UNLOCK(pmap); vm_page_free_pages_toq(&free, true); } /* - * This is used to check if a page has been accessed or modified. As we - * don't have a bit to see if it has been modified we have to assume it - * has been if the page is read/write. + * This is used to check if a page has been accessed or modified. */ static boolean_t pmap_page_test_mappings(vm_page_t m, boolean_t accessed, boolean_t modified) From owner-svn-src-head@freebsd.org Sun Nov 10 09:25:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95ABB1AF83B; Sun, 10 Nov 2019 09:25:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479pWh3NP4z3HgX; Sun, 10 Nov 2019 09:25:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5850C24E81; Sun, 10 Nov 2019 09:25:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA9PK1q062187; Sun, 10 Nov 2019 09:25:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA9PKtc062186; Sun, 10 Nov 2019 09:25:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911100925.xAA9PKtc062186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 10 Nov 2019 09:25:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354588 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 09:25:20 -0000 Author: kib Date: Sun Nov 10 09:25:19 2019 New Revision: 354588 URL: https://svnweb.freebsd.org/changeset/base/354588 Log: Include cache zones into zone_foreach() where appropriate. The r354367 is reverted since it is subsumed by this, more complete, approach. Suggested by: markj Reviewed by: alc. glebius, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22242 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sun Nov 10 09:14:22 2019 (r354587) +++ head/sys/vm/uma_core.c Sun Nov 10 09:25:19 2019 (r354588) @@ -503,8 +503,8 @@ zone_put_bucket(uma_zone_t zone, uma_zone_domain_t zdo { ZONE_LOCK_ASSERT(zone); - KASSERT(zone->uz_bkt_count < zone->uz_bkt_max, ("%s: zone %p overflow", - __func__, zone)); + KASSERT(!ws || zone->uz_bkt_count < zone->uz_bkt_max, + ("%s: zone %p overflow", __func__, zone)); if (ws) TAILQ_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link); @@ -582,9 +582,13 @@ zone_domain_update_wss(uma_zone_domain_t zdom) static void zone_timeout(uma_zone_t zone) { - uma_keg_t keg = zone->uz_keg; + uma_keg_t keg; u_int slabs; + if ((zone->uz_flags & UMA_ZFLAG_CACHE) != 0) + goto update_wss; + + keg = zone->uz_keg; KEG_LOCK(keg); /* * Expand the keg hash table. @@ -623,6 +627,7 @@ zone_timeout(uma_zone_t zone) } KEG_UNLOCK(keg); +update_wss: ZONE_LOCK(zone); for (int i = 0; i < vm_ndomains; i++) zone_domain_update_wss(&zone->uz_domain[i]); @@ -1081,7 +1086,8 @@ zone_reclaim(uma_zone_t zone, int waitok, bool drain) * we're running. Normally the uma_rwlock would protect us but we * must be able to release and acquire the right lock for each keg. */ - keg_drain(zone->uz_keg); + if ((zone->uz_flags & UMA_ZFLAG_CACHE) == 0) + keg_drain(zone->uz_keg); ZONE_LOCK(zone); zone->uz_flags &= ~UMA_ZFLAG_RECLAIMING; wakeup(zone); @@ -2027,6 +2033,8 @@ zone_foreach(void (*zfunc)(uma_zone_t)) LIST_FOREACH(zone, &keg->uk_zones, uz_link) zfunc(zone); } + LIST_FOREACH(zone, &uma_cachezones, uz_link) + zfunc(zone); if (__predict_true(booted == BOOT_RUNNING)) rw_runlock(&uma_rwlock); } @@ -2198,7 +2206,6 @@ uma_startup2(void) static void uma_startup3(void) { - uma_zone_t zone; #ifdef INVARIANTS TUNABLE_INT_FETCH("vm.debug.divisor", &dbg_divisor); @@ -2206,8 +2213,6 @@ uma_startup3(void) uma_skip_cnt = counter_u64_alloc(M_WAITOK); #endif zone_foreach(zone_alloc_counters); - LIST_FOREACH(zone, &uma_cachezones, uz_link) - zone_alloc_counters(zone); callout_init(&uma_callout, 1); callout_reset(&uma_callout, UMA_TIMEOUT * hz, uma_timeout, NULL); booted = BOOT_RUNNING; From owner-svn-src-head@freebsd.org Sun Nov 10 09:28:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0E8B1AF96C; Sun, 10 Nov 2019 09:28:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479pb84ypYz3Hqn; Sun, 10 Nov 2019 09:28:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E9FB24E8D; Sun, 10 Nov 2019 09:28:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA9SK2K062375; Sun, 10 Nov 2019 09:28:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA9SIY6062366; Sun, 10 Nov 2019 09:28:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911100928.xAA9SIY6062366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 10 Nov 2019 09:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354589 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 354589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 09:28:20 -0000 Author: kib Date: Sun Nov 10 09:28:18 2019 New Revision: 354589 URL: https://svnweb.freebsd.org/changeset/base/354589 Log: amd64: move common_tss into pcpu. This saves some memory, around 256K I think. It removes some code, e.g. KPTI does not need to specially map common_tss anymore. Also, common_tss become domain-local. Reviewed by: jhb Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22231 Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/db_interface.c head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/amd64/sys_machdep.c head/sys/amd64/include/pcpu.h head/sys/amd64/include/tss.h Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Sun Nov 10 09:25:19 2019 (r354588) +++ head/sys/amd64/amd64/cpu_switch.S Sun Nov 10 09:28:18 2019 (r354589) @@ -188,8 +188,10 @@ do_kthread: /* Do we need to reload tss ? */ movq PCPU(TSSP),%rax movq PCB_TSSP(%r8),%rdx + movq PCPU(PRVSPACE),%r13 + addq $PC_COMMONTSS,%r13 testq %rdx,%rdx - cmovzq PCPU(COMMONTSSP),%rdx + cmovzq %r13,%rdx cmpq %rax,%rdx jne do_tss done_tss: Modified: head/sys/amd64/amd64/db_interface.c ============================================================================== --- head/sys/amd64/amd64/db_interface.c Sun Nov 10 09:25:19 2019 (r354588) +++ head/sys/amd64/amd64/db_interface.c Sun Nov 10 09:28:18 2019 (r354589) @@ -97,9 +97,9 @@ void db_show_mdpcpu(struct pcpu *pc) { + db_printf("self = %p\n", pc->pc_prvspace); db_printf("curpmap = %p\n", pc->pc_curpmap); db_printf("tssp = %p\n", pc->pc_tssp); - db_printf("commontssp = %p\n", pc->pc_commontssp); db_printf("rsp0 = 0x%lx\n", pc->pc_rsp0); db_printf("kcr3 = 0x%lx\n", pc->pc_kcr3); db_printf("ucr3 = 0x%lx\n", pc->pc_ucr3); Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Sun Nov 10 09:25:19 2019 (r354588) +++ head/sys/amd64/amd64/genassym.c Sun Nov 10 09:28:18 2019 (r354589) @@ -225,7 +225,7 @@ ASSYM(PC_RSP0, offsetof(struct pcpu, pc_rsp0)); ASSYM(PC_FS32P, offsetof(struct pcpu, pc_fs32p)); ASSYM(PC_GS32P, offsetof(struct pcpu, pc_gs32p)); ASSYM(PC_LDT, offsetof(struct pcpu, pc_ldt)); -ASSYM(PC_COMMONTSSP, offsetof(struct pcpu, pc_commontssp)); +ASSYM(PC_COMMONTSS, offsetof(struct pcpu, pc_common_tss)); ASSYM(PC_TSS, offsetof(struct pcpu, pc_tss)); ASSYM(PC_PM_SAVE_CNT, offsetof(struct pcpu, pc_pm_save_cnt)); ASSYM(PC_KCR3, offsetof(struct pcpu, pc_kcr3)); Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sun Nov 10 09:25:19 2019 (r354588) +++ head/sys/amd64/amd64/machdep.c Sun Nov 10 09:28:18 2019 (r354589) @@ -669,8 +669,6 @@ static char nmi0_stack[PAGE_SIZE] __aligned(16); static char dbg0_stack[PAGE_SIZE] __aligned(16); CTASSERT(sizeof(struct nmi_pcpu) == 16); -struct amd64tss common_tss[MAXCPU]; - /* * Software prototypes -- in more palatable form. * @@ -1550,8 +1548,7 @@ amd64_bsp_pcpu_init1(struct pcpu *pc) PCPU_SET(prvspace, pc); PCPU_SET(curthread, &thread0); - PCPU_SET(tssp, &common_tss[0]); - PCPU_SET(commontssp, &common_tss[0]); + PCPU_SET(tssp, PCPU_PTR(common_tss)); PCPU_SET(tss, (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); PCPU_SET(ldt, (struct system_segment_descriptor *)&gdt[GUSERLDT_SEL]); PCPU_SET(fs32p, &gdt[GUFS32_SEL]); @@ -1572,9 +1569,12 @@ void amd64_bsp_ist_init(struct pcpu *pc) { struct nmi_pcpu *np; + struct amd64tss *tssp; + tssp = &pc->pc_common_tss; + /* doublefault stack space, runs on ist1 */ - common_tss[0].tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)]; + tssp->tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)]; /* * NMI stack, runs on ist2. The pcpu pointer is stored just @@ -1582,7 +1582,7 @@ amd64_bsp_ist_init(struct pcpu *pc) */ np = ((struct nmi_pcpu *)&nmi0_stack[sizeof(nmi0_stack)]) - 1; np->np_pcpu = (register_t)pc; - common_tss[0].tss_ist2 = (long)np; + tssp->tss_ist2 = (long)np; /* * MC# stack, runs on ist3. The pcpu pointer is stored just @@ -1590,14 +1590,14 @@ amd64_bsp_ist_init(struct pcpu *pc) */ np = ((struct nmi_pcpu *)&mce0_stack[sizeof(mce0_stack)]) - 1; np->np_pcpu = (register_t)pc; - common_tss[0].tss_ist3 = (long)np; + tssp->tss_ist3 = (long)np; /* * DB# stack, runs on ist4. */ np = ((struct nmi_pcpu *)&dbg0_stack[sizeof(dbg0_stack)]) - 1; np->np_pcpu = (register_t)pc; - common_tss[0].tss_ist4 = (long)np; + tssp->tss_ist4 = (long)np; } u_int64_t @@ -1664,6 +1664,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) */ pmap_thread_init_invl_gen(&thread0); + pc = &temp_bsp_pcpu; + /* * make gdt memory segments */ @@ -1672,14 +1674,13 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) x != GUSERLDT_SEL && x != (GUSERLDT_SEL) + 1) ssdtosd(&gdt_segs[x], &gdt[x]); } - gdt_segs[GPROC0_SEL].ssd_base = (uintptr_t)&common_tss[0]; + gdt_segs[GPROC0_SEL].ssd_base = (uintptr_t)&pc->pc_common_tss; ssdtosyssd(&gdt_segs[GPROC0_SEL], (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); r_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; r_gdt.rd_base = (long) gdt; lgdt(&r_gdt); - pc = &temp_bsp_pcpu; wrmsr(MSR_FSBASE, 0); /* User value */ wrmsr(MSR_GSBASE, (u_int64_t)pc); @@ -1781,7 +1782,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) amd64_bsp_ist_init(pc); /* Set the IO permission bitmap (empty due to tss seg limit) */ - common_tss[0].tss_iobase = sizeof(struct amd64tss) + IOPERM_BITMAP_SIZE; + pc->pc_common_tss.tss_iobase = sizeof(struct amd64tss) + + IOPERM_BITMAP_SIZE; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); ltr(gsel_tss); @@ -1865,7 +1867,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) rsp0 = thread0.td_md.md_stack_base; /* Ensure the stack is aligned to 16 bytes */ rsp0 &= ~0xFul; - common_tss[0].tss_rsp0 = rsp0; + __pcpu[0].pc_common_tss.tss_rsp0 = rsp0; amd64_bsp_pcpu_init2(rsp0); /* transfer to user mode */ Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sun Nov 10 09:25:19 2019 (r354588) +++ head/sys/amd64/amd64/mp_machdep.c Sun Nov 10 09:28:18 2019 (r354589) @@ -285,26 +285,51 @@ init_secondary(void) /* Update microcode before doing anything else. */ ucode_load_ap(cpu); + /* Get per-cpu data and save */ + pc = &__pcpu[cpu]; + + /* prime data page for it to use */ + pcpu_init(pc, cpu, sizeof(struct pcpu)); + dpcpu_init(dpcpu, cpu); + pc->pc_apic_id = cpu_apic_ids[cpu]; + pc->pc_prvspace = pc; + pc->pc_curthread = 0; + pc->pc_tssp = &pc->pc_common_tss; + pc->pc_rsp0 = 0; + pc->pc_pti_rsp0 = (((vm_offset_t)&pc->pc_pti_stack + + PC_PTI_STACK_SZ * sizeof(uint64_t)) & ~0xful); + pc->pc_tss = (struct system_segment_descriptor *)&gdt[NGDT * cpu + + GPROC0_SEL]; + pc->pc_fs32p = &gdt[NGDT * cpu + GUFS32_SEL]; + pc->pc_gs32p = &gdt[NGDT * cpu + GUGS32_SEL]; + pc->pc_ldt = (struct system_segment_descriptor *)&gdt[NGDT * cpu + + GUSERLDT_SEL]; + /* See comment in pmap_bootstrap(). */ + pc->pc_pcid_next = PMAP_PCID_KERN + 2; + pc->pc_pcid_gen = 1; + /* Init tss */ - common_tss[cpu] = common_tss[0]; - common_tss[cpu].tss_iobase = sizeof(struct amd64tss) + + pc->pc_common_tss = __pcpu[0].pc_common_tss; + pc->pc_common_tss.tss_iobase = sizeof(struct amd64tss) + IOPERM_BITMAP_SIZE; - common_tss[cpu].tss_ist1 = (long)&doublefault_stack[PAGE_SIZE]; + pc->pc_common_tss.tss_rsp0 = 0; + pc->pc_common_tss.tss_ist1 = (long)&doublefault_stack[PAGE_SIZE]; + /* The NMI stack runs on IST2. */ np = ((struct nmi_pcpu *) &nmi_stack[PAGE_SIZE]) - 1; - common_tss[cpu].tss_ist2 = (long) np; + pc->pc_common_tss.tss_ist2 = (long)np; /* The MC# stack runs on IST3. */ np = ((struct nmi_pcpu *) &mce_stack[PAGE_SIZE]) - 1; - common_tss[cpu].tss_ist3 = (long) np; + pc->pc_common_tss.tss_ist3 = (long)np; /* The DB# stack runs on IST4. */ np = ((struct nmi_pcpu *) &dbg_stack[PAGE_SIZE]) - 1; - common_tss[cpu].tss_ist4 = (long) np; + pc->pc_common_tss.tss_ist4 = (long)np; /* Prepare private GDT */ - gdt_segs[GPROC0_SEL].ssd_base = (long) &common_tss[cpu]; + gdt_segs[GPROC0_SEL].ssd_base = (long)&pc->pc_common_tss; for (x = 0; x < NGDT; x++) { if (x != GPROC0_SEL && x != (GPROC0_SEL + 1) && x != GUSERLDT_SEL && x != (GUSERLDT_SEL + 1)) @@ -313,45 +338,20 @@ init_secondary(void) ssdtosyssd(&gdt_segs[GPROC0_SEL], (struct system_segment_descriptor *)&gdt[NGDT * cpu + GPROC0_SEL]); ap_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; - ap_gdt.rd_base = (long) &gdt[NGDT * cpu]; + ap_gdt.rd_base = (u_long)&gdt[NGDT * cpu]; lgdt(&ap_gdt); /* does magic intra-segment return */ - /* Get per-cpu data */ - pc = &__pcpu[cpu]; - - /* prime data page for it to use */ - pcpu_init(pc, cpu, sizeof(struct pcpu)); - dpcpu_init(dpcpu, cpu); - pc->pc_apic_id = cpu_apic_ids[cpu]; - pc->pc_prvspace = pc; - pc->pc_curthread = 0; - pc->pc_tssp = &common_tss[cpu]; - pc->pc_commontssp = &common_tss[cpu]; - pc->pc_rsp0 = 0; - pc->pc_pti_rsp0 = (((vm_offset_t)&pc->pc_pti_stack + - PC_PTI_STACK_SZ * sizeof(uint64_t)) & ~0xful); - pc->pc_tss = (struct system_segment_descriptor *)&gdt[NGDT * cpu + - GPROC0_SEL]; - pc->pc_fs32p = &gdt[NGDT * cpu + GUFS32_SEL]; - pc->pc_gs32p = &gdt[NGDT * cpu + GUGS32_SEL]; - pc->pc_ldt = (struct system_segment_descriptor *)&gdt[NGDT * cpu + - GUSERLDT_SEL]; - /* See comment in pmap_bootstrap(). */ - pc->pc_pcid_next = PMAP_PCID_KERN + 2; - pc->pc_pcid_gen = 1; - common_tss[cpu].tss_rsp0 = 0; - /* Save the per-cpu pointer for use by the NMI handler. */ np = ((struct nmi_pcpu *) &nmi_stack[PAGE_SIZE]) - 1; - np->np_pcpu = (register_t) pc; + np->np_pcpu = (register_t)pc; /* Save the per-cpu pointer for use by the MC# handler. */ np = ((struct nmi_pcpu *) &mce_stack[PAGE_SIZE]) - 1; - np->np_pcpu = (register_t) pc; + np->np_pcpu = (register_t)pc; /* Save the per-cpu pointer for use by the DB# handler. */ np = ((struct nmi_pcpu *) &dbg_stack[PAGE_SIZE]) - 1; - np->np_pcpu = (register_t) pc; + np->np_pcpu = (register_t)pc; wrmsr(MSR_FSBASE, 0); /* User value */ wrmsr(MSR_GSBASE, (u_int64_t)pc); Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Nov 10 09:25:19 2019 (r354588) +++ head/sys/amd64/amd64/pmap.c Sun Nov 10 09:28:18 2019 (r354589) @@ -1765,6 +1765,10 @@ pmap_bootstrap(vm_paddr_t *firstaddr) pcpu_init(&__pcpu[0], 0, sizeof(struct pcpu)); amd64_bsp_pcpu_init1(&__pcpu[0]); amd64_bsp_ist_init(&__pcpu[0]); + gdt_segs[GPROC0_SEL].ssd_base = (uintptr_t)&__pcpu[0].pc_common_tss; + ssdtosyssd(&gdt_segs[GPROC0_SEL], + (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); + ltr(GSEL(GPROC0_SEL, SEL_KPL)); __pcpu[0].pc_dynamic = temp_bsp_pcpu.pc_dynamic; __pcpu[0].pc_acpi_id = temp_bsp_pcpu.pc_acpi_id; @@ -9719,20 +9723,19 @@ pmap_pti_init(void) sizeof(struct user_segment_descriptor) * NGDT * MAXCPU, false); pmap_pti_add_kva_locked((vm_offset_t)idt, (vm_offset_t)idt + sizeof(struct gate_descriptor) * NIDT, false); - pmap_pti_add_kva_locked((vm_offset_t)common_tss, - (vm_offset_t)common_tss + sizeof(struct amd64tss) * MAXCPU, false); CPU_FOREACH(i) { /* Doublefault stack IST 1 */ - va = common_tss[i].tss_ist1; + va = __pcpu[i].pc_common_tss.tss_ist1; pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); /* NMI stack IST 2 */ - va = common_tss[i].tss_ist2 + sizeof(struct nmi_pcpu); + va = __pcpu[i].pc_common_tss.tss_ist2 + sizeof(struct nmi_pcpu); pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); /* MC# stack IST 3 */ - va = common_tss[i].tss_ist3 + sizeof(struct nmi_pcpu); + va = __pcpu[i].pc_common_tss.tss_ist3 + + sizeof(struct nmi_pcpu); pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); /* DB# stack IST 4 */ - va = common_tss[i].tss_ist4 + sizeof(struct nmi_pcpu); + va = __pcpu[i].pc_common_tss.tss_ist4 + sizeof(struct nmi_pcpu); pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); } pmap_pti_add_kva_locked((vm_offset_t)kernphys + KERNBASE, Modified: head/sys/amd64/amd64/sys_machdep.c ============================================================================== --- head/sys/amd64/amd64/sys_machdep.c Sun Nov 10 09:25:19 2019 (r354588) +++ head/sys/amd64/amd64/sys_machdep.c Sun Nov 10 09:28:18 2019 (r354589) @@ -426,8 +426,7 @@ amd64_set_ioperm(td, uap) memset(iomap, 0xff, IOPERM_BITMAP_SIZE); critical_enter(); /* Takes care of tss_rsp0. */ - memcpy(tssp, &common_tss[PCPU_GET(cpuid)], - sizeof(struct amd64tss)); + memcpy(tssp, PCPU_PTR(common_tss), sizeof(struct amd64tss)); tssp->tss_iobase = sizeof(*tssp); pcb->pcb_tssp = tssp; tss_sd = PCPU_GET(tss); Modified: head/sys/amd64/include/pcpu.h ============================================================================== --- head/sys/amd64/include/pcpu.h Sun Nov 10 09:25:19 2019 (r354588) +++ head/sys/amd64/include/pcpu.h Sun Nov 10 09:28:18 2019 (r354589) @@ -35,6 +35,8 @@ #error "sys/cdefs.h is a prerequisite for this file" #endif +#include + #define PC_PTI_STACK_SZ 16 struct monitorbuf { @@ -56,7 +58,7 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x c struct pcpu *pc_prvspace; /* Self-reference */ \ struct pmap *pc_curpmap; \ struct amd64tss *pc_tssp; /* TSS segment active on CPU */ \ - struct amd64tss *pc_commontssp;/* Common TSS for the CPU */ \ + void *pc_pad0; \ uint64_t pc_kcr3; \ uint64_t pc_ucr3; \ uint64_t pc_saved_ucr3; \ @@ -89,7 +91,8 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x c uint32_t pc_pad[2]; \ uint8_t pc_mds_tmp[64]; \ u_int pc_ipi_bitmap; \ - char __pad[3172] /* pad to UMA_PCPU_ALLOC_SIZE */ + struct amd64tss pc_common_tss; \ + char __pad[3068] /* pad to UMA_PCPU_ALLOC_SIZE */ #define PC_DBREG_CMD_NONE 0 #define PC_DBREG_CMD_LOAD 1 Modified: head/sys/amd64/include/tss.h ============================================================================== --- head/sys/amd64/include/tss.h Sun Nov 10 09:25:19 2019 (r354588) +++ head/sys/amd64/include/tss.h Sun Nov 10 09:28:18 2019 (r354589) @@ -65,8 +65,4 @@ struct amd64tss { u_int16_t tss_iobase; /* io bitmap offset */ }; -#ifdef _KERNEL -extern struct amd64tss common_tss[]; -#endif - #endif /* _MACHINE_TSS_H_ */ From owner-svn-src-head@freebsd.org Sun Nov 10 09:41:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12D371B0060; Sun, 10 Nov 2019 09:41:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479ptK6jXpz3Jss; Sun, 10 Nov 2019 09:41:29 +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 C9AAF251AB; Sun, 10 Nov 2019 09:41:29 +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 xAA9fTWe072589; Sun, 10 Nov 2019 09:41:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAA9fTON072587; Sun, 10 Nov 2019 09:41:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911100941.xAA9fTON072587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 10 Nov 2019 09:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354591 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 09:41:30 -0000 Author: kib Date: Sun Nov 10 09:41:29 2019 New Revision: 354591 URL: https://svnweb.freebsd.org/changeset/base/354591 Log: amd64: Change SFENCE to locked op for synchronizing with CLFLUSHOPT on Intel. Reviewed by: cem, jhb Discussed with: alc, scottph Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22007 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Nov 10 09:32:17 2019 (r354590) +++ head/sys/amd64/amd64/pmap.c Sun Nov 10 09:41:29 2019 (r354591) @@ -3053,16 +3053,16 @@ pmap_force_invalidate_cache_range(vm_offset_t sva, vm_ if ((cpu_stdext_feature & CPUID_STDEXT_CLFLUSHOPT) != 0) { /* - * Do per-cache line flush. Use the sfence + * Do per-cache line flush. Use a locked * instruction to insure that previous stores are * included in the write-back. The processor * propagates flush to other processors in the cache * coherence domain. */ - sfence(); + atomic_thread_fence_seq_cst(); for (; sva < eva; sva += cpu_clflush_line_size) clflushopt(sva); - sfence(); + atomic_thread_fence_seq_cst(); } else { /* * Writes are ordered by CLFLUSH on Intel CPUs. @@ -3104,7 +3104,7 @@ pmap_invalidate_cache_pages(vm_page_t *pages, int coun pmap_invalidate_cache(); else { if (useclflushopt) - sfence(); + atomic_thread_fence_seq_cst(); else if (cpu_vendor_id != CPU_VENDOR_INTEL) mfence(); for (i = 0; i < count; i++) { @@ -3118,7 +3118,7 @@ pmap_invalidate_cache_pages(vm_page_t *pages, int coun } } if (useclflushopt) - sfence(); + atomic_thread_fence_seq_cst(); else if (cpu_vendor_id != CPU_VENDOR_INTEL) mfence(); } @@ -3139,10 +3139,10 @@ pmap_flush_cache_range(vm_offset_t sva, vm_offset_t ev if (pmap_kextract(sva) == lapic_paddr) return; - sfence(); + atomic_thread_fence_seq_cst(); for (; sva < eva; sva += cpu_clflush_line_size) clwb(sva); - sfence(); + atomic_thread_fence_seq_cst(); } void @@ -3175,7 +3175,7 @@ pmap_flush_cache_phys_range(vm_paddr_t spa, vm_paddr_t sched_pin(); pte_store(pte, spa | pte_bits); invlpg(vaddr); - /* XXXKIB sfences inside flush_cache_range are excessive */ + /* XXXKIB atomic inside flush_cache_range are excessive */ pmap_flush_cache_range(vaddr, vaddr + PAGE_SIZE); sched_unpin(); } @@ -9504,10 +9504,10 @@ pmap_large_map_wb_fence_mfence(void) } static void -pmap_large_map_wb_fence_sfence(void) +pmap_large_map_wb_fence_atomic(void) { - sfence(); + atomic_thread_fence_seq_cst(); } static void @@ -9522,7 +9522,7 @@ DEFINE_IFUNC(static, void, pmap_large_map_wb_fence, (v return (pmap_large_map_wb_fence_mfence); else if ((cpu_stdext_feature & (CPUID_STDEXT_CLWB | CPUID_STDEXT_CLFLUSHOPT)) == 0) - return (pmap_large_map_wb_fence_sfence); + return (pmap_large_map_wb_fence_atomic); else /* clflush is strongly enough ordered */ return (pmap_large_map_wb_fence_nop); From owner-svn-src-head@freebsd.org Sun Nov 10 10:03:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D795F1B04A8; Sun, 10 Nov 2019 10:03:23 +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 479qMb4gcHz3KhB; Sun, 10 Nov 2019 10:03:23 +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 83C14255B9; Sun, 10 Nov 2019 10:03:23 +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 xAAA3Nkx086153; Sun, 10 Nov 2019 10:03:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAAA3NPH086151; Sun, 10 Nov 2019 10:03:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911101003.xAAA3NPH086151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 10 Nov 2019 10:03:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354592 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 354592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 10:03:23 -0000 Author: kib Date: Sun Nov 10 10:03:22 2019 New Revision: 354592 URL: https://svnweb.freebsd.org/changeset/base/354592 Log: amd64: change r_gdt to the local variable in hammer_time(). Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/include/segments.h Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sun Nov 10 09:41:29 2019 (r354591) +++ head/sys/amd64/amd64/machdep.c Sun Nov 10 10:03:22 2019 (r354592) @@ -213,7 +213,7 @@ long realmem = 0; struct kva_md_info kmi; static struct trapframe proc0_tf; -struct region_descriptor r_gdt, r_idt; +struct region_descriptor r_idt; struct pcpu *__pcpu; struct pcpu temp_bsp_pcpu; @@ -1609,6 +1609,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct xstate_hdr *xhdr; u_int64_t rsp0; char *env; + struct region_descriptor r_gdt; size_t kstack0_sz; int late_console; Modified: head/sys/amd64/include/segments.h ============================================================================== --- head/sys/amd64/include/segments.h Sun Nov 10 09:41:29 2019 (r354591) +++ head/sys/amd64/include/segments.h Sun Nov 10 10:03:22 2019 (r354592) @@ -92,7 +92,7 @@ struct region_descriptor { extern struct user_segment_descriptor gdt[]; extern struct soft_segment_descriptor gdt_segs[]; extern struct gate_descriptor *idt; -extern struct region_descriptor r_gdt, r_idt; +extern struct region_descriptor r_idt; void lgdt(struct region_descriptor *rdp); void sdtossd(struct user_segment_descriptor *sdp, From owner-svn-src-head@freebsd.org Sun Nov 10 15:04:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 872831B69EC; Sun, 10 Nov 2019 15:04: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 479y2S2zJKz43Yf; Sun, 10 Nov 2019 15:04: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 4902DB42; Sun, 10 Nov 2019 15:04: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 xAAF40mV062033; Sun, 10 Nov 2019 15:04:00 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAAF40ZD062032; Sun, 10 Nov 2019 15:04:00 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911101504.xAAF40ZD062032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 10 Nov 2019 15:04:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354593 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 15:04:00 -0000 Author: tsoome Date: Sun Nov 10 15:03:59 2019 New Revision: 354593 URL: https://svnweb.freebsd.org/changeset/base/354593 Log: loader: memory leak in vdev_label_read_config() We need to free the allocated buffer for label. Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Sun Nov 10 10:03:22 2019 (r354592) +++ head/stand/libsa/zfs/zfsimpl.c Sun Nov 10 15:03:59 2019 (r354593) @@ -1622,10 +1622,8 @@ vdev_label_read_config(vdev_t *vd, uint64_t txg) nvl_size = VDEV_PHYS_SIZE - sizeof (zio_eck_t) - 4; nvl = malloc(nvl_size); - if (nvl == NULL) { - free(label); - return (NULL); - } + if (nvl == NULL) + goto done; for (int l = 0; l < VDEV_LABELS; l++) { const unsigned char *nvlist; @@ -1643,7 +1641,7 @@ vdev_label_read_config(vdev_t *vd, uint64_t txg) DATA_TYPE_UINT64, NULL, &label_txg); if (error != 0 || label_txg == 0) { memcpy(nvl, nvlist, nvl_size); - return (nvl); + goto done; } if (label_txg <= txg && label_txg > best_txg) { @@ -1666,6 +1664,8 @@ vdev_label_read_config(vdev_t *vd, uint64_t txg) free(nvl); nvl = NULL; } +done: + free(label); return (nvl); } From owner-svn-src-head@freebsd.org Sun Nov 10 15:07:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1806F1B6B53; Sun, 10 Nov 2019 15:07:37 +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 479y6c6tmjz43jY; Sun, 10 Nov 2019 15:07: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 D019EB46; Sun, 10 Nov 2019 15:07: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 xAAF7a4N062238; Sun, 10 Nov 2019 15:07:36 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAAF7aDv062237; Sun, 10 Nov 2019 15:07:36 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911101507.xAAF7aDv062237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 10 Nov 2019 15:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354594 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 15:07:37 -0000 Author: tsoome Date: Sun Nov 10 15:07:36 2019 New Revision: 354594 URL: https://svnweb.freebsd.org/changeset/base/354594 Log: loader: use struct initializer in vdev_probe(). Hopefully it is a bit more clear this way. Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Sun Nov 10 15:03:59 2019 (r354593) +++ head/stand/libsa/zfs/zfsimpl.c Sun Nov 10 15:07:36 2019 (r354594) @@ -1697,7 +1697,7 @@ vdev_uberblock_load(vdev_t *vd, uberblock_t *ub) static int vdev_probe(vdev_phys_read_t *_read, void *read_priv, spa_t **spap) { - vdev_t vtmp; + vdev_t vtmp = { 0 }; spa_t *spa; vdev_t *vdev, *top_vdev, *pool_vdev; unsigned char *nvlist; @@ -1713,7 +1713,6 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s * Load the vdev label and figure out which * uberblock is most current. */ - memset(&vtmp, 0, sizeof(vtmp)); vtmp.v_phys_read = _read; vtmp.v_read_priv = read_priv; vtmp.v_psize = P2ALIGN(ldi_get_size(read_priv), From owner-svn-src-head@freebsd.org Sun Nov 10 16:08:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 655071B7E06; Sun, 10 Nov 2019 16:08:26 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479zSn2mXMz46j8; Sun, 10 Nov 2019 16:08:25 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr1-x441.google.com with SMTP id a15so12001183wrf.9; Sun, 10 Nov 2019 08:08:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=eht6eibHYoKmAU6t9ungnQD/lViJ8RY5t99Dhzoqcbg=; b=ltvQYtOB9fq6e9yDGYC0+FJ2FYx1hjhCXEoyZbP+482p3PYaIuP4PbkallgaLq6Zj8 R/4VZ9qiTV8GBEtyU0e7XllCZYlTTNFDnAGBa7FhLBjRx6dq48hm8EtSOGvA7RkeGZrg NhF11gUpt1Cosewy0T6+OKiM/R6yU17ywDJa1jtK5EpSfA8ojE4De1079B4QyE3IxIbn lN0GG4+bT8L37w1P6zFOX+RALW6fJVzFP7ZT8i9UFomfhBMSDctGP0JVkLOlPawp0LIb ippNj5vkinB6jiD1Rv/jSHff+BFosFGmYq8JuF6bQo66xenaz2LHi7e9XUr6hd4J0qdK qpuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=eht6eibHYoKmAU6t9ungnQD/lViJ8RY5t99Dhzoqcbg=; b=SY6t0FNGSVhPq/BWrcQUNP4RwbU8fkCsNuQAe8s70PmIydH6BlsYUN/ydCVp5cS0pd j5Dze/myWWc/AKnuCiEQl9H32Cfs0nJMVfsDkK5XGHndo1A7WLOud45JVnP4QSGgVjrA GUhAuAu0RR6hiJMyKAgvnbqeBlVoPXw1R8VfHA+gjbnrN2LXneb2OevM/SJWsey7FDkp 0N2Q7KWf+jhQAgO8fc9yEIvVs5nOgLefeXDwlCuZSG6QtSC7693+AunPKeo5fBiiHxw4 iac1+mWy/XR6tE+B/UJQuxf4RHXtVhT/lcasNET+71MsDTLGtrJPrWhBY3Lv5Vjj9R12 /k+Q== X-Gm-Message-State: APjAAAVubM24DtmoptyBZVn+ZDi7vLHc4BP565pYB4UFcZYoWbjDrzAw 3rSfR7r3BuFmqmnAtJ3hwicl+Sn1 X-Google-Smtp-Source: APXvYqwe8eHX2Ffizn9v+V3hx1+YY4z0TC7bN7LVCsSxIKD/fp+rCZn9ClCuVtnLb6QDRFXrMb0HzA== X-Received: by 2002:a05:6000:11c4:: with SMTP id i4mr16788691wrx.277.1573402103236; Sun, 10 Nov 2019 08:08:23 -0800 (PST) Received: from brick (cpc92302-cmbg19-2-0-cust461.5-4.cable.virginm.net. [82.1.209.206]) by smtp.gmail.com with ESMTPSA id c9sm11378411wmb.42.2019.11.10.08.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Nov 2019 08:08:22 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Sun, 10 Nov 2019 16:08:19 +0000 From: Edward Tomasz Napierala To: Alexander Leidinger Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354458 - head/libexec/rc/rc.d Message-ID: <20191110160819.GA1095@brick> Mail-Followup-To: Alexander Leidinger , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911071815.xA7IFOhI070066@repo.freebsd.org> <20191109204958.Horde.B0ynnS_aur1OZimnDNObsAt@webmail.leidinger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191109204958.Horde.B0ynnS_aur1OZimnDNObsAt@webmail.leidinger.net> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 479zSn2mXMz46j8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=ltvQYtOB; dmarc=none; spf=pass (mx1.freebsd.org: domain of etnapierala@gmail.com designates 2a00:1450:4864:20::441 as permitted sender) smtp.mailfrom=etnapierala@gmail.com X-Spamd-Result: default: False [-2.14 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[1.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-0.44)[ip: (2.61), ipnet: 2a00:1450::/32(-2.75), asn: 15169(-2.00), country: US(-0.05)]; FORGED_SENDER(0.30)[trasz@freebsd.org,etnapierala@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[206.209.1.82.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[trasz@freebsd.org,etnapierala@gmail.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 16:08:26 -0000 On 1109T2049, Alexander Leidinger wrote: > Quoting Edward Tomasz Napierala (from Thu, 7 Nov > 2019 18:15:24 +0000 (UTC)): > > > Author: trasz > > Date: Thu Nov 7 18:15:24 2019 > > New Revision: 354458 > > URL: https://svnweb.freebsd.org/changeset/base/354458 > > > > Log: > > Extend the linux rc script to mount the neccessary file systems, > > set ELF fallback brand, and load pty(4). > > We never did something like that. We have it documented everywhere > that it needs to be done manually. So this is at least a POLA > violation. It is great that the nocover option is used in the mount, > but it's still some kind of layering violation (I may want to have > only a subset mounted, or nothing at all). It is kind of a POLA violation, but previously the linux_enable knob didn't do much apart from loading the linux{,64}.ko kernel module and doing something weird with ldconfig, which I'm not even sure is actually useful. In other words, the old behaviour can be restored by just not using linux_enable, and instead loading the kernel modules the same way all the others are loaded. Could you give me some use case why someone would want only a subset of the filesystems? > I do not object to the functionality, but I think it needs to be > configurable (an option to influence if the auto-mount is done or not, > doesn't matter to me what the default behavior is, as long as it is > configurable) and documented (UPDATING, handbook, man-pages, maybe > even the release notes). Man page updates are pending review at https://reviews.freebsd.org/D22277. Good point about the Handbook and release notes; I'll take a look. From owner-svn-src-head@freebsd.org Sun Nov 10 17:00:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDB8F1B8C4A; Sun, 10 Nov 2019 17:00:27 +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 47B0cq6FZBz48x7; Sun, 10 Nov 2019 17:00:27 +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 A140B1F04; Sun, 10 Nov 2019 17:00:27 +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 xAAH0R2l027486; Sun, 10 Nov 2019 17:00:27 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAAH0OqB027468; Sun, 10 Nov 2019 17:00:24 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201911101700.xAAH0OqB027468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 10 Nov 2019 17:00:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354595 - in head: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src contrib/file/tests lib/libmagic X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src contrib/file/tests lib/libmagic X-SVN-Commit-Revision: 354595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 17:00:27 -0000 Author: delphij Date: Sun Nov 10 17:00:23 2019 New Revision: 354595 URL: https://svnweb.freebsd.org/changeset/base/354595 Log: MFV r354582: file 5.37. MFC after: 3 days Added: head/contrib/file/magic/Magdir/biosig - copied unchanged from r354582, vendor/file/dist/magic/Magdir/biosig head/contrib/file/magic/Magdir/clojure - copied unchanged from r354582, vendor/file/dist/magic/Magdir/clojure head/contrib/file/magic/Magdir/edid - copied unchanged from r354582, vendor/file/dist/magic/Magdir/edid head/contrib/file/magic/Magdir/espressif - copied unchanged from r354582, vendor/file/dist/magic/Magdir/espressif head/contrib/file/magic/Magdir/glibc - copied unchanged from r354582, vendor/file/dist/magic/Magdir/glibc head/contrib/file/magic/Magdir/hardware - copied unchanged from r354582, vendor/file/dist/magic/Magdir/hardware head/contrib/file/magic/Magdir/kicad - copied unchanged from r354582, vendor/file/dist/magic/Magdir/kicad head/contrib/file/magic/Magdir/numpy - copied unchanged from r354582, vendor/file/dist/magic/Magdir/numpy head/contrib/file/magic/Magdir/rpmsg - copied unchanged from r354582, vendor/file/dist/magic/Magdir/rpmsg head/contrib/file/src/is_json.c - copied unchanged from r354582, vendor/file/dist/src/is_json.c head/contrib/file/tests/CVE-2014-1943.result - copied unchanged from r354582, vendor/file/dist/tests/CVE-2014-1943.result head/contrib/file/tests/CVE-2014-1943.testfile - copied unchanged from r354582, vendor/file/dist/tests/CVE-2014-1943.testfile head/contrib/file/tests/fit-map-data.result - copied unchanged from r354582, vendor/file/dist/tests/fit-map-data.result head/contrib/file/tests/fit-map-data.testfile - copied unchanged from r354582, vendor/file/dist/tests/fit-map-data.testfile head/contrib/file/tests/issue359xlsx.result - copied unchanged from r354582, vendor/file/dist/tests/issue359xlsx.result head/contrib/file/tests/issue359xlsx.testfile - copied unchanged from r354582, vendor/file/dist/tests/issue359xlsx.testfile head/contrib/file/tests/json1.result - copied unchanged from r354582, vendor/file/dist/tests/json1.result head/contrib/file/tests/json1.testfile - copied unchanged from r354582, vendor/file/dist/tests/json1.testfile head/contrib/file/tests/json2.result - copied unchanged from r354582, vendor/file/dist/tests/json2.result head/contrib/file/tests/json2.testfile - copied unchanged from r354582, vendor/file/dist/tests/json2.testfile head/contrib/file/tests/json3.result - copied unchanged from r354582, vendor/file/dist/tests/json3.result head/contrib/file/tests/json3.testfile - copied unchanged from r354582, vendor/file/dist/tests/json3.testfile head/contrib/file/tests/regex-eol.magic - copied unchanged from r354582, vendor/file/dist/tests/regex-eol.magic head/contrib/file/tests/regex-eol.result - copied unchanged from r354582, vendor/file/dist/tests/regex-eol.result head/contrib/file/tests/regex-eol.testfile - copied unchanged from r354582, vendor/file/dist/tests/regex-eol.testfile head/contrib/file/tests/zstd-3-skippable-frames.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-3-skippable-frames.result head/contrib/file/tests/zstd-dictionary-0.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-dictionary-0.result head/contrib/file/tests/zstd-dictionary-1.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-dictionary-1.result head/contrib/file/tests/zstd-dictionary-2.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-dictionary-2.result head/contrib/file/tests/zstd-skippable-frame-0.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-skippable-frame-0.result head/contrib/file/tests/zstd-skippable-frame-4.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-skippable-frame-4.result head/contrib/file/tests/zstd-skippable-frame-8.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-skippable-frame-8.result head/contrib/file/tests/zstd-skippable-frame-C.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-skippable-frame-C.result head/contrib/file/tests/zstd-v0.2-FF.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.2-FF.result head/contrib/file/tests/zstd-v0.2-FF.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.2-FF.testfile head/contrib/file/tests/zstd-v0.3-FF.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.3-FF.result head/contrib/file/tests/zstd-v0.3-FF.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.3-FF.testfile head/contrib/file/tests/zstd-v0.4-FF.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.4-FF.result head/contrib/file/tests/zstd-v0.4-FF.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.4-FF.testfile head/contrib/file/tests/zstd-v0.5-FF.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.5-FF.result head/contrib/file/tests/zstd-v0.5-FF.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.5-FF.testfile head/contrib/file/tests/zstd-v0.6-FF.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.6-FF.result head/contrib/file/tests/zstd-v0.6-FF.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.6-FF.testfile head/contrib/file/tests/zstd-v0.7-00.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.7-00.result head/contrib/file/tests/zstd-v0.7-21.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.7-21.result head/contrib/file/tests/zstd-v0.7-21.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.7-21.testfile head/contrib/file/tests/zstd-v0.7-22.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.7-22.result head/contrib/file/tests/zstd-v0.7-22.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.7-22.testfile head/contrib/file/tests/zstd-v0.8-00.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-00.result head/contrib/file/tests/zstd-v0.8-01.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-01.result head/contrib/file/tests/zstd-v0.8-01.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-01.testfile head/contrib/file/tests/zstd-v0.8-02.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-02.result head/contrib/file/tests/zstd-v0.8-02.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-02.testfile head/contrib/file/tests/zstd-v0.8-03.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-03.result head/contrib/file/tests/zstd-v0.8-03.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-03.testfile head/contrib/file/tests/zstd-v0.8-16.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-16.result head/contrib/file/tests/zstd-v0.8-16.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-16.testfile head/contrib/file/tests/zstd-v0.8-20.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-20.result head/contrib/file/tests/zstd-v0.8-20.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-20.testfile head/contrib/file/tests/zstd-v0.8-21.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-21.result head/contrib/file/tests/zstd-v0.8-21.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-21.testfile head/contrib/file/tests/zstd-v0.8-22.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-22.result head/contrib/file/tests/zstd-v0.8-22.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-22.testfile head/contrib/file/tests/zstd-v0.8-23.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-23.result head/contrib/file/tests/zstd-v0.8-23.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-23.testfile head/contrib/file/tests/zstd-v0.8-F4.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-F4.result head/contrib/file/tests/zstd-v0.8-F4.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-F4.testfile head/contrib/file/tests/zstd-v0.8-FF.result - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-FF.result head/contrib/file/tests/zstd-v0.8-FF.testfile - copied unchanged from r354582, vendor/file/dist/tests/zstd-v0.8-FF.testfile Modified: head/contrib/file/AUTHORS head/contrib/file/COPYING head/contrib/file/ChangeLog head/contrib/file/NEWS head/contrib/file/README head/contrib/file/config.h.in head/contrib/file/configure head/contrib/file/configure.ac head/contrib/file/doc/file.man head/contrib/file/doc/libmagic.man head/contrib/file/doc/magic.man head/contrib/file/magic/Header head/contrib/file/magic/Magdir/acorn head/contrib/file/magic/Magdir/adventure head/contrib/file/magic/Magdir/algol68 head/contrib/file/magic/Magdir/amigaos head/contrib/file/magic/Magdir/android head/contrib/file/magic/Magdir/animation head/contrib/file/magic/Magdir/apple head/contrib/file/magic/Magdir/archive head/contrib/file/magic/Magdir/audio head/contrib/file/magic/Magdir/basis head/contrib/file/magic/Magdir/ber head/contrib/file/magic/Magdir/bioinformatics head/contrib/file/magic/Magdir/blcr head/contrib/file/magic/Magdir/blender head/contrib/file/magic/Magdir/c-lang head/contrib/file/magic/Magdir/cad head/contrib/file/magic/Magdir/cafebabe head/contrib/file/magic/Magdir/coff head/contrib/file/magic/Magdir/commands head/contrib/file/magic/Magdir/compress head/contrib/file/magic/Magdir/console head/contrib/file/magic/Magdir/coverage head/contrib/file/magic/Magdir/ctf head/contrib/file/magic/Magdir/cups head/contrib/file/magic/Magdir/database head/contrib/file/magic/Magdir/dataone head/contrib/file/magic/Magdir/dbpf head/contrib/file/magic/Magdir/dolby head/contrib/file/magic/Magdir/dyadic head/contrib/file/magic/Magdir/ebml head/contrib/file/magic/Magdir/elf head/contrib/file/magic/Magdir/erlang head/contrib/file/magic/Magdir/esri head/contrib/file/magic/Magdir/filesystems head/contrib/file/magic/Magdir/finger head/contrib/file/magic/Magdir/flash head/contrib/file/magic/Magdir/fonts head/contrib/file/magic/Magdir/fsav head/contrib/file/magic/Magdir/games head/contrib/file/magic/Magdir/geo head/contrib/file/magic/Magdir/gnome head/contrib/file/magic/Magdir/gnu head/contrib/file/magic/Magdir/graphviz head/contrib/file/magic/Magdir/guile head/contrib/file/magic/Magdir/hitachi-sh head/contrib/file/magic/Magdir/hp head/contrib/file/magic/Magdir/ibm6000 head/contrib/file/magic/Magdir/images head/contrib/file/magic/Magdir/intel head/contrib/file/magic/Magdir/isz head/contrib/file/magic/Magdir/java head/contrib/file/magic/Magdir/jpeg head/contrib/file/magic/Magdir/keepass head/contrib/file/magic/Magdir/kerberos head/contrib/file/magic/Magdir/kml head/contrib/file/magic/Magdir/linux head/contrib/file/magic/Magdir/lisp head/contrib/file/magic/Magdir/llvm head/contrib/file/magic/Magdir/lua head/contrib/file/magic/Magdir/m4 head/contrib/file/magic/Magdir/macintosh head/contrib/file/magic/Magdir/mail.news head/contrib/file/magic/Magdir/map head/contrib/file/magic/Magdir/marc21 head/contrib/file/magic/Magdir/matroska head/contrib/file/magic/Magdir/mercurial head/contrib/file/magic/Magdir/metastore head/contrib/file/magic/Magdir/microfocus head/contrib/file/magic/Magdir/misctools head/contrib/file/magic/Magdir/modem head/contrib/file/magic/Magdir/mozilla head/contrib/file/magic/Magdir/msdos head/contrib/file/magic/Magdir/msooxml head/contrib/file/magic/Magdir/msvc head/contrib/file/magic/Magdir/neko head/contrib/file/magic/Magdir/netbsd head/contrib/file/magic/Magdir/nitpicker head/contrib/file/magic/Magdir/ole2compounddocs head/contrib/file/magic/Magdir/palm head/contrib/file/magic/Magdir/parrot head/contrib/file/magic/Magdir/pbf head/contrib/file/magic/Magdir/pc98 head/contrib/file/magic/Magdir/pgp head/contrib/file/magic/Magdir/polyml head/contrib/file/magic/Magdir/printer head/contrib/file/magic/Magdir/psl head/contrib/file/magic/Magdir/pwsafe head/contrib/file/magic/Magdir/python head/contrib/file/magic/Magdir/qt head/contrib/file/magic/Magdir/revision head/contrib/file/magic/Magdir/riff head/contrib/file/magic/Magdir/ruby head/contrib/file/magic/Magdir/scientific head/contrib/file/magic/Magdir/selinux head/contrib/file/magic/Magdir/sendmail head/contrib/file/magic/Magdir/sequent head/contrib/file/magic/Magdir/sgml head/contrib/file/magic/Magdir/sniffer head/contrib/file/magic/Magdir/sql head/contrib/file/magic/Magdir/sun head/contrib/file/magic/Magdir/sysex head/contrib/file/magic/Magdir/tcl head/contrib/file/magic/Magdir/terminfo head/contrib/file/magic/Magdir/tex head/contrib/file/magic/Magdir/tplink head/contrib/file/magic/Magdir/unicode head/contrib/file/magic/Magdir/varied.script head/contrib/file/magic/Magdir/virtual head/contrib/file/magic/Magdir/warc head/contrib/file/magic/Magdir/webassembly head/contrib/file/magic/Magdir/windows head/contrib/file/magic/Magdir/wordprocessors head/contrib/file/magic/Magdir/wsdl head/contrib/file/magic/Magdir/xwindows head/contrib/file/magic/Magdir/yara head/contrib/file/magic/Magdir/zip head/contrib/file/magic/Makefile.am head/contrib/file/magic/Makefile.in head/contrib/file/src/Makefile.am head/contrib/file/src/Makefile.in head/contrib/file/src/apprentice.c head/contrib/file/src/apptype.c head/contrib/file/src/ascmagic.c head/contrib/file/src/asprintf.c head/contrib/file/src/buffer.c head/contrib/file/src/cdf.c head/contrib/file/src/cdf.h head/contrib/file/src/cdf_time.c head/contrib/file/src/compress.c head/contrib/file/src/der.c head/contrib/file/src/dprintf.c head/contrib/file/src/elfclass.h head/contrib/file/src/encoding.c head/contrib/file/src/file.c head/contrib/file/src/file.h head/contrib/file/src/fmtcheck.c head/contrib/file/src/fsmagic.c head/contrib/file/src/funcs.c head/contrib/file/src/getopt_long.c head/contrib/file/src/is_tar.c head/contrib/file/src/magic.c head/contrib/file/src/magic.h.in head/contrib/file/src/mygetopt.h head/contrib/file/src/print.c head/contrib/file/src/readcdf.c head/contrib/file/src/readelf.c head/contrib/file/src/readelf.h head/contrib/file/src/seccomp.c head/contrib/file/src/softmagic.c head/contrib/file/src/vasprintf.c head/contrib/file/tests/Makefile.am head/contrib/file/tests/Makefile.in head/lib/libmagic/Makefile head/lib/libmagic/config.h Directory Properties: head/contrib/file/ (props changed) Modified: head/contrib/file/AUTHORS ============================================================================== --- head/contrib/file/AUTHORS Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/AUTHORS Sun Nov 10 17:00:23 2019 (r354595) @@ -1 +1 @@ -See COPYING. \ No newline at end of file +See COPYING. Modified: head/contrib/file/COPYING ============================================================================== --- head/contrib/file/COPYING Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/COPYING Sun Nov 10 17:00:23 2019 (r354595) @@ -1,4 +1,4 @@ -$File: COPYING,v 1.1 2008/02/05 19:08:11 christos Exp $ +$File: COPYING,v 1.2 2018/09/09 20:33:28 christos Exp $ Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995. Software written by Ian F. Darwin and others; maintained 1994- Christos Zoulas. @@ -15,7 +15,7 @@ are met: 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Modified: head/contrib/file/ChangeLog ============================================================================== --- head/contrib/file/ChangeLog Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/ChangeLog Sun Nov 10 17:00:23 2019 (r354595) @@ -1,3 +1,75 @@ +2019-05-14 22:26 Christos Zoulas + + * release 5.37 + +2019-05-09 22:27 Christos Zoulas + + * Make sure that continuation separators are printed + with -k within softmagic + +2019-05-06 22:27 Christos Zoulas + + * Change SIGPIPE saving and restoring during compression to use + sigaction(2) instead of signal(3) and cache it. (Denys Vlasenko) + * Cache stat(2) calls more to reduce number of calls (Denys Vlasenko) + +2019-05-06 17:25 Christos Zoulas + + * PR/77: Handle --mime-type and -k correctly. + +2019-05-03 15:26 Christos Zoulas + + * Switch decompression code to use vfork() because + tools like rpmdiff and rpmbuild call libmagic + with large process footprints (Denys Vlasenko) + +2019-04-07 14:05 Christos Zoulas + + * PR/75: --enable-zlib, did not work. + +2019-02-27 11:54 Christos Zoulas + + * Improve regex efficiency (Michael Schroeder) by: + 1. Prefixing regex searches with regular search + for keywords where possible + 2. Using memmem(3) where available + +2019-02-20 10:16 Christos Zoulas + + * release 5.36 + +2019-02-19 15:30 Christos Zoulas + + * Fix cast to use cast macros + * Add UCS-32 builtin detection (PR/61) reported by tmc + +2019-02-18 18:24 Christos Zoulas + + * Fix stack read (PR/62) and write (PR/64) stack overflows + reported by spinpx + +2018-10-18 19:32 Christos Zoulas + + * release 5.35 + +2018-09-10 20:38 Christos Zoulas + + * Add FreeBSD ELF core file support (John Baldwin) + +2018-08-20 18:40 Christos Zoulas + + * PR/30: Allow all parameter values to be set (don't treat 0 specially) + * handle default annotations on the softmagic match instead at the + end. + +2018-07-25 10:17 Christos Zoulas + + * PR/23: Recognize JSON files + +2018-07-25 10:17 Christos Zoulas + + * PR/18: file --mime-encoding should not print mime-type + 2018-07-25 8:50 Christos Zoulas * release 5.34 @@ -14,11 +86,11 @@ * release 5.33 -2018-02-24 14:50 Christos Zoulas +2018-02-24 14:50 Christos Zoulas * extend the support for ${x?:} expansions for magic descriptions -2018-02-21 16:25 Christos Zoulas +2018-02-21 16:25 Christos Zoulas * add support for ${x?:} in mime types to handle pie binaries. @@ -90,7 +162,7 @@ * Add missing overflow check in der magic (Jonas Wagner) 2016-10-25 10:40 Christos Zoulas - + * release 5.29 2016-10-24 11:20 Christos Zoulas @@ -131,11 +203,11 @@ - set offset to 0 on failure. 2016-05-13 12:00 Christos Zoulas - + * release 5.27 2016-04-18 9:35 Christos Zoulas - + * Errors comparing DER entries or computing offsets are just indications of malformed non-DER files. Don't print them. @@ -144,7 +216,7 @@ * Put new bytes constant in the right file (not the generated one) 2016-04-16 18:34 Christos Zoulas - + * release 5.26 2016-03-31 13:50 Christos Zoulas @@ -190,7 +262,7 @@ * PR/492: compression forking was broken with magic_buffer. 2015-09-16 9:50 Christos Zoulas - + * release 5.25 2015-09-11 13:25 Christos Zoulas @@ -218,7 +290,7 @@ * release 5.23 2015-06-09 16:10 Christos Zoulas - + * Fix issue with regex range for magic with offset * Always return true from mget with USE (success to mget not match indication). Fixes mime evaluation after USE magic @@ -271,12 +343,12 @@ * add indirect relative for TIFF/Exif 2014-12-16 18:10 Christos Zoulas - + * restructure elf note printing to avoid repeated messages * add note limit, suggested by Alexander Cherepanov 2014-12-16 16:53 Christos Zoulas - + * Bail out on partial pread()'s (Alexander Cherepanov) * Fix incorrect bounds check in file_printable (Alexander Cherepanov) @@ -287,7 +359,7 @@ more places for safety * in ELF, instead of "(uses dynamic libraries)" when PT_INTERP is present print the interpreter name. - + 2014-12-10 20:01 Christos Zoulas * release 5.21 @@ -330,7 +402,7 @@ on a byte by byte basis, so that we don't get issues with locale's trying to interpret random byte streams as UTF-8 and having printf error out with EILSEQ. - + 2014-10-17 11:48 Christos Zoulas * fix bounds in note reading (Francisco Alonso / Red Hat) @@ -361,7 +433,7 @@ * release 5.19 2014-06-09 9:04 Christos Zoulas - + * Misc buffer overruns and missing buffer size tests in cdf parsing (Francisco Alonso, Jan Kaluza) @@ -391,7 +463,7 @@ 2014-05-04 14:55 Christos Zoulas - * PR/351: Fix compilation of empty files + * PR/351: Fix compilation of empty files 2014-04-30 17:39 Christos Zoulas @@ -495,7 +567,7 @@ * Don't treat magic as an error if offset was past EOF (Christoph Biedl) 2013-05-28 17:25 Christos Zoulas - + * Fix spacing issues in softmagic and elf (Jan Kaluza) 2013-05-02 18:00 Christos Zoulas @@ -551,7 +623,7 @@ * Make getline public so that file can link against it. Perhaps it is better to rename it, or hide it differently. Fixes builds on platforms that do not provide it. - + 2013-01-07 16:30 Christos Zoulas * Add SuS d{,1,2,4,8}, u{,1,2,4,8} and document @@ -901,7 +973,7 @@ (Cheng Renquan) 2009-05-08 13:40 Christos Zoulas - + * lint fixes and more from NetBSD 2009-05-06 10:25 Christos Zoulas @@ -921,7 +993,7 @@ 2009-03-27 18:43 Christos Zoulas - * don't print \012- separators in the same magic entry + * don't print \012- separators in the same magic entry if it consists of multiple magic printing lines. 2009-03-23 10:20 Christos Zoulas Modified: head/contrib/file/NEWS ============================================================================== --- head/contrib/file/NEWS Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/NEWS Sun Nov 10 17:00:23 2019 (r354595) @@ -1 +1 @@ -See ChangeLog. \ No newline at end of file +See ChangeLog. Modified: head/contrib/file/README ============================================================================== --- head/contrib/file/README Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/README Sun Nov 10 17:00:23 2019 (r354595) @@ -1,6 +1,6 @@ -## README for file(1) Command ## +## README for file(1) Command and the libmagic(3) library ## - @(#) $File: README,v 1.54 2018/05/30 03:06:56 christos Exp $ + @(#) $File: README,v 1.57 2019/02/06 00:20:56 christos Exp $ Mailing List: file@astron.com Mailing List archives: http://mailman.astron.com/pipermail/file/ @@ -63,53 +63,54 @@ magic numbers assigned to all sorts of data files that are in reasonable circulation. Send your magic numbers, in magic(5) format please, to the maintainer, Christos Zoulas. -COPYING - read this first. -README - read this second (you are currently reading this file). +COPYING - read this first. +README - read this second (you are currently reading this file). INSTALL - read on how to install -src/apprentice.c - parses /etc/magic to learn magic -src/apptype.c - used for OS/2 specific application type magic -src/ascmagic.c - third & last set of tests, based on hardwired assumptions. -src/asctime_r.c - replacement for OS's that don't have it. -src/asprintf.c - replacement for OS's that don't have it. -src/asctime_r.c - replacement for OS's that don't have it. -src/asprintf.c - replacement for OS's that don't have it. +src/apprentice.c - parses /etc/magic to learn magic +src/apptype.c - used for OS/2 specific application type magic +src/ascmagic.c - third & last set of tests, based on hardwired assumptions. +src/asctime_r.c - replacement for OS's that don't have it. +src/asprintf.c - replacement for OS's that don't have it. +src/asctime_r.c - replacement for OS's that don't have it. +src/asprintf.c - replacement for OS's that don't have it. src/buffer.c - buffer handling functions. -src/cdf.[ch] - parser for Microsoft Compound Document Files -src/cdf_time.c - time converter for CDF. -src/compress.c - handles decompressing files to look inside. -src/ctime_r.c - replacement for OS's that don't have it. +src/cdf.[ch] - parser for Microsoft Compound Document Files +src/cdf_time.c - time converter for CDF. +src/compress.c - handles decompressing files to look inside. +src/ctime_r.c - replacement for OS's that don't have it. src/der.[ch] - parser for Distinguished Encoding Rules src/dprintf.c - replacement for OS's that don't have it. src/elfclass.h - common code for elf 32/64. -src/encoding.c - handles unicode encodings -src/file.c - the main program -src/file.h - header file +src/encoding.c - handles unicode encodings +src/file.c - the main program +src/file.h - header file src/file_opts.h - list of options -src/fmtcheck.c - replacement for OS's that don't have it. -src/fsmagic.c - first set of tests the program runs, based on filesystem info -src/funcs.c - utilility functions -src/getline.c - replacement for OS's that don't have it. -src/getopt_long.c - replacement for OS's that don't have it. -src/gmtime_r.c - replacement for OS's that don't have it. -src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). -src/localtime_r.c - replacement for OS's that don't have it. +src/fmtcheck.c - replacement for OS's that don't have it. +src/fsmagic.c - first set of tests the program runs, based on filesystem info +src/funcs.c - utilility functions +src/getline.c - replacement for OS's that don't have it. +src/getopt_long.c - replacement for OS's that don't have it. +src/gmtime_r.c - replacement for OS's that don't have it. +src/is_json.c - knows about JavaScript Object Notation format (RFC 8259). +src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). +src/localtime_r.c - replacement for OS's that don't have it. src/magic.h.in - source file for magic.h -src/mygetopt.h - replacement for OS's that don't have it. -src/magic.c - the libmagic api -src/names.h - header file for ascmagic.c -src/pread.c - replacement for OS's that don't have it. -src/print.c - print results, errors, warnings. -src/readcdf.c - CDF wrapper. -src/readelf.[ch] - Stand-alone elf parsing code. -src/softmagic.c - 2nd set of tests, based on /etc/magic -src/mygetopt.h - replacement for OS's that don't have it. -src/strcasestr.c - replacement for OS's that don't have it. -src/strlcat.c - replacement for OS's that don't have it. -src/strlcpy.c - replacement for OS's that don't have it. -src/strndup.c - replacement for OS's that don't have it. +src/mygetopt.h - replacement for OS's that don't have it. +src/magic.c - the libmagic api +src/names.h - header file for ascmagic.c +src/pread.c - replacement for OS's that don't have it. +src/print.c - print results, errors, warnings. +src/readcdf.c - CDF wrapper. +src/readelf.[ch] - Stand-alone elf parsing code. +src/softmagic.c - 2nd set of tests, based on /etc/magic +src/mygetopt.h - replacement for OS's that don't have it. +src/strcasestr.c - replacement for OS's that don't have it. +src/strlcat.c - replacement for OS's that don't have it. +src/strlcpy.c - replacement for OS's that don't have it. +src/strndup.c - replacement for OS's that don't have it. src/tar.h - tar file definitions -src/vasprintf.c - for systems that don't have it. -doc/file.man - man page for the command +src/vasprintf.c - for systems that don't have it. +doc/file.man - man page for the command doc/magic.man - man page for the magic file, courtesy Guy Harris. Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile. Modified: head/contrib/file/config.h.in ============================================================================== --- head/contrib/file/config.h.in Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/config.h.in Sun Nov 10 17:00:23 2019 (r354595) @@ -83,12 +83,6 @@ /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R @@ -98,6 +92,9 @@ /* Define to 1 if declares mbstate_t. */ #undef HAVE_MBSTATE_T +/* Define to 1 if you have the `memmem' function. */ +#undef HAVE_MEMMEM + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H @@ -116,18 +113,9 @@ /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the header file. */ -#undef HAVE_SIGNAL_H - /* Have sig_t type */ #undef HAVE_SIG_T -/* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H - /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -137,9 +125,6 @@ /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H @@ -158,9 +143,6 @@ /* Define to 1 if you have the `strtof' function. */ #undef HAVE_STRTOF -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - /* HAVE_STRUCT_OPTION */ #undef HAVE_STRUCT_OPTION @@ -181,6 +163,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSMACROS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H Modified: head/contrib/file/configure ============================================================================== --- head/contrib/file/configure Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/configure Sun Nov 10 17:00:23 2019 (r354595) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.34. +# Generated by GNU Autoconf 2.69 for file 5.37. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.34' -PACKAGE_STRING='file 5.34' +PACKAGE_VERSION='5.37' +PACKAGE_STRING='file 5.37' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1329,7 +1329,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.34 to adapt to many kinds of systems. +\`configure' configures file 5.37 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1399,7 +1399,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.34:";; + short | recursive ) echo "Configuration of file 5.37:";; esac cat <<\_ACEOF @@ -1511,7 +1511,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.34 +file configure 5.37 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2167,7 +2167,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.34, which was +It was created by file $as_me 5.37, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3033,7 +3033,7 @@ fi # Define the identity of the package. PACKAGE='file' - VERSION='5.34' + VERSION='5.37' cat >>confdefs.h <<_ACEOF @@ -12784,7 +12784,7 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi -for ac_header in stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h +for ac_header in stdint.h fcntl.h inttypes.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12797,7 +12797,7 @@ fi done -for ac_header in stddef.h utime.h wchar.h wctype.h limits.h +for ac_header in utime.h wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12810,7 +12810,7 @@ fi done -for ac_header in getopt.h err.h xlocale.h signal.h +for ac_header in getopt.h err.h xlocale.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12823,7 +12823,7 @@ fi done -for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h +for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12850,10 +12850,7 @@ fi done fi -ac_fn_c_check_type "$LINENO" "sig_t" "ac_cv_type_sig_t" " -#ifdef HAVE_SIGNAL_H -#include -#endif +ac_fn_c_check_type "$LINENO" "sig_t" "ac_cv_type_sig_t" "#include " if test "x$ac_cv_type_sig_t" = xyes; then : @@ -12976,7 +12973,8 @@ _ACEOF fi -ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "$ac_includes_default" +ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include +" if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then : cat >>confdefs.h <<_ACEOF @@ -14229,7 +14227,7 @@ fi fi -for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale +for ac_func in strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -14583,7 +14581,8 @@ if test "$enable_zlib" = "yes"; then if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then as_fn_error $? "zlib support requested but not found" "$LINENO" 5 fi -elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then +fi +if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then $as_echo "#define ZLIBSUPPORT 1" >>confdefs.h @@ -15134,7 +15133,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.34, which was +This file was extended by file $as_me 5.37, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15200,7 +15199,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.34 +file config.status 5.37 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/file/configure.ac ============================================================================== --- head/contrib/file/configure.ac Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/configure.ac Sun Nov 10 17:00:23 2019 (r354595) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.34],[christos@astron.com]) +AC_INIT([file],[5.37],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -35,12 +35,12 @@ fi], [ ]) AC_MSG_CHECKING(for zlib support) -AC_ARG_ENABLE(zlib, +AC_ARG_ENABLE([zlib], [AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])]) AC_MSG_RESULT($enable_zlib) AC_MSG_CHECKING(for libseccomp support) -AC_ARG_ENABLE(libseccomp, +AC_ARG_ENABLE([libseccomp], [AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])]) AC_MSG_RESULT($enable_libseccomp) @@ -90,17 +90,14 @@ dnl Checks for headers AC_HEADER_STDC AC_HEADER_MAJOR AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) -AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) -AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h) -AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) +AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h) +AC_CHECK_HEADERS(utime.h wchar.h wctype.h) +AC_CHECK_HEADERS(getopt.h err.h xlocale.h) +AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h) if test "$enable_zlib" != "no"; then AC_CHECK_HEADERS(zlib.h) fi -AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[ -#ifdef HAVE_SIGNAL_H -#include -#endif]) +AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include ]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -108,7 +105,7 @@ AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_CHECK_MEMBERS([struct stat.st_rdev]) -AC_CHECK_MEMBERS([struct tm.tm_gmtoff]) +AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include ]) AC_STRUCT_TIMEZONE AC_STRUCT_TIMEZONE_DAYLIGHT AC_SYS_LARGEFILE @@ -154,7 +151,7 @@ else fi]) dnl Checks for functions -AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) +AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem) dnl Provide implementation of some required functions if necessary AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf) @@ -178,7 +175,8 @@ if test "$enable_zlib" = "yes"; then if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then AC_MSG_ERROR([zlib support requested but not found]) fi -elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then +fi +if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support]) fi Modified: head/contrib/file/doc/file.man ============================================================================== --- head/contrib/file/doc/file.man Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/doc/file.man Sun Nov 10 17:00:23 2019 (r354595) @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.131 2018/07/24 21:33:56 christos Exp $ -.Dd July 25, 2018 +.\" $File: file.man,v 1.135 2019/03/03 02:32:40 christos Exp $ +.Dd February 18, 2019 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -159,7 +159,7 @@ two groups, so they are performed last. The language test routines also test for some miscellany (such as .Xr tar 1 -archives). +archives, JSON files). .Pp Any file that cannot be identified as having been written in any of the character sets listed above is simply said to be @@ -171,6 +171,8 @@ Causes the file command to output the file type and cr used by older MacOS versions. The code consists of eight letters, the first describing the file type, the latter the creator. +This option works properly only for file formats that have the +apple-style output defined. .It Fl b , Fl Fl brief Do not prepend filenames to output lines (brief mode). .It Fl C , Fl Fl compile @@ -213,6 +215,8 @@ Checks for, and looks inside, compressed files. .It elf Prints ELF file details, provided soft magic tests are enabled and the elf magic is found. +.It json +Examines JSON (RFC-7159) files by parsing them for compliance. .It soft Consults magic files. .It tar @@ -629,11 +633,11 @@ were written by John Gilmore from his public-domain program, and are not covered by the above license. .Sh BUGS Please report bugs and send patches to the bug tracker at -.Pa http://bugs.astron.com/ +.Pa https://bugs.astron.com/ or the mailing list at .Aq file@astron.com (visit -.Pa http://mailman.astron.com/mailman/listinfo/file +.Pa https://mailman.astron.com/mailman/listinfo/file first to subscribe). .Sh TODO Fix output so that tests for MIME and APPLE flags are not needed all Modified: head/contrib/file/doc/libmagic.man ============================================================================== --- head/contrib/file/doc/libmagic.man Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/doc/libmagic.man Sun Nov 10 17:00:23 2019 (r354595) @@ -1,6 +1,6 @@ -.\" $File: libmagic.man,v 1.41 2017/05/23 21:54:07 christos Exp $ +.\" $File: libmagic.man,v 1.44 2018/09/09 20:33:28 christos Exp $ .\" -.\" Copyright (c) Christos Zoulas 2003. +.\" Copyright (c) Christos Zoulas 2003, 2018. .\" All Rights Reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 23, 2017 +.Dd August 18, 2018 .Dt LIBMAGIC 3 .Os .Sh NAME @@ -159,6 +159,8 @@ Don't examine tar files. Don't check for various types of text files. .It Dv MAGIC_NO_CHECK_TOKENS Don't look for known tokens inside ascii files. +.It Dv MAGIC_NO_CHECK_JSON +Don't example JSON files. .El .Pp The @@ -391,6 +393,19 @@ The compiled default magic database. .Sh SEE ALSO .Xr file __CSECTION__ , .Xr magic __FSECTION__ +.Sh BUGS +The results from +.Fn magic_buffer +and +.Fn magic_file +where the buffer and the file contain the same data +can produce different results, because in the +.Fn magic_file +case, the program can +.Xr lseek 2 +and +.Xr stat 2 +the file descriptor. .Sh AUTHORS .An M\(oans Rullg\(oard Initial libmagic implementation, and configuration. Modified: head/contrib/file/doc/magic.man ============================================================================== --- head/contrib/file/doc/magic.man Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/doc/magic.man Sun Nov 10 17:00:23 2019 (r354595) @@ -1,6 +1,5 @@ -.It S2 -.\" $File: magic.man,v 1.93 2018/06/22 20:39:49 christos Exp $ -.Dd June 22, 2018 +.\" $File: magic.man,v 1.96 2019/01/21 14:56:53 christos Exp $ +.Dd January 21, 2019 .Dt MAGIC __FSECTION__ .Os .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems. @@ -117,13 +116,13 @@ The following modifiers are supported: .It B A byte length (default). .It H -A 4 byte big endian length. -.It h A 2 byte big endian length. +.It h +A 2 byte little endian length. .It L -A 4 byte little endian length. +A 4 byte big endian length. .It l -A 2 byte little endian length. +A 4 byte little endian length. .It J The length includes itself in its count. .El Modified: head/contrib/file/magic/Header ============================================================================== --- head/contrib/file/magic/Header Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/magic/Header Sun Nov 10 17:00:23 2019 (r354595) @@ -2,4 +2,4 @@ # Format is described in magic(files), where: # files is 5 on V7 and BSD, 4 on SV, and ?? on SVID. # Don't edit this file, edit /etc/magic or send your magic improvements -# to the maintainers, at file@mx.gw.com +# to the maintainers, at file@astron.com Modified: head/contrib/file/magic/Magdir/acorn ============================================================================== --- head/contrib/file/magic/Magdir/acorn Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/magic/Magdir/acorn Sun Nov 10 17:00:23 2019 (r354595) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: acorn,v 1.6 2017/10/19 16:40:37 christos Exp $ +# $File: acorn,v 1.7 2019/04/19 00:42:27 christos Exp $ # acorn: file(1) magic for files found on Acorn systems # @@ -83,7 +83,7 @@ # compression mode y (0 - 4) for GIF LZW with a maximum n bits # (y~n,0~12,1~13,2~14,3~15,4~16) >>>5 ulelong+12 x \b, LZW %u-bits compression -# http://www.filebase.org.uk/filetypes +# https://www.filebase.org.uk/filetypes # !Packdir compressed archive has three hexadecimal digits code 68E !:mime application/x-acorn-68E !:ext pkd/bin Modified: head/contrib/file/magic/Magdir/adventure ============================================================================== --- head/contrib/file/magic/Magdir/adventure Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/magic/Magdir/adventure Sun Nov 10 17:00:23 2019 (r354595) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: adventure,v 1.17 2017/07/03 16:03:40 christos Exp $ +# $File: adventure,v 1.18 2019/04/19 00:42:27 christos Exp $ # adventure: file(1) magic for Adventure game files # # from Allen Garvin @@ -21,8 +21,8 @@ # Updated by Adam Buchbinder # #http://www.gnelson.demon.co.uk/zspec/sect11.html -#http://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt -#http://en.wikipedia.org/wiki/Z-machine +#https://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt +#https://en.wikipedia.org/wiki/Z-machine # The first byte is the Z-machine revision; it is always between 1 and 8. We # had false matches (for instance, inbig5.ocp from the Omega TeX extension as # well as an occasional MP3 file), so we sanity-check the version number. @@ -111,7 +111,7 @@ # Danny Milosavljevic # These are ADRIFT (adventure game standard) game files, extension .taf # Checked from source at (http://www.adrift.co/) and various taf files -# found at the Interactive Fiction Archive (http://ifarchive.org/) +# found at the Interactive Fiction Archive (https://ifarchive.org/) 0 belong 0x3C423FC9 >4 belong 0x6A87C2CF Adrift game file version >>8 belong 0x94453661 3.80 Modified: head/contrib/file/magic/Magdir/algol68 ============================================================================== --- head/contrib/file/magic/Magdir/algol68 Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/magic/Magdir/algol68 Sun Nov 10 17:00:23 2019 (r354595) @@ -1,17 +1,17 @@ #------------------------------------------------------------------------------ -# $File: algol68,v 1.2 2016/10/17 14:17:48 christos Exp $ +# $File: algol68,v 1.3 2018/10/19 01:04:21 christos Exp $ # algol68: file(1) magic for Algol 68 source # 0 search/8192 (input, Algol 68 source text !:mime text/x-Algol68 -0 regex \^PROC Algol 68 source text +0 regex/1024 \^PROC Algol 68 source text !:mime text/x-Algol68 -0 regex MODE[\t\ ] Algol 68 source text +0 regex/1024 \bMODE[\t\ ] Algol 68 source text !:mime text/x-Algol68 -0 regex REF[\t\ ] Algol 68 source text +0 regex/1024 \bREF[\t\ ] Algol 68 source text !:mime text/x-Algol68 -0 regex FLEX[\t\ ]\*\\[ Algol 68 source text +0 regex/1024 \bFLEX[\t\ ]\*\\[ Algol 68 source text !:mime text/x-Algol68 #0 regex [\t\ ]OD Algol 68 source text #!:mime text/x-Algol68 Modified: head/contrib/file/magic/Magdir/amigaos ============================================================================== --- head/contrib/file/magic/Magdir/amigaos Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/magic/Magdir/amigaos Sun Nov 10 17:00:23 2019 (r354595) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: amigaos,v 1.16 2017/03/17 21:35:28 christos Exp $ +# $File: amigaos,v 1.17 2018/10/16 18:57:19 christos Exp $ # amigaos: file(1) magic for AmigaOS binary formats: # @@ -66,3 +66,22 @@ # From: Przemek Kramarczyk 0 string .KEY AmigaDOS script 0 string .key AmigaDOS script + +# AMOS Basic file formats +# https://www.exotica.org.uk/wiki/AMOS_file_formats +0 string AMOS\040Basic\040 AMOS Basic source code +>11 byte =0x56 \b, tested +>11 byte =0x76 \b, untested +0 string AMOS\040Pro AMOS Basic source code +>11 byte =0x56 \b, tested +>11 byte =0x76 \b, untested +0 string AmSp AMOS Basic sprite bank +>4 beshort x \b, %d sprites +0 string AmIc AMOS Basic icon bank +>4 beshort x \b, %d icons +0 string AmBk AMOS Basic memory bank +>4 beshort x \b, bank number %d +>8 belong&0xFFFFFFF x \b, length %d +>12 regex .{8} \b, type %s +0 string AmBs AMOS Basic memory banks +>4 beshort x \b, %d banks Modified: head/contrib/file/magic/Magdir/android ============================================================================== --- head/contrib/file/magic/Magdir/android Sun Nov 10 15:07:36 2019 (r354594) +++ head/contrib/file/magic/Magdir/android Sun Nov 10 17:00:23 2019 (r354595) @@ -1,6 +1,6 @@ #------------------------------------------------------------ -# $File: android,v 1.10 2017/03/17 21:35:28 christos Exp $ +# $File: android,v 1.12 2019/04/19 00:42:27 christos Exp $ # Various android related magic entries #------------------------------------------------------------ @@ -32,33 +32,68 @@ # Android Backup archive # From: Ariel Shkedi -# File extension: .ab -# No mime-type defined +# Update: Joerg Jenderek # URL: https://github.com/android/platform_frameworks_base/blob/\ # 0bacfd2ba68d21a68a3df345b830bc2a1e515b5a/services/java/com/\ # android/server/BackupManagerService.java#L2367 +# Reference: https://sourceforge.net/projects/adbextractor/ +# android-backup-extractor/perl/backupencrypt.pl +# Note: only unix line feeds "\n" found # After the header comes a tar file # If compressed, the entire tar file is compressed with JAVA deflate # # Include the version number hardcoded with the magic string to avoid # false positives -0 string/b ANDROID\ BACKUP\n1\n Android Backup +0 string/b ANDROID\ BACKUP\n Android Backup +# maybe look for some more characteristics like linefeed '\n' or version +#>16 string \n +# No mime-type defined offically +!:mime application/x-google-ab +!:ext ab +# on 2nd line version (often 1, 2 on kitkat 4.4.3+, 4 on 7.1.2) +>15 string >\0 \b, version %s +# "1" on 3rd line means compressed >17 string 0\n \b, Not-Compressed >17 string 1\n \b, Compressed +# The 4th line is encryption "none" or "AES-256" # any string as long as it's not the word none (which is matched below) +>19 string none\n \b, Not-Encrypted +# look for backup content after line with encryption info +#>>19 search/7 \n +# data part after header for not encrypted Android Backup +#>>>&0 ubequad x \b, content 0x%16.16llx... +# look for zlib compressed by ./compress after message with 1 space at end +#>>>&0 indirect x \b; contains +# look for tar archive block by ./archive for package name manifest +>>288 string ustar \b; contains +>>>31 use tar-file +# look for zip/jar archive by ./archive ./zip after message with 1 space at end +#>>2079 search/1025/s PK\003\004 \b; contains +#>>>&0 indirect x +>19 string !none >>19 regex/1l \^([^n\n]|n[^o]|no[^n]|non[^e]|none.+).* \b, Encrypted (%s) ->>19 string none\n \b, Not-Encrypted # Commented out because they don't seem useful to print # (but they are part of the header - the tar file comes after them): +# The 5th line is User Password Salt (128 Hex) +# string length too high with standard src configuration +#>>>&1 string >\0 \b, PASSWORD salt: "%-128.128s" #>>>&1 regex/1l .* \b, Password salt: %s +# The 6th line is Master Key Checksum Salt (128 Hex) #>>>>&1 regex/1l .* \b, Master salt: %s +# The 7th line is Number of PBDKF2 Rounds (10000) #>>>>>&1 regex/1l .* \b, PBKDF2 rounds: %s +# The 8th line is User key Initialization Vector (IV) (32 Hex) #>>>>>>&1 regex/1l .* \b, IV: %s +#>>>>>>&1 regex/1l .* \b, IV: %s +# The 9th line is Master IV+Key+Checksum (192 Hex) #>>>>>>>&1 regex/1l .* \b, Key: %s +# look for new line separator char after line number 9 +#>>>0x204 ubyte 0x0a NL found +#>>>>&1 ubequad x \b, Content magic %16.16llx # *.pit files by Joerg Jenderek -# http://forum.xda-developers.com/showthread.php?p=9122369 -# http://forum.xda-developers.com/showthread.php?t=816449 +# https://forum.xda-developers.com/showthread.php?p=9122369 +# https://forum.xda-developers.com/showthread.php?t=816449 # Partition Information Table for Samsung's smartphone with Android *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Nov 10 18:07:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33DC41BAA45; Sun, 10 Nov 2019 18:07:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47B25g0L8wz4Dfl; Sun, 10 Nov 2019 18:07:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE06F2B6F; Sun, 10 Nov 2019 18:07:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAAI7251068502; Sun, 10 Nov 2019 18:07:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAAI72um068500; Sun, 10 Nov 2019 18:07:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911101807.xAAI72um068500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 10 Nov 2019 18:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354597 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 18:07:03 -0000 Author: mav Date: Sun Nov 10 18:07:02 2019 New Revision: 354597 URL: https://svnweb.freebsd.org/changeset/base/354597 Log: Some language fixes. Submitted by: rpokala@ MFC after: 2 weeks Modified: head/share/man/man4/ntb_transport.4 Modified: head/share/man/man4/ntb_transport.4 ============================================================================== --- head/share/man/man4/ntb_transport.4 Sun Nov 10 17:33:10 2019 (r354596) +++ head/share/man/man4/ntb_transport.4 Sun Nov 10 18:07:02 2019 (r354597) @@ -65,8 +65,8 @@ is a number of queues to allocate (empty means automat The default configuration is empty string, which means single consumer with one queue per memory window, allowing any driver to attach. .It Va hint.ntb_transport. Ns Ar X Ns Va .compact -Non-zero value enables compact version of sratchpad protocol, using twice -less registers. +Non-zero value enables compact version of scratchpad protocol, using half +as many registers. Enabled automatically if there is not enough registers to negotiate all available memory windows. The compact version does not support memory windows of 4GB and above. From owner-svn-src-head@freebsd.org Sun Nov 10 19:48:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C2171BDC1A; Sun, 10 Nov 2019 19:48:08 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47B4LH2HnCz4K10; Sun, 10 Nov 2019 19:48:07 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f41.google.com with SMTP id e17so9578038otk.6; Sun, 10 Nov 2019 11:48:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=eQDrYqvO+510gWvTPEkVX8VJT1lkKjfUhPzUot++ZZI=; b=LzA5f8Vbz6htEjLFCLf4MGmBDro3ZOUvqrztJa4gHP3ux8Dz7kE1dPB+mfsLrZ69ln uV4OGh9e7HNa5HRWdzZyYBNm/gh3hWPjZ7ixHwzYS26lky/0kIoYCXRwePS/jEAF5CJD BMYTtBZHakDxqlj8wQrczYlibNXB1U7dRiXM57YKT0l8WO49ZtrfsldNqhfFNMZJOUo3 QlhTH63pSX35WSP2wMZxn9ATZh6BTcHVjIU0PGzm99pbhdgdrjikAel0xSCgZAm2Mg2P KjQvlVbdYxEerCtNOg/S9UhwLHsEaJIGvwj8HjHtW3OjekZCDMqp7vqlBtN/gGBxi0Gd 4IfA== X-Gm-Message-State: APjAAAUmudM5eVEajLFboFdlUyfzWEd8epEvLKa1ECX7r9+4uZoTNlJ5 ocsgeTxOE8c97Px+MrLPbYCwkxYj X-Google-Smtp-Source: APXvYqzj2yXH0ozzfyAvsjdfekyRBX6wydbuHTbFzhO9OkyNc4u7ffdadWzPVO9hg2Xy+ztSuzqzxA== X-Received: by 2002:a9d:4c15:: with SMTP id l21mr19095114otf.204.1573415285700; Sun, 10 Nov 2019 11:48:05 -0800 (PST) Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com. [209.85.167.176]) by smtp.gmail.com with ESMTPSA id 63sm4278011oty.58.2019.11.10.11.48.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Nov 2019 11:48:05 -0800 (PST) Received: by mail-oi1-f176.google.com with SMTP id 14so3715767oir.12; Sun, 10 Nov 2019 11:48:04 -0800 (PST) X-Received: by 2002:aca:6006:: with SMTP id u6mr8025126oib.137.1573415284500; Sun, 10 Nov 2019 11:48:04 -0800 (PST) MIME-Version: 1.0 References: <201911071815.xA7IFOhI070066@repo.freebsd.org> <20191109204958.Horde.B0ynnS_aur1OZimnDNObsAt@webmail.leidinger.net> <20191110160819.GA1095@brick> In-Reply-To: <20191110160819.GA1095@brick> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sun, 10 Nov 2019 11:47:53 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354458 - head/libexec/rc/rc.d To: svn-src-head@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org X-Rspamd-Queue-Id: 47B4LH2HnCz4K10 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.210.41 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-3.15 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; MIME_TRACE(0.00)[0:+,1:+,2:~]; TO_DN_NONE(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[41.210.85.209.rep.mailspike.net : 127.0.0.18]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; HAS_REPLYTO(0.00)[cem@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[41.210.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; IP_SCORE(-1.15)[ip: (-0.49), ipnet: 209.85.128.0/17(-3.19), asn: 15169(-2.00), country: US(-0.05)]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; REPLYTO_ADDR_EQ_FROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 19:48:08 -0000 Hi, Response inline below. On Sun, Nov 10, 2019 at 08:08 Edward Tomasz Napierala wrote: > On 1109T2049, Alexander Leidinger wrote: > > Quoting Edward Tomasz Napierala (from Thu, 7 Nov > > 2019 18:15:24 +0000 (UTC)): > > > > > Author: trasz > > > Date: Thu Nov 7 18:15:24 2019 > > > New Revision: 354458 > > > URL: https://svnweb.freebsd.org/changeset/base/354458 > > > > > > Log: > > > Extend the linux rc script to mount the neccessary file systems, > > > set ELF fallback brand, and load pty(4). > > > > We never did something like that. We have it documented everywhere > > that it needs to be done manually. So this is at least a POLA > > violation. It is great that the nocover option is used in the mount, > > but it's still some kind of layering violation (I may want to have > > only a subset mounted, or nothing at all). > > It is kind of a POLA violation, but previously the linux_enable > knob didn't do much apart from loading the linux{,64}.ko kernel > module and doing something weird with ldconfig, which I'm not > even sure is actually useful. In other words, the old behaviour > can be restored by just not using linux_enable, and instead > loading the kernel modules the same way all the others are loaded. > > Could you give me some use case why someone would want only a subset > of the filesystems? They=E2=80=99re an additional attack surface. If your few linux applicatio= ns get by with fewer vfs, you might want to avoid the others. I=E2=80=99m not part= icularly attached to this reason. And imo, linux64.ko kind of dwarf that attack surface concern, so it=E2=80=99s maybe a silly point. Another problem with the current code is (and I may be mistaken here) I think that it ignores mount options configured in the admin=E2=80=99s /etc/= fstab. Eg I configure my /tmp with a hard limit on memory use and if I were to mount a compat shm tmpfs, I=E2=80=99d also want its memory use bounded. =E2= =80=9CNocover=E2=80=9D protects from covering any existing =E2=80=9Cauto=E2=80=9C mounts, but one = can imagine specifying the linux compat mount =E2=80=9Cnoauto=E2=80=9D. I am on board with making this stuff more =E2=80=9Cbatteries included=E2=80= =9D and usable by default, but just echoing the request for configurable knobs (I don=E2= =80=99t care about the defaults). Best, Conrad > > > > I do not object to the functionality, but I think it needs to be > > configurable (an option to influence if the auto-mount is done or not, > > doesn't matter to me what the default behavior is, as long as it is > > configurable) and documented (UPDATING, handbook, man-pages, maybe > > even the release notes). > > Man page updates are pending review at https://reviews.freebsd.org/D22277= . > Good point about the Handbook and release notes; I'll take a look. > > From owner-svn-src-head@freebsd.org Sun Nov 10 20:25:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27902178F74; Sun, 10 Nov 2019 20:25:12 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47B5940BB7z4LPY; Sun, 10 Nov 2019 20:25:11 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr1-x42b.google.com with SMTP id w9so5628384wrr.0; Sun, 10 Nov 2019 12:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=9oAiSq1XKacZhKlvqCSPtd2Wo3LGMTJX66SPbxW3OL4=; b=m2aizYPffqQKtzQkJf32/r0mWq+ITkoPtKGFhJ58RU9D6n3Z8o/JEflQ2TWCkORNPH aHl+8Lj+HFt9lndIP7z2945GBblpSIZX6WwHcU6fjNuGQSq0Q97rSWIOMTXlYRsAEIdG IdzKbmB6wL0dHXYMRvB8EqZxeR7z7CeBUjksO21hanOwlqvwYnnBCkUKA0JeLQdShi3K GH00d319NjJbgPBnAe6vtDBFJVXWwyKBWa/ugXJ6BwZGp3wX9UEc08XKUtV8fjJZl+do VMxWEQ8FwtbPdNSHDQseIU/ZeoClQqKzhR1A/y0aNV3ds6N/JKk8vv0GTU8CW5gxq+ao GEew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=9oAiSq1XKacZhKlvqCSPtd2Wo3LGMTJX66SPbxW3OL4=; b=oqgr/sVg3vgr27OqCUzuL0kd2WzYPjHzgSKWUi8kDf4DImupYq09WLcu9KyWFC+gua RL45x5/SX/hWW+1VdKHjhQtQfeyBbMSILbEPfkd11zHYnwnhDy0bI7RhzUI6nUO4AuCh phLp/dinlCSmqwV1YhTYSV9WObgm7dsp+fazK/7SsB3eXEJVi8J+3VGC3NstLvuqrbQy nkoxwgfY1mu5OBxLaCcBdX1tBBdLKyIl4rgbmAGhbAUBXbLVIu2PZSxsNL/sKVEy9OpG PU2qZa25QJ70Ozur1++KWU6pDKqcxLinuq6zVI/qxXNJ739nQjPdfgwis4q13omXgY9Y nCuQ== X-Gm-Message-State: APjAAAU+3DH2PpMdvKJZsOwJlLJCJyX1bTTmIpduce1YS1scT/KOgyGk z6akg+sYy4YttGqar+RTQoh+el2P X-Google-Smtp-Source: APXvYqzeS0buJ1PGA+pLDsZ89btq9vQRjmofgp0OSe7J0Rfy+EKVZ0DgsjPFp3337cQZvLODJHtS3A== X-Received: by 2002:a5d:5411:: with SMTP id g17mr14152141wrv.360.1573417508856; Sun, 10 Nov 2019 12:25:08 -0800 (PST) Received: from brick (cpc92302-cmbg19-2-0-cust461.5-4.cable.virginm.net. [82.1.209.206]) by smtp.gmail.com with ESMTPSA id w132sm21483647wma.6.2019.11.10.12.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Nov 2019 12:25:07 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Sun, 10 Nov 2019 20:25:04 +0000 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Conrad Meyer Cc: svn-src-head@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r354458 - head/libexec/rc/rc.d Message-ID: <20191110202504.GA1070@brick> Mail-Followup-To: Conrad Meyer , svn-src-head@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org References: <201911071815.xA7IFOhI070066@repo.freebsd.org> <20191109204958.Horde.B0ynnS_aur1OZimnDNObsAt@webmail.leidinger.net> <20191110160819.GA1095@brick> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47B5940BB7z4LPY X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 20:25:12 -0000 On 1110T1147, Conrad Meyer wrote: > Hi, > > Response inline below. > > On Sun, Nov 10, 2019 at 08:08 Edward Tomasz Napierala > wrote: > > > On 1109T2049, Alexander Leidinger wrote: > > > Quoting Edward Tomasz Napierala (from Thu, 7 Nov > > > 2019 18:15:24 +0000 (UTC)): > > > > > > > Author: trasz > > > > Date: Thu Nov 7 18:15:24 2019 > > > > New Revision: 354458 > > > > URL: https://svnweb.freebsd.org/changeset/base/354458 > > > > > > > > Log: > > > > Extend the linux rc script to mount the neccessary file systems, > > > > set ELF fallback brand, and load pty(4). > > > > > > We never did something like that. We have it documented everywhere > > > that it needs to be done manually. So this is at least a POLA > > > violation. It is great that the nocover option is used in the mount, > > > but it's still some kind of layering violation (I may want to have > > > only a subset mounted, or nothing at all). > > > > It is kind of a POLA violation, but previously the linux_enable > > knob didn't do much apart from loading the linux{,64}.ko kernel > > module and doing something weird with ldconfig, which I'm not > > even sure is actually useful. In other words, the old behaviour > > can be restored by just not using linux_enable, and instead > > loading the kernel modules the same way all the others are loaded. > > > > Could you give me some use case why someone would want only a subset > > of the filesystems? > > > They’re an additional attack surface. If your few linux applications get > by with fewer vfs, you might want to avoid the others. I’m not particularly > attached to this reason. And imo, linux64.ko kind of dwarf that attack > surface concern, so it’s maybe a silly point. Yeah. Imho it's kind of like removing parts of kernel itself - you can do that, if you really wanted to, but we don't provide separate knobs to make it particularly easy. > Another problem with the current code is (and I may be mistaken here) I > think that it ignores mount options configured in the admin’s /etc/fstab. > Eg I configure my /tmp with a hard limit on memory use and if I were to > mount a compat shm tmpfs, I’d also want its memory use bounded. “Nocover” > protects from covering any existing “auto“ mounts, but one can imagine > specifying the linux compat mount “noauto”. > > I am on board with making this stuff more “batteries included” and usable > by default, but just echoing the request for configurable knobs (I don’t > care about the defaults). My point is... well, there are two. First is, it's configurable already: you can comment out parts of the rc script you don't want, or you can not set linux_enable in the first place and do things it would otherwise do for you by in the usual manner - add the modules to loader.conf, add a line to sysctl.conf etc. The script simply provides a shortcut to match what 90% of users want. Second, in order to implement something properly, I need to understand how it's going to be used. I guess I worded it quite badly in the previous mail; it's wasn't supposed to sound like "Can you give me some use case because I think you're wrong", but rather a "Can you give me some use case, because without it I have no idea how to design it to fit it". [..] From owner-svn-src-head@freebsd.org Sun Nov 10 20:36:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 250B517A402; Sun, 10 Nov 2019 20:36:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47B5QH06TCz4LrH; Sun, 10 Nov 2019 20:36:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6F804913; Sun, 10 Nov 2019 20:36:38 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAAKac1R056764; Sun, 10 Nov 2019 20:36:38 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAAKacPh056763; Sun, 10 Nov 2019 20:36:38 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911102036.xAAKacPh056763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 10 Nov 2019 20:36:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354600 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 20:36:39 -0000 Author: jhibbits Date: Sun Nov 10 20:36:38 2019 New Revision: 354600 URL: https://svnweb.freebsd.org/changeset/base/354600 Log: powerpcspe: use -mspe instead of -mspe=yes to enable SPE -mspe=yes/no was deprecated even before GCC 4.2.1 in favor of -mspe/-mno-spe. Clang only supports -mspe/-mno-spe. Modified: head/share/mk/bsd.cpu.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Sun Nov 10 18:43:09 2019 (r354599) +++ head/share/mk/bsd.cpu.mk Sun Nov 10 20:36:38 2019 (r354600) @@ -137,7 +137,7 @@ _CPUCFLAGS = -Wa,-me500 -msoft-float _CPUCFLAGS = -mcpu=${CPUTYPE} -mno-powerpc64 . endif . elif ${MACHINE_ARCH} == "powerpcspe" -_CPUCFLAGS = -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double -mcpu=8548 +_CPUCFLAGS = -Wa,-me500 -mspe -mabi=spe -mfloat-gprs=double -mcpu=8548 . elif ${MACHINE_ARCH} == "powerpc64" _CPUCFLAGS = -mcpu=${CPUTYPE} . elif ${MACHINE_CPUARCH} == "mips" @@ -367,7 +367,7 @@ LDFLAGS+= -Wl,--secure-plt .endif .if ${MACHINE_ARCH} == "powerpcspe" -CFLAGS += -mcpu=8548 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double +CFLAGS += -mcpu=8548 -Wa,-me500 -mspe -mabi=spe -mfloat-gprs=double .endif .if ${MACHINE_CPUARCH} == "riscv" From owner-svn-src-head@freebsd.org Sun Nov 10 22:08:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 743CF1AC707; Sun, 10 Nov 2019 22:08:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47B7Rr2D4hz4S35; Sun, 10 Nov 2019 22:08:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F53A5A67; Sun, 10 Nov 2019 22:08:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAAM879L010774; Sun, 10 Nov 2019 22:08:07 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAAM87m3010773; Sun, 10 Nov 2019 22:08:07 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911102208.xAAM87m3010773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 10 Nov 2019 22:08:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354601 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 22:08:08 -0000 Author: jhibbits Date: Sun Nov 10 22:08:07 2019 New Revision: 354601 URL: https://svnweb.freebsd.org/changeset/base/354601 Log: Consolidate powerpcspe CFLAGS Don't depend on CPUTYPE to define powerpcspe CFLAGS, they should be set unconditionally. This reduces duplication. Also, set some CFLAGS as gcc-only, because clang's SPE support always uses the SPE ABI, it's not an optional feature. Modified: head/share/mk/bsd.cpu.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Sun Nov 10 20:36:38 2019 (r354600) +++ head/share/mk/bsd.cpu.mk Sun Nov 10 22:08:07 2019 (r354601) @@ -136,8 +136,6 @@ _CPUCFLAGS = -Wa,-me500 -msoft-float . else _CPUCFLAGS = -mcpu=${CPUTYPE} -mno-powerpc64 . endif -. elif ${MACHINE_ARCH} == "powerpcspe" -_CPUCFLAGS = -Wa,-me500 -mspe -mabi=spe -mfloat-gprs=double -mcpu=8548 . elif ${MACHINE_ARCH} == "powerpc64" _CPUCFLAGS = -mcpu=${CPUTYPE} . elif ${MACHINE_CPUARCH} == "mips" @@ -367,7 +365,8 @@ LDFLAGS+= -Wl,--secure-plt .endif .if ${MACHINE_ARCH} == "powerpcspe" -CFLAGS += -mcpu=8548 -Wa,-me500 -mspe -mabi=spe -mfloat-gprs=double +CFLAGS += -mcpu=8548 -mspe +CFLAGS.gcc+= -mabi=spe -mfloat-gprs=double -Wa,-me500 .endif .if ${MACHINE_CPUARCH} == "riscv" From owner-svn-src-head@freebsd.org Mon Nov 11 00:21:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3D111B86F4; Mon, 11 Nov 2019 00:21:05 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BBPF4FDwz4YHZ; Mon, 11 Nov 2019 00:21:05 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75F1571AA; Mon, 11 Nov 2019 00:21:05 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAB0L5K5088601; Mon, 11 Nov 2019 00:21:05 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAB0L5Wl088589; Mon, 11 Nov 2019 00:21:05 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201911110021.xAB0L5Wl088589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Mon, 11 Nov 2019 00:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354602 - head/sys/compat/linprocfs X-SVN-Group: head X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: head/sys/compat/linprocfs X-SVN-Commit-Revision: 354602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 00:21:05 -0000 Author: cognet Date: Mon Nov 11 00:21:05 2019 New Revision: 354602 URL: https://svnweb.freebsd.org/changeset/base/354602 Log: linprocfs: Make sure to report -1 as tty when we have no controlling tty. When reporting a process' stats, we can't just provide the tty as an unsigned long, as if we have no controlling tty, the tty would be NODEV, or -1. Instaed, just special-case NODEV. Submitted by: Juraj Lutter MFC after: 1 week Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sun Nov 10 22:08:07 2019 (r354601) +++ head/sys/compat/linprocfs/linprocfs.c Mon Nov 11 00:21:05 2019 (r354602) @@ -809,7 +809,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS) PS_ADD("pgrp", "%d", p->p_pgid); PS_ADD("session", "%d", p->p_session->s_sid); PROC_UNLOCK(p); - PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); + if (kp.ki_tdev == NODEV) + PS_ADD("tty", "%s", "-1"); + else + PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); PS_ADD("tpgid", "%d", kp.ki_tpgid); PS_ADD("flags", "%u", 0); /* XXX */ PS_ADD("minflt", "%lu", kp.ki_rusage.ru_minflt); From owner-svn-src-head@freebsd.org Mon Nov 11 01:35:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 566FD1BEB3D; Mon, 11 Nov 2019 01:35:51 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BD3W1Rn6z4bpt; Mon, 11 Nov 2019 01:35:51 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10B497F7D; Mon, 11 Nov 2019 01:35:51 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAB1ZoVw033324; Mon, 11 Nov 2019 01:35:50 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAB1ZoXR033323; Mon, 11 Nov 2019 01:35:50 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911110135.xAB1ZoXR033323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 11 Nov 2019 01:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354603 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 354603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 01:35:51 -0000 Author: mhorne Date: Mon Nov 11 01:35:50 2019 New Revision: 354603 URL: https://svnweb.freebsd.org/changeset/base/354603 Log: plic: fix PLIC_MAX_IRQS The maximum number of PLIC interrupts is defined in the PLIC spec[1] as 1024. [1] https://github.com/riscv/riscv-plic-spec/blob/master/riscv-plic.adoc MFC after: 1 week Modified: head/sys/riscv/riscv/plic.c Modified: head/sys/riscv/riscv/plic.c ============================================================================== --- head/sys/riscv/riscv/plic.c Mon Nov 11 00:21:05 2019 (r354602) +++ head/sys/riscv/riscv/plic.c Mon Nov 11 01:35:50 2019 (r354603) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include "pic_if.h" -#define PLIC_MAX_IRQS 2048 +#define PLIC_MAX_IRQS 1024 #define PLIC_PRIORITY(n) (0x000000 + (n) * 0x4) #define PLIC_ENABLE(n, h) (0x002000 + (h) * 0x80 + 4 * ((n) / 32)) #define PLIC_THRESHOLD(h) (0x200000 + (h) * 0x1000 + 0x0) From owner-svn-src-head@freebsd.org Mon Nov 11 01:39:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F88F1BEF38; Mon, 11 Nov 2019 01:39:07 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BD7H3CF2z4bxt; Mon, 11 Nov 2019 01:39:07 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CD827F7E; Mon, 11 Nov 2019 01:39:07 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAB1d76t033496; Mon, 11 Nov 2019 01:39:07 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAB1d7QW033495; Mon, 11 Nov 2019 01:39:07 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911110139.xAB1d7QW033495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 11 Nov 2019 01:39:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354604 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 354604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 01:39:07 -0000 Author: mhorne Date: Mon Nov 11 01:39:06 2019 New Revision: 354604 URL: https://svnweb.freebsd.org/changeset/base/354604 Log: plic: check for sifive compatible string The Linux dts for the HiFive Unleashed does not contain the usual "riscv,plic0" compat string, but our PLIC driver is compatible. MFC after: 1 week Modified: head/sys/riscv/riscv/plic.c Modified: head/sys/riscv/riscv/plic.c ============================================================================== --- head/sys/riscv/riscv/plic.c Mon Nov 11 01:35:50 2019 (r354603) +++ head/sys/riscv/riscv/plic.c Mon Nov 11 01:39:06 2019 (r354604) @@ -174,7 +174,8 @@ plic_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "riscv,plic0")) + if (!ofw_bus_is_compatible(dev, "riscv,plic0") && + !ofw_bus_is_compatible(dev, "sifive,plic-1.0.0")) return (ENXIO); device_set_desc(dev, "RISC-V PLIC"); From owner-svn-src-head@freebsd.org Mon Nov 11 03:27:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30F921A9BE5; Mon, 11 Nov 2019 03:27:16 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BGX40y6pz3CMJ; Mon, 11 Nov 2019 03:27:16 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F39AE93A3; Mon, 11 Nov 2019 03:27:15 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAB3RFB6098401; Mon, 11 Nov 2019 03:27:15 GMT (envelope-from jasone@FreeBSD.org) Received: (from jasone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAB3REbS098393; Mon, 11 Nov 2019 03:27:14 GMT (envelope-from jasone@FreeBSD.org) Message-Id: <201911110327.xAB3REbS098393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jasone set sender to jasone@FreeBSD.org using -f From: Jason Evans Date: Mon, 11 Nov 2019 03:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354605 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc X-SVN-Group: head X-SVN-Commit-Author: jasone X-SVN-Commit-Paths: in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc X-SVN-Commit-Revision: 354605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 03:27:16 -0000 Author: jasone Date: Mon Nov 11 03:27:14 2019 New Revision: 354605 URL: https://svnweb.freebsd.org/changeset/base/354605 Log: Update jemalloc to version 5.2.1. Added: head/contrib/jemalloc/include/jemalloc/internal/bin_types.h (contents, props changed) head/contrib/jemalloc/include/jemalloc/internal/hook.h (contents, props changed) head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h (contents, props changed) head/contrib/jemalloc/include/jemalloc/internal/quantum.h (contents, props changed) head/contrib/jemalloc/include/jemalloc/internal/safety_check.h (contents, props changed) head/contrib/jemalloc/include/jemalloc/internal/sc.h (contents, props changed) head/contrib/jemalloc/include/jemalloc/internal/seq.h (contents, props changed) head/contrib/jemalloc/include/jemalloc/internal/test_hooks.h (contents, props changed) head/contrib/jemalloc/src/hook.c (contents, props changed) head/contrib/jemalloc/src/safety_check.c (contents, props changed) head/contrib/jemalloc/src/sc.c (contents, props changed) head/contrib/jemalloc/src/test_hooks.c (contents, props changed) Deleted: head/contrib/jemalloc/include/jemalloc/internal/hooks.h head/contrib/jemalloc/include/jemalloc/internal/size_classes.h head/contrib/jemalloc/src/hooks.c Modified: head/contrib/jemalloc/COPYING head/contrib/jemalloc/ChangeLog head/contrib/jemalloc/FREEBSD-Xlist head/contrib/jemalloc/FREEBSD-diffs head/contrib/jemalloc/VERSION head/contrib/jemalloc/doc/jemalloc.3 head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h head/contrib/jemalloc/include/jemalloc/internal/arena_stats.h head/contrib/jemalloc/include/jemalloc/internal/arena_structs_b.h head/contrib/jemalloc/include/jemalloc/internal/arena_types.h head/contrib/jemalloc/include/jemalloc/internal/atomic.h head/contrib/jemalloc/include/jemalloc/internal/atomic_gcc_atomic.h head/contrib/jemalloc/include/jemalloc/internal/atomic_gcc_sync.h head/contrib/jemalloc/include/jemalloc/internal/background_thread_externs.h head/contrib/jemalloc/include/jemalloc/internal/background_thread_inlines.h head/contrib/jemalloc/include/jemalloc/internal/background_thread_structs.h head/contrib/jemalloc/include/jemalloc/internal/base_structs.h head/contrib/jemalloc/include/jemalloc/internal/bin.h head/contrib/jemalloc/include/jemalloc/internal/bin_stats.h head/contrib/jemalloc/include/jemalloc/internal/bit_util.h head/contrib/jemalloc/include/jemalloc/internal/bitmap.h head/contrib/jemalloc/include/jemalloc/internal/cache_bin.h head/contrib/jemalloc/include/jemalloc/internal/ctl.h head/contrib/jemalloc/include/jemalloc/internal/emitter.h head/contrib/jemalloc/include/jemalloc/internal/extent_externs.h head/contrib/jemalloc/include/jemalloc/internal/extent_inlines.h head/contrib/jemalloc/include/jemalloc/internal/extent_structs.h head/contrib/jemalloc/include/jemalloc/internal/extent_types.h head/contrib/jemalloc/include/jemalloc/internal/hash.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_decls.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_externs.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_b.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_macros.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_preamble.h head/contrib/jemalloc/include/jemalloc/internal/large_externs.h head/contrib/jemalloc/include/jemalloc/internal/malloc_io.h head/contrib/jemalloc/include/jemalloc/internal/mutex.h head/contrib/jemalloc/include/jemalloc/internal/mutex_prof.h head/contrib/jemalloc/include/jemalloc/internal/private_namespace.h head/contrib/jemalloc/include/jemalloc/internal/prof_externs.h head/contrib/jemalloc/include/jemalloc/internal/prof_inlines_a.h head/contrib/jemalloc/include/jemalloc/internal/prof_inlines_b.h head/contrib/jemalloc/include/jemalloc/internal/prof_structs.h head/contrib/jemalloc/include/jemalloc/internal/public_namespace.h head/contrib/jemalloc/include/jemalloc/internal/rtree.h head/contrib/jemalloc/include/jemalloc/internal/rtree_tsd.h head/contrib/jemalloc/include/jemalloc/internal/stats.h head/contrib/jemalloc/include/jemalloc/internal/sz.h head/contrib/jemalloc/include/jemalloc/internal/tcache_externs.h head/contrib/jemalloc/include/jemalloc/internal/tcache_inlines.h head/contrib/jemalloc/include/jemalloc/internal/tcache_structs.h head/contrib/jemalloc/include/jemalloc/internal/tcache_types.h head/contrib/jemalloc/include/jemalloc/internal/ticker.h head/contrib/jemalloc/include/jemalloc/internal/tsd.h head/contrib/jemalloc/include/jemalloc/internal/tsd_generic.h head/contrib/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h head/contrib/jemalloc/include/jemalloc/internal/tsd_tls.h head/contrib/jemalloc/include/jemalloc/internal/witness.h head/contrib/jemalloc/include/jemalloc/jemalloc.h head/contrib/jemalloc/src/arena.c head/contrib/jemalloc/src/background_thread.c head/contrib/jemalloc/src/base.c head/contrib/jemalloc/src/bin.c head/contrib/jemalloc/src/ckh.c head/contrib/jemalloc/src/ctl.c head/contrib/jemalloc/src/extent.c head/contrib/jemalloc/src/extent_dss.c head/contrib/jemalloc/src/extent_mmap.c head/contrib/jemalloc/src/jemalloc.c head/contrib/jemalloc/src/large.c head/contrib/jemalloc/src/malloc_io.c head/contrib/jemalloc/src/mutex.c head/contrib/jemalloc/src/pages.c head/contrib/jemalloc/src/prof.c head/contrib/jemalloc/src/rtree.c head/contrib/jemalloc/src/stats.c head/contrib/jemalloc/src/sz.c head/contrib/jemalloc/src/tcache.c head/contrib/jemalloc/src/tsd.c head/lib/libc/stdlib/jemalloc/Makefile.inc Modified: head/contrib/jemalloc/COPYING ============================================================================== --- head/contrib/jemalloc/COPYING Mon Nov 11 01:39:06 2019 (r354604) +++ head/contrib/jemalloc/COPYING Mon Nov 11 03:27:14 2019 (r354605) @@ -1,10 +1,10 @@ Unless otherwise specified, files in the jemalloc source distribution are subject to the following license: -------------------------------------------------------------------------------- -Copyright (C) 2002-2018 Jason Evans . +Copyright (C) 2002-present Jason Evans . All rights reserved. Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved. -Copyright (C) 2009-2018 Facebook, Inc. All rights reserved. +Copyright (C) 2009-present Facebook, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Modified: head/contrib/jemalloc/ChangeLog ============================================================================== --- head/contrib/jemalloc/ChangeLog Mon Nov 11 01:39:06 2019 (r354604) +++ head/contrib/jemalloc/ChangeLog Mon Nov 11 03:27:14 2019 (r354605) @@ -4,7 +4,143 @@ brevity. Much more detail can be found in the git rev https://github.com/jemalloc/jemalloc -* 5.1.0 (May 4th, 2018) +* 5.2.1 (August 5, 2019) + + This release is primarily about Windows. A critical virtual memory leak is + resolved on all Windows platforms. The regression was present in all releases + since 5.0.0. + + Bug fixes: + - Fix a severe virtual memory leak on Windows. This regression was first + released in 5.0.0. (@Ignition, @j0t, @frederik-h, @davidtgoldblatt, + @interwq) + - Fix size 0 handling in posix_memalign(). This regression was first released + in 5.2.0. (@interwq) + - Fix the prof_log unit test which may observe unexpected backtraces from + compiler optimizations. The test was first added in 5.2.0. (@marxin, + @gnzlbg, @interwq) + - Fix the declaration of the extent_avail tree. This regression was first + released in 5.1.0. (@zoulasc) + - Fix an incorrect reference in jeprof. This functionality was first released + in 3.0.0. (@prehistoric-penguin) + - Fix an assertion on the deallocation fast-path. This regression was first + released in 5.2.0. (@yinan1048576) + - Fix the TLS_MODEL attribute in headers. This regression was first released + in 5.0.0. (@zoulasc, @interwq) + + Optimizations and refactors: + - Implement opt.retain on Windows and enable by default on 64-bit. (@interwq, + @davidtgoldblatt) + - Optimize away a branch on the operator delete[] path. (@mgrice) + - Add format annotation to the format generator function. (@zoulasc) + - Refactor and improve the size class header generation. (@yinan1048576) + - Remove best fit. (@djwatson) + - Avoid blocking on background thread locks for stats. (@oranagra, @interwq) + +* 5.2.0 (April 2, 2019) + + This release includes a few notable improvements, which are summarized below: + 1) improved fast-path performance from the optimizations by @djwatson; 2) + reduced virtual memory fragmentation and metadata usage; and 3) bug fixes on + setting the number of background threads. In addition, peak / spike memory + usage is improved with certain allocation patterns. As usual, the release and + prior dev versions have gone through large-scale production testing. + + New features: + - Implement oversize_threshold, which uses a dedicated arena for allocations + crossing the specified threshold to reduce fragmentation. (@interwq) + - Add extents usage information to stats. (@tyleretzel) + - Log time information for sampled allocations. (@tyleretzel) + - Support 0 size in sdallocx. (@djwatson) + - Output rate for certain counters in malloc_stats. (@zinoale) + - Add configure option --enable-readlinkat, which allows the use of readlinkat + over readlink. (@davidtgoldblatt) + - Add configure options --{enable,disable}-{static,shared} to allow not + building unwanted libraries. (@Ericson2314) + - Add configure option --disable-libdl to enable fully static builds. + (@interwq) + - Add mallctl interfaces: + + opt.oversize_threshold (@interwq) + + stats.arenas..extent_avail (@tyleretzel) + + stats.arenas..extents..n{dirty,muzzy,retained} (@tyleretzel) + + stats.arenas..extents..{dirty,muzzy,retained}_bytes + (@tyleretzel) + + Portability improvements: + - Update MSVC builds. (@maksqwe, @rustyx) + - Workaround a compiler optimizer bug on s390x. (@rkmisra) + - Make use of pthread_set_name_np(3) on FreeBSD. (@trasz) + - Implement malloc_getcpu() to enable percpu_arena for windows. (@santagada) + - Link against -pthread instead of -lpthread. (@paravoid) + - Make background_thread not dependent on libdl. (@interwq) + - Add stringify to fix a linker directive issue on MSVC. (@daverigby) + - Detect and fall back when 8-bit atomics are unavailable. (@interwq) + - Fall back to the default pthread_create if dlsym(3) fails. (@interwq) + + Optimizations and refactors: + - Refactor the TSD module. (@davidtgoldblatt) + - Avoid taking extents_muzzy mutex when muzzy is disabled. (@interwq) + - Avoid taking large_mtx for auto arenas on the tcache flush path. (@interwq) + - Optimize ixalloc by avoiding a size lookup. (@interwq) + - Implement opt.oversize_threshold which uses a dedicated arena for requests + crossing the threshold, also eagerly purges the oversize extents. Default + the threshold to 8 MiB. (@interwq) + - Clean compilation with -Wextra. (@gnzlbg, @jasone) + - Refactor the size class module. (@davidtgoldblatt) + - Refactor the stats emitter. (@tyleretzel) + - Optimize pow2_ceil. (@rkmisra) + - Avoid runtime detection of lazy purging on FreeBSD. (@trasz) + - Optimize mmap(2) alignment handling on FreeBSD. (@trasz) + - Improve error handling for THP state initialization. (@jsteemann) + - Rework the malloc() fast path. (@djwatson) + - Rework the free() fast path. (@djwatson) + - Refactor and optimize the tcache fill / flush paths. (@djwatson) + - Optimize sync / lwsync on PowerPC. (@chmeeedalf) + - Bypass extent_dalloc() when retain is enabled. (@interwq) + - Optimize the locking on large deallocation. (@interwq) + - Reduce the number of pages committed from sanity checking in debug build. + (@trasz, @interwq) + - Deprecate OSSpinLock. (@interwq) + - Lower the default number of background threads to 4 (when the feature + is enabled). (@interwq) + - Optimize the trylock spin wait. (@djwatson) + - Use arena index for arena-matching checks. (@interwq) + - Avoid forced decay on thread termination when using background threads. + (@interwq) + - Disable muzzy decay by default. (@djwatson, @interwq) + - Only initialize libgcc unwinder when profiling is enabled. (@paravoid, + @interwq) + + Bug fixes (all only relevant to jemalloc 5.x): + - Fix background thread index issues with max_background_threads. (@djwatson, + @interwq) + - Fix stats output for opt.lg_extent_max_active_fit. (@interwq) + - Fix opt.prof_prefix initialization. (@davidtgoldblatt) + - Properly trigger decay on tcache destroy. (@interwq, @amosbird) + - Fix tcache.flush. (@interwq) + - Detect whether explicit extent zero out is necessary with huge pages or + custom extent hooks, which may change the purge semantics. (@interwq) + - Fix a side effect caused by extent_max_active_fit combined with decay-based + purging, where freed extents can accumulate and not be reused for an + extended period of time. (@interwq, @mpghf) + - Fix a missing unlock on extent register error handling. (@zoulasc) + + Testing: + - Simplify the Travis script output. (@gnzlbg) + - Update the test scripts for FreeBSD. (@devnexen) + - Add unit tests for the producer-consumer pattern. (@interwq) + - Add Cirrus-CI config for FreeBSD builds. (@jasone) + - Add size-matching sanity checks on tcache flush. (@davidtgoldblatt, + @interwq) + + Incompatible changes: + - Remove --with-lg-page-sizes. (@davidtgoldblatt) + + Documentation: + - Attempt to build docs by default, however skip doc building when xsltproc + is missing. (@interwq, @cmuellner) + +* 5.1.0 (May 4, 2018) This release is primarily about fine-tuning, ranging from several new features to numerous notable performance and portability enhancements. The release and Modified: head/contrib/jemalloc/FREEBSD-Xlist ============================================================================== --- head/contrib/jemalloc/FREEBSD-Xlist Mon Nov 11 01:39:06 2019 (r354604) +++ head/contrib/jemalloc/FREEBSD-Xlist Mon Nov 11 03:27:14 2019 (r354605) @@ -1,6 +1,7 @@ $FreeBSD$ .appveyor.yml .autom4te.cfg +.cirrus.yml .git* .travis.yml FREEBSD-* Modified: head/contrib/jemalloc/FREEBSD-diffs ============================================================================== --- head/contrib/jemalloc/FREEBSD-diffs Mon Nov 11 01:39:06 2019 (r354604) +++ head/contrib/jemalloc/FREEBSD-diffs Mon Nov 11 03:27:14 2019 (r354605) @@ -1,5 +1,5 @@ diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in -index 1e12fd3a..c42a7e10 100644 +index 7fecda7c..d5ca5e86 100644 --- a/doc/jemalloc.xml.in +++ b/doc/jemalloc.xml.in @@ -53,11 +53,22 @@ @@ -26,7 +26,7 @@ index 1e12fd3a..c42a7e10 100644 Standard API -@@ -3376,4 +3387,18 @@ malloc_conf = "narenas:1";]]> +@@ -3510,4 +3521,18 @@ malloc_conf = "narenas:1";]]> The posix_memalign() function conforms to IEEE Std 1003.1-2001 (POSIX.1). @@ -45,26 +45,8 @@ index 1e12fd3a..c42a7e10 100644 + 11.0. + -diff --git a/include/jemalloc/internal/hooks.h b/include/jemalloc/internal/hooks.h -index cd49afcb..85e2a991 100644 ---- a/include/jemalloc/internal/hooks.h -+++ b/include/jemalloc/internal/hooks.h -@@ -6,13 +6,6 @@ extern JEMALLOC_EXPORT void (*hooks_libc_hook)(); - - #define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) - --#define open JEMALLOC_HOOK(open, hooks_libc_hook) --#define read JEMALLOC_HOOK(read, hooks_libc_hook) --#define write JEMALLOC_HOOK(write, hooks_libc_hook) --#define readlink JEMALLOC_HOOK(readlink, hooks_libc_hook) --#define close JEMALLOC_HOOK(close, hooks_libc_hook) --#define creat JEMALLOC_HOOK(creat, hooks_libc_hook) --#define secure_getenv JEMALLOC_HOOK(secure_getenv, hooks_libc_hook) - /* Note that this is undef'd and re-define'd in src/prof.c. */ - #define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, hooks_libc_hook) - diff --git a/include/jemalloc/internal/jemalloc_internal_decls.h b/include/jemalloc/internal/jemalloc_internal_decls.h -index be70df51..84cd70da 100644 +index 7d6053e2..a0e4f5af 100644 --- a/include/jemalloc/internal/jemalloc_internal_decls.h +++ b/include/jemalloc/internal/jemalloc_internal_decls.h @@ -1,6 +1,9 @@ @@ -77,8 +59,23 @@ index be70df51..84cd70da 100644 #include #ifdef _WIN32 # include +diff --git a/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h b/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h +new file mode 100644 +index 00000000..0dab1296 +--- /dev/null ++++ b/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h +@@ -0,0 +1,9 @@ ++#ifndef __clang__ ++# undef JEMALLOC_INTERNAL_UNREACHABLE ++# define JEMALLOC_INTERNAL_UNREACHABLE abort ++ ++# undef JEMALLOC_C11_ATOMICS ++# undef JEMALLOC_GCC_ATOMIC_ATOMICS ++# undef JEMALLOC_GCC_U8_ATOMIC_ATOMICS ++# undef JEMALLOC_GCC_U8_SYNC_ATOMICS ++#endif diff --git a/include/jemalloc/internal/jemalloc_preamble.h.in b/include/jemalloc/internal/jemalloc_preamble.h.in -index e621fbc8..dbdd5d6b 100644 +index 3418cbfa..53e30dc4 100644 --- a/include/jemalloc/internal/jemalloc_preamble.h.in +++ b/include/jemalloc/internal/jemalloc_preamble.h.in @@ -8,6 +8,9 @@ @@ -107,10 +104,10 @@ index e621fbc8..dbdd5d6b 100644 static const bool config_prof = #ifdef JEMALLOC_PROF diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h -index 6520c251..0013cbe9 100644 +index 7c24f072..94af1618 100644 --- a/include/jemalloc/internal/mutex.h +++ b/include/jemalloc/internal/mutex.h -@@ -121,9 +121,6 @@ struct malloc_mutex_s { +@@ -135,9 +135,6 @@ struct malloc_mutex_s { #ifdef JEMALLOC_LAZY_LOCK extern bool isthreaded; @@ -120,7 +117,7 @@ index 6520c251..0013cbe9 100644 #endif bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, -@@ -131,6 +128,7 @@ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, +@@ -145,6 +142,7 @@ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, void malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex); void malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex); void malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex); @@ -128,20 +125,38 @@ index 6520c251..0013cbe9 100644 bool malloc_mutex_boot(void); void malloc_mutex_prof_data_reset(tsdn_t *tsdn, malloc_mutex_t *mutex); +diff --git a/include/jemalloc/internal/test_hooks.h b/include/jemalloc/internal/test_hooks.h +index a6351e59..0780c52f 100644 +--- a/include/jemalloc/internal/test_hooks.h ++++ b/include/jemalloc/internal/test_hooks.h +@@ -6,13 +6,6 @@ extern JEMALLOC_EXPORT void (*test_hooks_libc_hook)(); + + #define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) + +-#define open JEMALLOC_HOOK(open, test_hooks_libc_hook) +-#define read JEMALLOC_HOOK(read, test_hooks_libc_hook) +-#define write JEMALLOC_HOOK(write, test_hooks_libc_hook) +-#define readlink JEMALLOC_HOOK(readlink, test_hooks_libc_hook) +-#define close JEMALLOC_HOOK(close, test_hooks_libc_hook) +-#define creat JEMALLOC_HOOK(creat, test_hooks_libc_hook) +-#define secure_getenv JEMALLOC_HOOK(secure_getenv, test_hooks_libc_hook) + /* Note that this is undef'd and re-define'd in src/prof.c. */ + #define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, test_hooks_libc_hook) + diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h -index 0b9841aa..f03eee61 100644 +index 9ba26004..ecfda5d6 100644 --- a/include/jemalloc/internal/tsd.h +++ b/include/jemalloc/internal/tsd.h -@@ -122,7 +122,8 @@ struct tsd_s { - t use_a_getter_or_setter_instead_##n; +@@ -198,7 +198,8 @@ struct tsd_s { + t TSD_MANGLE(n); MALLOC_TSD #undef O -}; +/* AddressSanitizer requires TLS data to be aligned to at least 8 bytes. */ +} JEMALLOC_ALIGNED(16); - /* - * Wrapper around tsd_t that makes it possible to avoid implicit conversion + JEMALLOC_ALWAYS_INLINE uint8_t + tsd_state_get(tsd_t *tsd) { diff --git a/include/jemalloc/jemalloc_FreeBSD.h b/include/jemalloc/jemalloc_FreeBSD.h new file mode 100644 index 00000000..b752b0e7 @@ -345,10 +360,10 @@ index f9438912..47d032c1 100755 +#include "jemalloc_FreeBSD.h" EOF diff --git a/src/jemalloc.c b/src/jemalloc.c -index f93c16fa..e0ad297b 100644 +index ed13718d..fefb719a 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c -@@ -21,6 +21,10 @@ +@@ -23,6 +23,10 @@ /******************************************************************************/ /* Data. */ @@ -359,10 +374,37 @@ index f93c16fa..e0ad297b 100644 /* Runtime configuration options. */ const char *je_malloc_conf #ifndef _WIN32 -@@ -3160,6 +3164,103 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) { +@@ -2660,25 +2664,6 @@ je_realloc(void *ptr, size_t arg_size) { + LOG("core.realloc.entry", "ptr: %p, size: %zu\n", ptr, size); + + if (unlikely(size == 0)) { +- if (ptr != NULL) { +- /* realloc(ptr, 0) is equivalent to free(ptr). */ +- UTRACE(ptr, 0, 0); +- tcache_t *tcache; +- tsd_t *tsd = tsd_fetch(); +- if (tsd_reentrancy_level_get(tsd) == 0) { +- tcache = tcache_get(tsd); +- } else { +- tcache = NULL; +- } +- +- uintptr_t args[3] = {(uintptr_t)ptr, size}; +- hook_invoke_dalloc(hook_dalloc_realloc, ptr, args); +- +- ifree(tsd, ptr, tcache, true); +- +- LOG("core.realloc.exit", "result: %p", NULL); +- return NULL; +- } + size = 1; + } + +@@ -3750,6 +3735,103 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) { + * End non-standard functions. */ /******************************************************************************/ - /* ++/* + * Begin compatibility functions. + */ + @@ -459,11 +501,10 @@ index f93c16fa..e0ad297b 100644 + * End compatibility functions. + */ +/******************************************************************************/ -+/* + /* * The following functions are used by threading libraries for protection of * malloc during fork(). - */ -@@ -3323,4 +3424,11 @@ jemalloc_postfork_child(void) { +@@ -3919,4 +4001,11 @@ jemalloc_postfork_child(void) { ctl_postfork_child(tsd_tsdn(tsd)); } @@ -476,7 +517,7 @@ index f93c16fa..e0ad297b 100644 + /******************************************************************************/ diff --git a/src/malloc_io.c b/src/malloc_io.c -index 7bdc13f9..c8802c70 100644 +index d7cb0f52..cda589c4 100644 --- a/src/malloc_io.c +++ b/src/malloc_io.c @@ -75,6 +75,20 @@ wrtmessage(void *cbopaque, const char *s) { @@ -501,7 +542,7 @@ index 7bdc13f9..c8802c70 100644 * Wrapper around malloc_message() that avoids the need for * je_malloc_message(...) throughout the code. diff --git a/src/mutex.c b/src/mutex.c -index 30222b3e..b2c36283 100644 +index 3f920f5b..88a7730c 100644 --- a/src/mutex.c +++ b/src/mutex.c @@ -41,6 +41,17 @@ pthread_create(pthread_t *__restrict thread, @@ -523,9 +564,10 @@ index 30222b3e..b2c36283 100644 void @@ -131,6 +142,16 @@ mutex_addr_comp(const witness_t *witness1, void *mutex1, + } } - bool ++bool +malloc_mutex_first_thread(void) { + +#ifndef JEMALLOC_MUTEX_INIT_CB @@ -535,7 +577,6 @@ index 30222b3e..b2c36283 100644 +#endif +} + -+bool + bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, witness_rank_t rank, malloc_mutex_lock_order_t lock_order) { - mutex_prof_data_init(&mutex->prof_data); Modified: head/contrib/jemalloc/VERSION ============================================================================== --- head/contrib/jemalloc/VERSION Mon Nov 11 01:39:06 2019 (r354604) +++ head/contrib/jemalloc/VERSION Mon Nov 11 03:27:14 2019 (r354605) @@ -1 +1 @@ -5.1.0-0-g61efbda7098de6fe64c362d309824864308c36d4 +5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756 Modified: head/contrib/jemalloc/doc/jemalloc.3 ============================================================================== --- head/contrib/jemalloc/doc/jemalloc.3 Mon Nov 11 01:39:06 2019 (r354604) +++ head/contrib/jemalloc/doc/jemalloc.3 Mon Nov 11 03:27:14 2019 (r354605) @@ -1,13 +1,13 @@ '\" t .\" Title: JEMALLOC .\" Author: Jason Evans -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 05/08/2018 +.\" Generator: DocBook XSL Stylesheets v1.79.1 +.\" Date: 11/10/2019 .\" Manual: User Manual -.\" Source: jemalloc 5.1.0-0-g61efbda7098de6fe64c362d309824864308c36d4 +.\" Source: jemalloc 5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756 .\" Language: English .\" -.TH "JEMALLOC" "3" "05/08/2018" "jemalloc 5.1.0-0-g61efbda7098d" "User Manual" +.TH "JEMALLOC" "3" "11/10/2019" "jemalloc 5.2.1-0-gea6b3e973b47" "User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -31,7 +31,7 @@ jemalloc \- general purpose memory allocation functions .SH "LIBRARY" .PP -This manual describes jemalloc 5\&.1\&.0\-0\-g61efbda7098de6fe64c362d309824864308c36d4\&. More information can be found at the +This manual describes jemalloc 5\&.2\&.1\-0\-gea6b3e973b477b8061e0076bb257dbd7f3faa756\&. More information can be found at the \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP The following configuration options are enabled in libc\*(Aqs built\-in jemalloc: @@ -396,7 +396,7 @@ string, in which case the statistics are presented in as a character within the \fIopts\fR string\&. Note that -malloc_message() +malloc_stats_print() uses the mallctl*() functions internally, so inconsistent statistics can be reported if multiple threads use these functions simultaneously\&. If @@ -411,7 +411,9 @@ and \(lql\(rq can be specified to omit per size class statistics for bins and large objects, respectively; \(lqx\(rq -can be specified to omit all mutex statistics\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&. +can be specified to omit all mutex statistics; +\(lqe\(rq +can be used to omit extent statistics\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&. .PP The malloc_usable_size() @@ -826,6 +828,17 @@ in these cases\&. This option is disabled by default u is specified during configuration, in which case it is enabled by default\&. .RE .PP +opt\&.confirm_conf (\fBbool\fR) r\- +.RS 4 +Confirm\-runtime\-options\-when\-program\-starts enabled/disabled\&. If true, the string specified via +\fB\-\-with\-malloc\-conf\fR, the string pointed to by the global variable +\fImalloc_conf\fR, the +\(lqname\(rq +of the file referenced by the symbolic link named +/etc/malloc\&.conf, and the value of the environment variable +\fBMALLOC_CONF\fR, will be printed in order\&. Then, each option being set will be individually printed\&. This option is disabled by default\&. +.RE +.PP opt\&.abort_conf (\fBbool\fR) r\- .RS 4 Abort\-on\-invalid\-configuration enabled/disabled\&. If true, invalid runtime options are fatal\&. The process will call @@ -852,9 +865,10 @@ If true, retain unused virtual memory for later reuse \fBmunmap\fR(2) or equivalent (see stats\&.retained -for related details)\&. This option is disabled by default unless discarding virtual memory is known to trigger platform\-specific performance problems, e\&.g\&. for [64\-bit] Linux, which has a quirk in its virtual memory allocation algorithm that causes semi\-permanent VM map holes under normal jemalloc operation\&. Although -\fBmunmap\fR(2) -causes issues on 32\-bit Linux as well, retaining virtual memory for 32\-bit Linux is disabled by default due to the practical possibility of address space exhaustion\&. +for related details)\&. It also makes jemalloc use +\fBmmap\fR(2) +or equivalent in a more greedy way, mapping larger chunks in one go\&. This option is disabled by default unless discarding virtual memory is known to trigger platform\-specific performance problems, namely 1) for [64\-bit] Linux, which has a quirk in its virtual memory allocation algorithm that causes semi\-permanent VM map holes under normal jemalloc operation; and 2) for [64\-bit] Windows, which disallows split / merged regions with +\fI\fBMEM_RELEASE\fR\fR\&. Although the same issues may present on 32\-bit platforms as well, retaining virtual memory for 32\-bit Linux and Windows is disabled by default due to the practical possibility of address space exhaustion\&. .RE .PP opt\&.dss (\fBconst char *\fR) r\- @@ -882,6 +896,13 @@ opt\&.narenas (\fBunsigned\fR) r\- Maximum number of arenas to use for automatic multiplexing of threads and arenas\&. The default is four times the number of CPUs, or one if there is a single CPU\&. .RE .PP +opt\&.oversize_threshold (\fBsize_t\fR) r\- +.RS 4 +The threshold in bytes of which requests are considered oversize\&. Allocation requests with greater sizes are fulfilled from a dedicated arena (automatically managed, however not within +narenas), in order to reduce fragmentation by not mixing huge allocations with small ones\&. In addition, the decay API guarantees on the extents greater than the specified threshold may be overridden\&. Note that requests with arena index specified via +\fBMALLOCX_ARENA\fR, or threads associated with explicit arenas will not be considered\&. The default threshold is 8MiB\&. Values not within large size classes disables this feature\&. +.RE +.PP opt\&.percpu_arena (\fBconst char *\fR) r\- .RS 4 Per CPU arena mode\&. Use the @@ -893,14 +914,14 @@ setting uses one arena per physical CPU, which means t \(lqdisabled\(rq\&. .RE .PP -opt\&.background_thread (\fBconst bool\fR) r\- +opt\&.background_thread (\fBbool\fR) r\- .RS 4 Internal background worker threads enabled/disabled\&. Because of potential circular dependencies, enabling background thread using this option may cause crash or deadlock during initialization\&. For a reliable way to use this feature, see background_thread for dynamic control options and details\&. This option is disabled by default\&. .RE .PP -opt\&.max_background_threads (\fBconst size_t\fR) r\- +opt\&.max_background_threads (\fBsize_t\fR) r\- .RS 4 Maximum number of background threads that will be created if background_thread @@ -917,7 +938,9 @@ and arena\&.\&.dirty_decay_ms for related dynamic control options\&. See opt\&.muzzy_decay_ms -for a description of muzzy pages\&. +for a description of muzzy pages\&.for a description of muzzy pages\&. Note that when the +oversize_threshold +feature is enabled, the arenas reserved for oversize requests may have its own default decay settings\&. .RE .PP opt\&.muzzy_decay_ms (\fBssize_t\fR) r\- @@ -1293,7 +1316,7 @@ arena\&.\&.extent_hooks (\fBextent_hooks_t *\fR) rw .RS 4 Get or set the extent management hook functions for arena \&. The functions must be capable of operating on all extant extents associated with arena , usually by passing unknown extents to the replaced functions\&. In practice, it is feasible to control allocation for arenas explicitly created via arenas\&.create -such that all extents originate from an application\-supplied extent allocator (by specifying the custom extent hook functions during arena creation), but the automatically created arenas will have already created extents prior to the application having an opportunity to take over extent allocation\&. +such that all extents originate from an application\-supplied extent allocator (by specifying the custom extent hook functions during arena creation)\&. However, the API guarantees for the automatically created arenas may be relaxed \-\- hooks set there may be called in a "best effort" fashion; in addition there may be extents created prior to the application having an opportunity to take over extent allocation\&. .sp .if n \{\ .RS 4 @@ -1876,6 +1899,11 @@ stats\&.retained for details\&. .RE .PP +stats\&.arenas\&.\&.extent_avail (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] +.RS 4 +Number of allocated (but unused) extent structs in this arena\&. +.RE +.PP stats\&.arenas\&.\&.base (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] .RS 4 Number of bytes dedicated to bootstrap\-sensitive allocator metadata structures\&. @@ -1956,6 +1984,16 @@ stats\&.arenas\&.\&.small\&.nrequests (\fBuint64_t\ Cumulative number of allocation requests satisfied by all bin size classes\&. .RE .PP +stats\&.arenas\&.\&.small\&.nfills (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] +.RS 4 +Cumulative number of tcache fills by all small size classes\&. +.RE +.PP +stats\&.arenas\&.\&.small\&.nflushes (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] +.RS 4 +Cumulative number of tcache flushes by all small size classes\&. +.RE +.PP stats\&.arenas\&.\&.large\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] .RS 4 Number of bytes currently allocated by large objects\&. @@ -1980,6 +2018,16 @@ stats\&.arenas\&.\&.large\&.nrequests (\fBuint64_t\ Cumulative number of allocation requests satisfied by all large size classes\&. .RE .PP +stats\&.arenas\&.\&.large\&.nfills (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] +.RS 4 +Cumulative number of tcache fills by all large size classes\&. +.RE +.PP +stats\&.arenas\&.\&.large\&.nflushes (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] +.RS 4 +Cumulative number of tcache flushes by all large size classes\&. +.RE +.PP stats\&.arenas\&.\&.bins\&.\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] .RS 4 Cumulative number of times a bin region of the corresponding size class was allocated from the arena, whether to fill the relevant tcache if @@ -2029,6 +2077,11 @@ stats\&.arenas\&.\&.bins\&.\&.curslabs (\fBsize_ Current number of slabs\&. .RE .PP +stats\&.arenas\&.\&.bins\&.\&.nonfull_slabs (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] +.RS 4 +Current number of nonfull slabs\&. +.RE +.PP stats\&.arenas\&.\&.bins\&.\&.mutex\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR] .RS 4 Statistics on @@ -2037,6 +2090,16 @@ mutex (arena bin scope; bin operation related)\&. {counter} is one of the counters in mutex profiling counters\&. +.RE +.PP +stats\&.arenas\&.\&.extents\&.\&.n{extent_type} (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] +.RS 4 +Number of extents of the given type in this arena in the bucket corresponding to page size index \&. The extent type is one of dirty, muzzy, or retained\&. +.RE +.PP +stats\&.arenas\&.\&.extents\&.\&.{extent_type}_bytes (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] +.RS 4 +Sum of the bytes managed by extents of the given type in this arena in the bucket corresponding to page size index \&. The extent type is one of dirty, muzzy, or retained\&. .RE .PP stats\&.arenas\&.\&.lextents\&.\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] Modified: head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h Mon Nov 11 01:39:06 2019 (r354604) +++ head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h Mon Nov 11 03:27:14 2019 (r354605) @@ -3,8 +3,8 @@ #include "jemalloc/internal/bin.h" #include "jemalloc/internal/extent_dss.h" +#include "jemalloc/internal/hook.h" #include "jemalloc/internal/pages.h" -#include "jemalloc/internal/size_classes.h" #include "jemalloc/internal/stats.h" extern ssize_t opt_dirty_decay_ms; @@ -16,13 +16,17 @@ extern const char *percpu_arena_mode_names[]; extern const uint64_t h_steps[SMOOTHSTEP_NSTEPS]; extern malloc_mutex_t arenas_lock; +extern size_t opt_oversize_threshold; +extern size_t oversize_threshold; + void arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads, const char **dss, ssize_t *dirty_decay_ms, ssize_t *muzzy_decay_ms, size_t *nactive, size_t *ndirty, size_t *nmuzzy); void arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads, const char **dss, ssize_t *dirty_decay_ms, ssize_t *muzzy_decay_ms, size_t *nactive, size_t *ndirty, size_t *nmuzzy, arena_stats_t *astats, - bin_stats_t *bstats, arena_stats_large_t *lstats); + bin_stats_t *bstats, arena_stats_large_t *lstats, + arena_stats_extents_t *estats); void arena_extents_dirty_dalloc(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks, extent_t *extent); #ifdef JEMALLOC_JET @@ -56,16 +60,17 @@ void *arena_malloc_hard(tsdn_t *tsdn, arena_t *arena, szind_t ind, bool zero); void *arena_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment, bool zero, tcache_t *tcache); -void arena_prof_promote(tsdn_t *tsdn, const void *ptr, size_t usize); +void arena_prof_promote(tsdn_t *tsdn, void *ptr, size_t usize); void arena_dalloc_promoted(tsdn_t *tsdn, void *ptr, tcache_t *tcache, bool slow_path); -void arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena, - extent_t *extent, void *ptr); +void arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena, bin_t *bin, + szind_t binind, extent_t *extent, void *ptr); void arena_dalloc_small(tsdn_t *tsdn, void *ptr); bool arena_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size, - size_t extra, bool zero); + size_t extra, bool zero, size_t *newsize); void *arena_ralloc(tsdn_t *tsdn, arena_t *arena, void *ptr, size_t oldsize, - size_t size, size_t alignment, bool zero, tcache_t *tcache); + size_t size, size_t alignment, bool zero, tcache_t *tcache, + hook_ralloc_args_t *hook_args); dss_prec_t arena_dss_prec_get(arena_t *arena); bool arena_dss_prec_set(arena_t *arena, dss_prec_t dss_prec); ssize_t arena_dirty_decay_ms_default_get(void); @@ -79,7 +84,12 @@ void arena_nthreads_inc(arena_t *arena, bool internal) void arena_nthreads_dec(arena_t *arena, bool internal); size_t arena_extent_sn_next(arena_t *arena); arena_t *arena_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks); -void arena_boot(void); +bool arena_init_huge(void); +bool arena_is_huge(unsigned arena_ind); +arena_t *arena_choose_huge(tsd_t *tsd); +bin_t *arena_bin_choose_lock(tsdn_t *tsdn, arena_t *arena, szind_t binind, + unsigned *binshard); +void arena_boot(sc_data_t *sc_data); void arena_prefork0(tsdn_t *tsdn, arena_t *arena); void arena_prefork1(tsdn_t *tsdn, arena_t *arena); void arena_prefork2(tsdn_t *tsdn, arena_t *arena); Modified: head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h Mon Nov 11 01:39:06 2019 (r354604) +++ head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h Mon Nov 11 03:27:14 2019 (r354605) @@ -4,10 +4,36 @@ #include "jemalloc/internal/jemalloc_internal_types.h" #include "jemalloc/internal/mutex.h" #include "jemalloc/internal/rtree.h" -#include "jemalloc/internal/size_classes.h" +#include "jemalloc/internal/sc.h" #include "jemalloc/internal/sz.h" #include "jemalloc/internal/ticker.h" +JEMALLOC_ALWAYS_INLINE bool +arena_has_default_hooks(arena_t *arena) { + return (extent_hooks_get(arena) == &extent_hooks_default); +} + +JEMALLOC_ALWAYS_INLINE arena_t * +arena_choose_maybe_huge(tsd_t *tsd, arena_t *arena, size_t size) { + if (arena != NULL) { + return arena; + } + + /* + * For huge allocations, use the dedicated huge arena if both are true: + * 1) is using auto arena selection (i.e. arena == NULL), and 2) the + * thread is not assigned to a manual arena. + */ + if (unlikely(size >= oversize_threshold)) { + arena_t *tsd_arena = tsd_arena_get(tsd); + if (tsd_arena == NULL || arena_is_auto(tsd_arena)) { + return arena_choose_huge(tsd); + } + } + + return arena_choose(tsd, NULL); +} + JEMALLOC_ALWAYS_INLINE prof_tctx_t * arena_prof_tctx_get(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx) { cassert(config_prof); @@ -28,7 +54,7 @@ arena_prof_tctx_get(tsdn_t *tsdn, const void *ptr, all } JEMALLOC_ALWAYS_INLINE void -arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, UNUSED size_t usize, +arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize, alloc_ctx_t *alloc_ctx, prof_tctx_t *tctx) { cassert(config_prof); assert(ptr != NULL); @@ -47,7 +73,7 @@ arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, UNU } static inline void -arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, UNUSED prof_tctx_t *tctx) { +arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, prof_tctx_t *tctx) { cassert(config_prof); assert(ptr != NULL); @@ -57,7 +83,33 @@ arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, U large_prof_tctx_reset(tsdn, extent); } +JEMALLOC_ALWAYS_INLINE nstime_t +arena_prof_alloc_time_get(tsdn_t *tsdn, const void *ptr, + alloc_ctx_t *alloc_ctx) { + cassert(config_prof); + assert(ptr != NULL); + + extent_t *extent = iealloc(tsdn, ptr); + /* + * Unlike arena_prof_prof_tctx_{get, set}, we only call this once we're + * sure we have a sampled allocation. + */ + assert(!extent_slab_get(extent)); + return large_prof_alloc_time_get(extent); +} + JEMALLOC_ALWAYS_INLINE void +arena_prof_alloc_time_set(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx, + nstime_t t) { + cassert(config_prof); + assert(ptr != NULL); + + extent_t *extent = iealloc(tsdn, ptr); + assert(!extent_slab_get(extent)); + large_prof_alloc_time_set(extent, t); +} + +JEMALLOC_ALWAYS_INLINE void arena_decay_ticks(tsdn_t *tsdn, arena_t *arena, unsigned nticks) { tsd_t *tsd; ticker_t *decay_ticker; @@ -83,14 +135,33 @@ arena_decay_tick(tsdn_t *tsdn, arena_t *arena) { arena_decay_ticks(tsdn, arena, 1); } +/* Purge a single extent to retained / unmapped directly. */ +JEMALLOC_ALWAYS_INLINE void +arena_decay_extent(tsdn_t *tsdn,arena_t *arena, extent_hooks_t **r_extent_hooks, + extent_t *extent) { + size_t extent_size = extent_size_get(extent); + extent_dalloc_wrapper(tsdn, arena, + r_extent_hooks, extent); + if (config_stats) { + /* Update stats accordingly. */ + arena_stats_lock(tsdn, &arena->stats); + arena_stats_add_u64(tsdn, &arena->stats, + &arena->decay_dirty.stats->nmadvise, 1); + arena_stats_add_u64(tsdn, &arena->stats, + &arena->decay_dirty.stats->purged, extent_size >> LG_PAGE); + arena_stats_sub_zu(tsdn, &arena->stats, &arena->stats.mapped, + extent_size); + arena_stats_unlock(tsdn, &arena->stats); + } +} + JEMALLOC_ALWAYS_INLINE void * arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero, tcache_t *tcache, bool slow_path) { assert(!tsdn_null(tsdn) || tcache == NULL); - assert(size != 0); if (likely(tcache != NULL)) { - if (likely(size <= SMALL_MAXCLASS)) { + if (likely(size <= SC_SMALL_MAXCLASS)) { return tcache_alloc_small(tsdn_tsd(tsdn), arena, tcache, size, ind, zero, slow_path); } @@ -119,7 +190,7 @@ arena_salloc(tsdn_t *tsdn, const void *ptr) { szind_t szind = rtree_szind_read(tsdn, &extents_rtree, rtree_ctx, (uintptr_t)ptr, true); - assert(szind != NSIZES); + assert(szind != SC_NSIZES); return sz_index2size(szind); } @@ -152,12 +223,22 @@ arena_vsalloc(tsdn_t *tsdn, const void *ptr) { /* Only slab members should be looked up via interior pointers. */ assert(extent_addr_get(extent) == ptr || extent_slab_get(extent)); - assert(szind != NSIZES); + assert(szind != SC_NSIZES); return sz_index2size(szind); } static inline void +arena_dalloc_large_no_tcache(tsdn_t *tsdn, void *ptr, szind_t szind) { + if (config_prof && unlikely(szind < SC_NBINS)) { + arena_dalloc_promoted(tsdn, ptr, NULL, true); + } else { + extent_t *extent = iealloc(tsdn, ptr); + large_dalloc(tsdn, extent); + } +} + +static inline void arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) { assert(ptr != NULL); @@ -173,7 +254,7 @@ arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) { extent_t *extent = rtree_extent_read(tsdn, &extents_rtree, rtree_ctx, (uintptr_t)ptr, true); assert(szind == extent_szind_get(extent)); - assert(szind < NSIZES); + assert(szind < SC_NSIZES); assert(slab == extent_slab_get(extent)); } @@ -181,6 +262,21 @@ arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) { /* Small allocation. */ arena_dalloc_small(tsdn, ptr); } else { + arena_dalloc_large_no_tcache(tsdn, ptr, szind); + } +} + +JEMALLOC_ALWAYS_INLINE void +arena_dalloc_large(tsdn_t *tsdn, void *ptr, tcache_t *tcache, szind_t szind, + bool slow_path) { + if (szind < nhbins) { + if (config_prof && unlikely(szind < SC_NBINS)) { + arena_dalloc_promoted(tsdn, ptr, tcache, slow_path); + } else { + tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr, szind, + slow_path); + } + } else { extent_t *extent = iealloc(tsdn, ptr); large_dalloc(tsdn, extent); } @@ -203,7 +299,7 @@ arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache if (alloc_ctx != NULL) { szind = alloc_ctx->szind; slab = alloc_ctx->slab; - assert(szind != NSIZES); + assert(szind != SC_NSIZES); } else { rtree_ctx = tsd_rtree_ctx(tsdn_tsd(tsdn)); rtree_szind_slab_read(tsdn, &extents_rtree, rtree_ctx, @@ -215,7 +311,7 @@ arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache extent_t *extent = rtree_extent_read(tsdn, &extents_rtree, rtree_ctx, (uintptr_t)ptr, true); assert(szind == extent_szind_get(extent)); - assert(szind < NSIZES); + assert(szind < SC_NSIZES); assert(slab == extent_slab_get(extent)); } @@ -224,25 +320,14 @@ arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache tcache_dalloc_small(tsdn_tsd(tsdn), tcache, ptr, szind, slow_path); } else { - if (szind < nhbins) { - if (config_prof && unlikely(szind < NBINS)) { - arena_dalloc_promoted(tsdn, ptr, tcache, - slow_path); - } else { - tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr, - szind, slow_path); - } - } else { - extent_t *extent = iealloc(tsdn, ptr); - large_dalloc(tsdn, extent); - } + arena_dalloc_large(tsdn, ptr, tcache, szind, slow_path); } } static inline void arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_t size) { assert(ptr != NULL); - assert(size <= LARGE_MAXCLASS); + assert(size <= SC_LARGE_MAXCLASS); szind_t szind; bool slab; @@ -252,7 +337,7 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_ * object, so base szind and slab on the given size. */ szind = sz_size2index(size); - slab = (szind < NBINS); + slab = (szind < SC_NBINS); } if ((config_prof && opt_prof) || config_debug) { @@ -264,7 +349,7 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_ (uintptr_t)ptr, true, &szind, &slab); assert(szind == sz_size2index(size)); - assert((config_prof && opt_prof) || slab == (szind < NBINS)); + assert((config_prof && opt_prof) || slab == (szind < SC_NBINS)); if (config_debug) { extent_t *extent = rtree_extent_read(tsdn, @@ -278,8 +363,7 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_ /* Small allocation. */ arena_dalloc_small(tsdn, ptr); } else { - extent_t *extent = iealloc(tsdn, ptr); - large_dalloc(tsdn, extent); + arena_dalloc_large_no_tcache(tsdn, ptr, szind); } } @@ -288,7 +372,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tc alloc_ctx_t *alloc_ctx, bool slow_path) { assert(!tsdn_null(tsdn) || tcache == NULL); assert(ptr != NULL); - assert(size <= LARGE_MAXCLASS); + assert(size <= SC_LARGE_MAXCLASS); if (unlikely(tcache == NULL)) { arena_sdalloc_no_tcache(tsdn, ptr, size); @@ -297,7 +381,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tc szind_t szind; bool slab; - UNUSED alloc_ctx_t local_ctx; + alloc_ctx_t local_ctx; if (config_prof && opt_prof) { if (alloc_ctx == NULL) { /* Uncommon case and should be a static check. */ @@ -318,7 +402,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tc * object, so base szind and slab on the given size. */ szind = sz_size2index(size); - slab = (szind < NBINS); + slab = (szind < SC_NBINS); } if (config_debug) { @@ -336,18 +420,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tc tcache_dalloc_small(tsdn_tsd(tsdn), tcache, ptr, szind, slow_path); } else { - if (szind < nhbins) { - if (config_prof && unlikely(szind < NBINS)) { - arena_dalloc_promoted(tsdn, ptr, tcache, - slow_path); - } else { - tcache_dalloc_large(tsdn_tsd(tsdn), - tcache, ptr, szind, slow_path); - } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Nov 11 05:06:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 794EC1AB732; Mon, 11 Nov 2019 05:06:51 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BJkz3KsVz3GlG; Mon, 11 Nov 2019 05:06:51 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50E9AA57D; Mon, 11 Nov 2019 05:06:51 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAB56pvk057059; Mon, 11 Nov 2019 05:06:51 GMT (envelope-from jasone@FreeBSD.org) Received: (from jasone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAB56nFV057050; Mon, 11 Nov 2019 05:06:49 GMT (envelope-from jasone@FreeBSD.org) Message-Id: <201911110506.xAB56nFV057050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jasone set sender to jasone@FreeBSD.org using -f From: Jason Evans Date: Mon, 11 Nov 2019 05:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354606 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc X-SVN-Group: head X-SVN-Commit-Author: jasone X-SVN-Commit-Paths: in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc X-SVN-Commit-Revision: 354606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 05:06:51 -0000 Author: jasone Date: Mon Nov 11 05:06:49 2019 New Revision: 354606 URL: https://svnweb.freebsd.org/changeset/base/354606 Log: Revert r354605: Update jemalloc to version 5.2.1. Compilation fails for non-llvm-based platforms. Added: head/contrib/jemalloc/include/jemalloc/internal/hooks.h - copied unchanged from r354604, head/contrib/jemalloc/include/jemalloc/internal/hooks.h head/contrib/jemalloc/include/jemalloc/internal/size_classes.h - copied unchanged from r354604, head/contrib/jemalloc/include/jemalloc/internal/size_classes.h head/contrib/jemalloc/src/hooks.c - copied unchanged from r354604, head/contrib/jemalloc/src/hooks.c Deleted: head/contrib/jemalloc/include/jemalloc/internal/bin_types.h head/contrib/jemalloc/include/jemalloc/internal/hook.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h head/contrib/jemalloc/include/jemalloc/internal/quantum.h head/contrib/jemalloc/include/jemalloc/internal/safety_check.h head/contrib/jemalloc/include/jemalloc/internal/sc.h head/contrib/jemalloc/include/jemalloc/internal/seq.h head/contrib/jemalloc/include/jemalloc/internal/test_hooks.h head/contrib/jemalloc/src/hook.c head/contrib/jemalloc/src/safety_check.c head/contrib/jemalloc/src/sc.c head/contrib/jemalloc/src/test_hooks.c Modified: head/contrib/jemalloc/COPYING head/contrib/jemalloc/ChangeLog head/contrib/jemalloc/FREEBSD-Xlist head/contrib/jemalloc/FREEBSD-diffs head/contrib/jemalloc/VERSION head/contrib/jemalloc/doc/jemalloc.3 head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h head/contrib/jemalloc/include/jemalloc/internal/arena_stats.h head/contrib/jemalloc/include/jemalloc/internal/arena_structs_b.h head/contrib/jemalloc/include/jemalloc/internal/arena_types.h head/contrib/jemalloc/include/jemalloc/internal/atomic.h head/contrib/jemalloc/include/jemalloc/internal/atomic_gcc_atomic.h head/contrib/jemalloc/include/jemalloc/internal/atomic_gcc_sync.h head/contrib/jemalloc/include/jemalloc/internal/background_thread_externs.h head/contrib/jemalloc/include/jemalloc/internal/background_thread_inlines.h head/contrib/jemalloc/include/jemalloc/internal/background_thread_structs.h head/contrib/jemalloc/include/jemalloc/internal/base_structs.h head/contrib/jemalloc/include/jemalloc/internal/bin.h head/contrib/jemalloc/include/jemalloc/internal/bin_stats.h head/contrib/jemalloc/include/jemalloc/internal/bit_util.h head/contrib/jemalloc/include/jemalloc/internal/bitmap.h head/contrib/jemalloc/include/jemalloc/internal/cache_bin.h head/contrib/jemalloc/include/jemalloc/internal/ctl.h head/contrib/jemalloc/include/jemalloc/internal/emitter.h head/contrib/jemalloc/include/jemalloc/internal/extent_externs.h head/contrib/jemalloc/include/jemalloc/internal/extent_inlines.h head/contrib/jemalloc/include/jemalloc/internal/extent_structs.h head/contrib/jemalloc/include/jemalloc/internal/extent_types.h head/contrib/jemalloc/include/jemalloc/internal/hash.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_decls.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_externs.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_b.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_macros.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_preamble.h head/contrib/jemalloc/include/jemalloc/internal/large_externs.h head/contrib/jemalloc/include/jemalloc/internal/malloc_io.h head/contrib/jemalloc/include/jemalloc/internal/mutex.h head/contrib/jemalloc/include/jemalloc/internal/mutex_prof.h head/contrib/jemalloc/include/jemalloc/internal/private_namespace.h head/contrib/jemalloc/include/jemalloc/internal/prof_externs.h head/contrib/jemalloc/include/jemalloc/internal/prof_inlines_a.h head/contrib/jemalloc/include/jemalloc/internal/prof_inlines_b.h head/contrib/jemalloc/include/jemalloc/internal/prof_structs.h head/contrib/jemalloc/include/jemalloc/internal/public_namespace.h head/contrib/jemalloc/include/jemalloc/internal/rtree.h head/contrib/jemalloc/include/jemalloc/internal/rtree_tsd.h head/contrib/jemalloc/include/jemalloc/internal/stats.h head/contrib/jemalloc/include/jemalloc/internal/sz.h head/contrib/jemalloc/include/jemalloc/internal/tcache_externs.h head/contrib/jemalloc/include/jemalloc/internal/tcache_inlines.h head/contrib/jemalloc/include/jemalloc/internal/tcache_structs.h head/contrib/jemalloc/include/jemalloc/internal/tcache_types.h head/contrib/jemalloc/include/jemalloc/internal/ticker.h head/contrib/jemalloc/include/jemalloc/internal/tsd.h head/contrib/jemalloc/include/jemalloc/internal/tsd_generic.h head/contrib/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h head/contrib/jemalloc/include/jemalloc/internal/tsd_tls.h head/contrib/jemalloc/include/jemalloc/internal/witness.h head/contrib/jemalloc/include/jemalloc/jemalloc.h head/contrib/jemalloc/src/arena.c head/contrib/jemalloc/src/background_thread.c head/contrib/jemalloc/src/base.c head/contrib/jemalloc/src/bin.c head/contrib/jemalloc/src/ckh.c head/contrib/jemalloc/src/ctl.c head/contrib/jemalloc/src/extent.c head/contrib/jemalloc/src/extent_dss.c head/contrib/jemalloc/src/extent_mmap.c head/contrib/jemalloc/src/jemalloc.c head/contrib/jemalloc/src/large.c head/contrib/jemalloc/src/malloc_io.c head/contrib/jemalloc/src/mutex.c head/contrib/jemalloc/src/pages.c head/contrib/jemalloc/src/prof.c head/contrib/jemalloc/src/rtree.c head/contrib/jemalloc/src/stats.c head/contrib/jemalloc/src/sz.c head/contrib/jemalloc/src/tcache.c head/contrib/jemalloc/src/tsd.c head/lib/libc/stdlib/jemalloc/Makefile.inc Modified: head/contrib/jemalloc/COPYING ============================================================================== --- head/contrib/jemalloc/COPYING Mon Nov 11 03:27:14 2019 (r354605) +++ head/contrib/jemalloc/COPYING Mon Nov 11 05:06:49 2019 (r354606) @@ -1,10 +1,10 @@ Unless otherwise specified, files in the jemalloc source distribution are subject to the following license: -------------------------------------------------------------------------------- -Copyright (C) 2002-present Jason Evans . +Copyright (C) 2002-2018 Jason Evans . All rights reserved. Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved. -Copyright (C) 2009-present Facebook, Inc. All rights reserved. +Copyright (C) 2009-2018 Facebook, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Modified: head/contrib/jemalloc/ChangeLog ============================================================================== --- head/contrib/jemalloc/ChangeLog Mon Nov 11 03:27:14 2019 (r354605) +++ head/contrib/jemalloc/ChangeLog Mon Nov 11 05:06:49 2019 (r354606) @@ -4,143 +4,7 @@ brevity. Much more detail can be found in the git rev https://github.com/jemalloc/jemalloc -* 5.2.1 (August 5, 2019) - - This release is primarily about Windows. A critical virtual memory leak is - resolved on all Windows platforms. The regression was present in all releases - since 5.0.0. - - Bug fixes: - - Fix a severe virtual memory leak on Windows. This regression was first - released in 5.0.0. (@Ignition, @j0t, @frederik-h, @davidtgoldblatt, - @interwq) - - Fix size 0 handling in posix_memalign(). This regression was first released - in 5.2.0. (@interwq) - - Fix the prof_log unit test which may observe unexpected backtraces from - compiler optimizations. The test was first added in 5.2.0. (@marxin, - @gnzlbg, @interwq) - - Fix the declaration of the extent_avail tree. This regression was first - released in 5.1.0. (@zoulasc) - - Fix an incorrect reference in jeprof. This functionality was first released - in 3.0.0. (@prehistoric-penguin) - - Fix an assertion on the deallocation fast-path. This regression was first - released in 5.2.0. (@yinan1048576) - - Fix the TLS_MODEL attribute in headers. This regression was first released - in 5.0.0. (@zoulasc, @interwq) - - Optimizations and refactors: - - Implement opt.retain on Windows and enable by default on 64-bit. (@interwq, - @davidtgoldblatt) - - Optimize away a branch on the operator delete[] path. (@mgrice) - - Add format annotation to the format generator function. (@zoulasc) - - Refactor and improve the size class header generation. (@yinan1048576) - - Remove best fit. (@djwatson) - - Avoid blocking on background thread locks for stats. (@oranagra, @interwq) - -* 5.2.0 (April 2, 2019) - - This release includes a few notable improvements, which are summarized below: - 1) improved fast-path performance from the optimizations by @djwatson; 2) - reduced virtual memory fragmentation and metadata usage; and 3) bug fixes on - setting the number of background threads. In addition, peak / spike memory - usage is improved with certain allocation patterns. As usual, the release and - prior dev versions have gone through large-scale production testing. - - New features: - - Implement oversize_threshold, which uses a dedicated arena for allocations - crossing the specified threshold to reduce fragmentation. (@interwq) - - Add extents usage information to stats. (@tyleretzel) - - Log time information for sampled allocations. (@tyleretzel) - - Support 0 size in sdallocx. (@djwatson) - - Output rate for certain counters in malloc_stats. (@zinoale) - - Add configure option --enable-readlinkat, which allows the use of readlinkat - over readlink. (@davidtgoldblatt) - - Add configure options --{enable,disable}-{static,shared} to allow not - building unwanted libraries. (@Ericson2314) - - Add configure option --disable-libdl to enable fully static builds. - (@interwq) - - Add mallctl interfaces: - + opt.oversize_threshold (@interwq) - + stats.arenas..extent_avail (@tyleretzel) - + stats.arenas..extents..n{dirty,muzzy,retained} (@tyleretzel) - + stats.arenas..extents..{dirty,muzzy,retained}_bytes - (@tyleretzel) - - Portability improvements: - - Update MSVC builds. (@maksqwe, @rustyx) - - Workaround a compiler optimizer bug on s390x. (@rkmisra) - - Make use of pthread_set_name_np(3) on FreeBSD. (@trasz) - - Implement malloc_getcpu() to enable percpu_arena for windows. (@santagada) - - Link against -pthread instead of -lpthread. (@paravoid) - - Make background_thread not dependent on libdl. (@interwq) - - Add stringify to fix a linker directive issue on MSVC. (@daverigby) - - Detect and fall back when 8-bit atomics are unavailable. (@interwq) - - Fall back to the default pthread_create if dlsym(3) fails. (@interwq) - - Optimizations and refactors: - - Refactor the TSD module. (@davidtgoldblatt) - - Avoid taking extents_muzzy mutex when muzzy is disabled. (@interwq) - - Avoid taking large_mtx for auto arenas on the tcache flush path. (@interwq) - - Optimize ixalloc by avoiding a size lookup. (@interwq) - - Implement opt.oversize_threshold which uses a dedicated arena for requests - crossing the threshold, also eagerly purges the oversize extents. Default - the threshold to 8 MiB. (@interwq) - - Clean compilation with -Wextra. (@gnzlbg, @jasone) - - Refactor the size class module. (@davidtgoldblatt) - - Refactor the stats emitter. (@tyleretzel) - - Optimize pow2_ceil. (@rkmisra) - - Avoid runtime detection of lazy purging on FreeBSD. (@trasz) - - Optimize mmap(2) alignment handling on FreeBSD. (@trasz) - - Improve error handling for THP state initialization. (@jsteemann) - - Rework the malloc() fast path. (@djwatson) - - Rework the free() fast path. (@djwatson) - - Refactor and optimize the tcache fill / flush paths. (@djwatson) - - Optimize sync / lwsync on PowerPC. (@chmeeedalf) - - Bypass extent_dalloc() when retain is enabled. (@interwq) - - Optimize the locking on large deallocation. (@interwq) - - Reduce the number of pages committed from sanity checking in debug build. - (@trasz, @interwq) - - Deprecate OSSpinLock. (@interwq) - - Lower the default number of background threads to 4 (when the feature - is enabled). (@interwq) - - Optimize the trylock spin wait. (@djwatson) - - Use arena index for arena-matching checks. (@interwq) - - Avoid forced decay on thread termination when using background threads. - (@interwq) - - Disable muzzy decay by default. (@djwatson, @interwq) - - Only initialize libgcc unwinder when profiling is enabled. (@paravoid, - @interwq) - - Bug fixes (all only relevant to jemalloc 5.x): - - Fix background thread index issues with max_background_threads. (@djwatson, - @interwq) - - Fix stats output for opt.lg_extent_max_active_fit. (@interwq) - - Fix opt.prof_prefix initialization. (@davidtgoldblatt) - - Properly trigger decay on tcache destroy. (@interwq, @amosbird) - - Fix tcache.flush. (@interwq) - - Detect whether explicit extent zero out is necessary with huge pages or - custom extent hooks, which may change the purge semantics. (@interwq) - - Fix a side effect caused by extent_max_active_fit combined with decay-based - purging, where freed extents can accumulate and not be reused for an - extended period of time. (@interwq, @mpghf) - - Fix a missing unlock on extent register error handling. (@zoulasc) - - Testing: - - Simplify the Travis script output. (@gnzlbg) - - Update the test scripts for FreeBSD. (@devnexen) - - Add unit tests for the producer-consumer pattern. (@interwq) - - Add Cirrus-CI config for FreeBSD builds. (@jasone) - - Add size-matching sanity checks on tcache flush. (@davidtgoldblatt, - @interwq) - - Incompatible changes: - - Remove --with-lg-page-sizes. (@davidtgoldblatt) - - Documentation: - - Attempt to build docs by default, however skip doc building when xsltproc - is missing. (@interwq, @cmuellner) - -* 5.1.0 (May 4, 2018) +* 5.1.0 (May 4th, 2018) This release is primarily about fine-tuning, ranging from several new features to numerous notable performance and portability enhancements. The release and Modified: head/contrib/jemalloc/FREEBSD-Xlist ============================================================================== --- head/contrib/jemalloc/FREEBSD-Xlist Mon Nov 11 03:27:14 2019 (r354605) +++ head/contrib/jemalloc/FREEBSD-Xlist Mon Nov 11 05:06:49 2019 (r354606) @@ -1,7 +1,6 @@ $FreeBSD$ .appveyor.yml .autom4te.cfg -.cirrus.yml .git* .travis.yml FREEBSD-* Modified: head/contrib/jemalloc/FREEBSD-diffs ============================================================================== --- head/contrib/jemalloc/FREEBSD-diffs Mon Nov 11 03:27:14 2019 (r354605) +++ head/contrib/jemalloc/FREEBSD-diffs Mon Nov 11 05:06:49 2019 (r354606) @@ -1,5 +1,5 @@ diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in -index 7fecda7c..d5ca5e86 100644 +index 1e12fd3a..c42a7e10 100644 --- a/doc/jemalloc.xml.in +++ b/doc/jemalloc.xml.in @@ -53,11 +53,22 @@ @@ -26,7 +26,7 @@ index 7fecda7c..d5ca5e86 100644 Standard API -@@ -3510,4 +3521,18 @@ malloc_conf = "narenas:1";]]> +@@ -3376,4 +3387,18 @@ malloc_conf = "narenas:1";]]> The posix_memalign() function conforms to IEEE Std 1003.1-2001 (POSIX.1). @@ -45,8 +45,26 @@ index 7fecda7c..d5ca5e86 100644 + 11.0. + +diff --git a/include/jemalloc/internal/hooks.h b/include/jemalloc/internal/hooks.h +index cd49afcb..85e2a991 100644 +--- a/include/jemalloc/internal/hooks.h ++++ b/include/jemalloc/internal/hooks.h +@@ -6,13 +6,6 @@ extern JEMALLOC_EXPORT void (*hooks_libc_hook)(); + + #define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) + +-#define open JEMALLOC_HOOK(open, hooks_libc_hook) +-#define read JEMALLOC_HOOK(read, hooks_libc_hook) +-#define write JEMALLOC_HOOK(write, hooks_libc_hook) +-#define readlink JEMALLOC_HOOK(readlink, hooks_libc_hook) +-#define close JEMALLOC_HOOK(close, hooks_libc_hook) +-#define creat JEMALLOC_HOOK(creat, hooks_libc_hook) +-#define secure_getenv JEMALLOC_HOOK(secure_getenv, hooks_libc_hook) + /* Note that this is undef'd and re-define'd in src/prof.c. */ + #define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, hooks_libc_hook) + diff --git a/include/jemalloc/internal/jemalloc_internal_decls.h b/include/jemalloc/internal/jemalloc_internal_decls.h -index 7d6053e2..a0e4f5af 100644 +index be70df51..84cd70da 100644 --- a/include/jemalloc/internal/jemalloc_internal_decls.h +++ b/include/jemalloc/internal/jemalloc_internal_decls.h @@ -1,6 +1,9 @@ @@ -59,23 +77,8 @@ index 7d6053e2..a0e4f5af 100644 #include #ifdef _WIN32 # include -diff --git a/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h b/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h -new file mode 100644 -index 00000000..0dab1296 ---- /dev/null -+++ b/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h -@@ -0,0 +1,9 @@ -+#ifndef __clang__ -+# undef JEMALLOC_INTERNAL_UNREACHABLE -+# define JEMALLOC_INTERNAL_UNREACHABLE abort -+ -+# undef JEMALLOC_C11_ATOMICS -+# undef JEMALLOC_GCC_ATOMIC_ATOMICS -+# undef JEMALLOC_GCC_U8_ATOMIC_ATOMICS -+# undef JEMALLOC_GCC_U8_SYNC_ATOMICS -+#endif diff --git a/include/jemalloc/internal/jemalloc_preamble.h.in b/include/jemalloc/internal/jemalloc_preamble.h.in -index 3418cbfa..53e30dc4 100644 +index e621fbc8..dbdd5d6b 100644 --- a/include/jemalloc/internal/jemalloc_preamble.h.in +++ b/include/jemalloc/internal/jemalloc_preamble.h.in @@ -8,6 +8,9 @@ @@ -104,10 +107,10 @@ index 3418cbfa..53e30dc4 100644 static const bool config_prof = #ifdef JEMALLOC_PROF diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h -index 7c24f072..94af1618 100644 +index 6520c251..0013cbe9 100644 --- a/include/jemalloc/internal/mutex.h +++ b/include/jemalloc/internal/mutex.h -@@ -135,9 +135,6 @@ struct malloc_mutex_s { +@@ -121,9 +121,6 @@ struct malloc_mutex_s { #ifdef JEMALLOC_LAZY_LOCK extern bool isthreaded; @@ -117,7 +120,7 @@ index 7c24f072..94af1618 100644 #endif bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, -@@ -145,6 +142,7 @@ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, +@@ -131,6 +128,7 @@ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, void malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex); void malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex); void malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex); @@ -125,38 +128,20 @@ index 7c24f072..94af1618 100644 bool malloc_mutex_boot(void); void malloc_mutex_prof_data_reset(tsdn_t *tsdn, malloc_mutex_t *mutex); -diff --git a/include/jemalloc/internal/test_hooks.h b/include/jemalloc/internal/test_hooks.h -index a6351e59..0780c52f 100644 ---- a/include/jemalloc/internal/test_hooks.h -+++ b/include/jemalloc/internal/test_hooks.h -@@ -6,13 +6,6 @@ extern JEMALLOC_EXPORT void (*test_hooks_libc_hook)(); - - #define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) - --#define open JEMALLOC_HOOK(open, test_hooks_libc_hook) --#define read JEMALLOC_HOOK(read, test_hooks_libc_hook) --#define write JEMALLOC_HOOK(write, test_hooks_libc_hook) --#define readlink JEMALLOC_HOOK(readlink, test_hooks_libc_hook) --#define close JEMALLOC_HOOK(close, test_hooks_libc_hook) --#define creat JEMALLOC_HOOK(creat, test_hooks_libc_hook) --#define secure_getenv JEMALLOC_HOOK(secure_getenv, test_hooks_libc_hook) - /* Note that this is undef'd and re-define'd in src/prof.c. */ - #define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, test_hooks_libc_hook) - diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h -index 9ba26004..ecfda5d6 100644 +index 0b9841aa..f03eee61 100644 --- a/include/jemalloc/internal/tsd.h +++ b/include/jemalloc/internal/tsd.h -@@ -198,7 +198,8 @@ struct tsd_s { - t TSD_MANGLE(n); +@@ -122,7 +122,8 @@ struct tsd_s { + t use_a_getter_or_setter_instead_##n; MALLOC_TSD #undef O -}; +/* AddressSanitizer requires TLS data to be aligned to at least 8 bytes. */ +} JEMALLOC_ALIGNED(16); - JEMALLOC_ALWAYS_INLINE uint8_t - tsd_state_get(tsd_t *tsd) { + /* + * Wrapper around tsd_t that makes it possible to avoid implicit conversion diff --git a/include/jemalloc/jemalloc_FreeBSD.h b/include/jemalloc/jemalloc_FreeBSD.h new file mode 100644 index 00000000..b752b0e7 @@ -360,10 +345,10 @@ index f9438912..47d032c1 100755 +#include "jemalloc_FreeBSD.h" EOF diff --git a/src/jemalloc.c b/src/jemalloc.c -index ed13718d..fefb719a 100644 +index f93c16fa..e0ad297b 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c -@@ -23,6 +23,10 @@ +@@ -21,6 +21,10 @@ /******************************************************************************/ /* Data. */ @@ -374,37 +359,10 @@ index ed13718d..fefb719a 100644 /* Runtime configuration options. */ const char *je_malloc_conf #ifndef _WIN32 -@@ -2660,25 +2664,6 @@ je_realloc(void *ptr, size_t arg_size) { - LOG("core.realloc.entry", "ptr: %p, size: %zu\n", ptr, size); - - if (unlikely(size == 0)) { -- if (ptr != NULL) { -- /* realloc(ptr, 0) is equivalent to free(ptr). */ -- UTRACE(ptr, 0, 0); -- tcache_t *tcache; -- tsd_t *tsd = tsd_fetch(); -- if (tsd_reentrancy_level_get(tsd) == 0) { -- tcache = tcache_get(tsd); -- } else { -- tcache = NULL; -- } -- -- uintptr_t args[3] = {(uintptr_t)ptr, size}; -- hook_invoke_dalloc(hook_dalloc_realloc, ptr, args); -- -- ifree(tsd, ptr, tcache, true); -- -- LOG("core.realloc.exit", "result: %p", NULL); -- return NULL; -- } - size = 1; - } - -@@ -3750,6 +3735,103 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) { - * End non-standard functions. +@@ -3160,6 +3164,103 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) { */ /******************************************************************************/ -+/* + /* + * Begin compatibility functions. + */ + @@ -501,10 +459,11 @@ index ed13718d..fefb719a 100644 + * End compatibility functions. + */ +/******************************************************************************/ - /* ++/* * The following functions are used by threading libraries for protection of * malloc during fork(). -@@ -3919,4 +4001,11 @@ jemalloc_postfork_child(void) { + */ +@@ -3323,4 +3424,11 @@ jemalloc_postfork_child(void) { ctl_postfork_child(tsd_tsdn(tsd)); } @@ -517,7 +476,7 @@ index ed13718d..fefb719a 100644 + /******************************************************************************/ diff --git a/src/malloc_io.c b/src/malloc_io.c -index d7cb0f52..cda589c4 100644 +index 7bdc13f9..c8802c70 100644 --- a/src/malloc_io.c +++ b/src/malloc_io.c @@ -75,6 +75,20 @@ wrtmessage(void *cbopaque, const char *s) { @@ -542,7 +501,7 @@ index d7cb0f52..cda589c4 100644 * Wrapper around malloc_message() that avoids the need for * je_malloc_message(...) throughout the code. diff --git a/src/mutex.c b/src/mutex.c -index 3f920f5b..88a7730c 100644 +index 30222b3e..b2c36283 100644 --- a/src/mutex.c +++ b/src/mutex.c @@ -41,6 +41,17 @@ pthread_create(pthread_t *__restrict thread, @@ -564,10 +523,9 @@ index 3f920f5b..88a7730c 100644 void @@ -131,6 +142,16 @@ mutex_addr_comp(const witness_t *witness1, void *mutex1, - } } -+bool + bool +malloc_mutex_first_thread(void) { + +#ifndef JEMALLOC_MUTEX_INIT_CB @@ -577,6 +535,7 @@ index 3f920f5b..88a7730c 100644 +#endif +} + - bool ++bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, witness_rank_t rank, malloc_mutex_lock_order_t lock_order) { + mutex_prof_data_init(&mutex->prof_data); Modified: head/contrib/jemalloc/VERSION ============================================================================== --- head/contrib/jemalloc/VERSION Mon Nov 11 03:27:14 2019 (r354605) +++ head/contrib/jemalloc/VERSION Mon Nov 11 05:06:49 2019 (r354606) @@ -1 +1 @@ -5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756 +5.1.0-0-g61efbda7098de6fe64c362d309824864308c36d4 Modified: head/contrib/jemalloc/doc/jemalloc.3 ============================================================================== --- head/contrib/jemalloc/doc/jemalloc.3 Mon Nov 11 03:27:14 2019 (r354605) +++ head/contrib/jemalloc/doc/jemalloc.3 Mon Nov 11 05:06:49 2019 (r354606) @@ -1,13 +1,13 @@ '\" t .\" Title: JEMALLOC .\" Author: Jason Evans -.\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 11/10/2019 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 05/08/2018 .\" Manual: User Manual -.\" Source: jemalloc 5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756 +.\" Source: jemalloc 5.1.0-0-g61efbda7098de6fe64c362d309824864308c36d4 .\" Language: English .\" -.TH "JEMALLOC" "3" "11/10/2019" "jemalloc 5.2.1-0-gea6b3e973b47" "User Manual" +.TH "JEMALLOC" "3" "05/08/2018" "jemalloc 5.1.0-0-g61efbda7098d" "User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -31,7 +31,7 @@ jemalloc \- general purpose memory allocation functions .SH "LIBRARY" .PP -This manual describes jemalloc 5\&.2\&.1\-0\-gea6b3e973b477b8061e0076bb257dbd7f3faa756\&. More information can be found at the +This manual describes jemalloc 5\&.1\&.0\-0\-g61efbda7098de6fe64c362d309824864308c36d4\&. More information can be found at the \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP The following configuration options are enabled in libc\*(Aqs built\-in jemalloc: @@ -396,7 +396,7 @@ string, in which case the statistics are presented in as a character within the \fIopts\fR string\&. Note that -malloc_stats_print() +malloc_message() uses the mallctl*() functions internally, so inconsistent statistics can be reported if multiple threads use these functions simultaneously\&. If @@ -411,9 +411,7 @@ and \(lql\(rq can be specified to omit per size class statistics for bins and large objects, respectively; \(lqx\(rq -can be specified to omit all mutex statistics; -\(lqe\(rq -can be used to omit extent statistics\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&. +can be specified to omit all mutex statistics\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&. .PP The malloc_usable_size() @@ -828,17 +826,6 @@ in these cases\&. This option is disabled by default u is specified during configuration, in which case it is enabled by default\&. .RE .PP -opt\&.confirm_conf (\fBbool\fR) r\- -.RS 4 -Confirm\-runtime\-options\-when\-program\-starts enabled/disabled\&. If true, the string specified via -\fB\-\-with\-malloc\-conf\fR, the string pointed to by the global variable -\fImalloc_conf\fR, the -\(lqname\(rq -of the file referenced by the symbolic link named -/etc/malloc\&.conf, and the value of the environment variable -\fBMALLOC_CONF\fR, will be printed in order\&. Then, each option being set will be individually printed\&. This option is disabled by default\&. -.RE -.PP opt\&.abort_conf (\fBbool\fR) r\- .RS 4 Abort\-on\-invalid\-configuration enabled/disabled\&. If true, invalid runtime options are fatal\&. The process will call @@ -865,10 +852,9 @@ If true, retain unused virtual memory for later reuse \fBmunmap\fR(2) or equivalent (see stats\&.retained -for related details)\&. It also makes jemalloc use -\fBmmap\fR(2) -or equivalent in a more greedy way, mapping larger chunks in one go\&. This option is disabled by default unless discarding virtual memory is known to trigger platform\-specific performance problems, namely 1) for [64\-bit] Linux, which has a quirk in its virtual memory allocation algorithm that causes semi\-permanent VM map holes under normal jemalloc operation; and 2) for [64\-bit] Windows, which disallows split / merged regions with -\fI\fBMEM_RELEASE\fR\fR\&. Although the same issues may present on 32\-bit platforms as well, retaining virtual memory for 32\-bit Linux and Windows is disabled by default due to the practical possibility of address space exhaustion\&. +for related details)\&. This option is disabled by default unless discarding virtual memory is known to trigger platform\-specific performance problems, e\&.g\&. for [64\-bit] Linux, which has a quirk in its virtual memory allocation algorithm that causes semi\-permanent VM map holes under normal jemalloc operation\&. Although +\fBmunmap\fR(2) +causes issues on 32\-bit Linux as well, retaining virtual memory for 32\-bit Linux is disabled by default due to the practical possibility of address space exhaustion\&. .RE .PP opt\&.dss (\fBconst char *\fR) r\- @@ -896,13 +882,6 @@ opt\&.narenas (\fBunsigned\fR) r\- Maximum number of arenas to use for automatic multiplexing of threads and arenas\&. The default is four times the number of CPUs, or one if there is a single CPU\&. .RE .PP -opt\&.oversize_threshold (\fBsize_t\fR) r\- -.RS 4 -The threshold in bytes of which requests are considered oversize\&. Allocation requests with greater sizes are fulfilled from a dedicated arena (automatically managed, however not within -narenas), in order to reduce fragmentation by not mixing huge allocations with small ones\&. In addition, the decay API guarantees on the extents greater than the specified threshold may be overridden\&. Note that requests with arena index specified via -\fBMALLOCX_ARENA\fR, or threads associated with explicit arenas will not be considered\&. The default threshold is 8MiB\&. Values not within large size classes disables this feature\&. -.RE -.PP opt\&.percpu_arena (\fBconst char *\fR) r\- .RS 4 Per CPU arena mode\&. Use the @@ -914,14 +893,14 @@ setting uses one arena per physical CPU, which means t \(lqdisabled\(rq\&. .RE .PP -opt\&.background_thread (\fBbool\fR) r\- +opt\&.background_thread (\fBconst bool\fR) r\- .RS 4 Internal background worker threads enabled/disabled\&. Because of potential circular dependencies, enabling background thread using this option may cause crash or deadlock during initialization\&. For a reliable way to use this feature, see background_thread for dynamic control options and details\&. This option is disabled by default\&. .RE .PP -opt\&.max_background_threads (\fBsize_t\fR) r\- +opt\&.max_background_threads (\fBconst size_t\fR) r\- .RS 4 Maximum number of background threads that will be created if background_thread @@ -938,9 +917,7 @@ and arena\&.\&.dirty_decay_ms for related dynamic control options\&. See opt\&.muzzy_decay_ms -for a description of muzzy pages\&.for a description of muzzy pages\&. Note that when the -oversize_threshold -feature is enabled, the arenas reserved for oversize requests may have its own default decay settings\&. +for a description of muzzy pages\&. .RE .PP opt\&.muzzy_decay_ms (\fBssize_t\fR) r\- @@ -1316,7 +1293,7 @@ arena\&.\&.extent_hooks (\fBextent_hooks_t *\fR) rw .RS 4 Get or set the extent management hook functions for arena \&. The functions must be capable of operating on all extant extents associated with arena , usually by passing unknown extents to the replaced functions\&. In practice, it is feasible to control allocation for arenas explicitly created via arenas\&.create -such that all extents originate from an application\-supplied extent allocator (by specifying the custom extent hook functions during arena creation)\&. However, the API guarantees for the automatically created arenas may be relaxed \-\- hooks set there may be called in a "best effort" fashion; in addition there may be extents created prior to the application having an opportunity to take over extent allocation\&. +such that all extents originate from an application\-supplied extent allocator (by specifying the custom extent hook functions during arena creation), but the automatically created arenas will have already created extents prior to the application having an opportunity to take over extent allocation\&. .sp .if n \{\ .RS 4 @@ -1899,11 +1876,6 @@ stats\&.retained for details\&. .RE .PP -stats\&.arenas\&.\&.extent_avail (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] -.RS 4 -Number of allocated (but unused) extent structs in this arena\&. -.RE -.PP stats\&.arenas\&.\&.base (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] .RS 4 Number of bytes dedicated to bootstrap\-sensitive allocator metadata structures\&. @@ -1984,16 +1956,6 @@ stats\&.arenas\&.\&.small\&.nrequests (\fBuint64_t\ Cumulative number of allocation requests satisfied by all bin size classes\&. .RE .PP -stats\&.arenas\&.\&.small\&.nfills (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] -.RS 4 -Cumulative number of tcache fills by all small size classes\&. -.RE -.PP -stats\&.arenas\&.\&.small\&.nflushes (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] -.RS 4 -Cumulative number of tcache flushes by all small size classes\&. -.RE -.PP stats\&.arenas\&.\&.large\&.allocated (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] .RS 4 Number of bytes currently allocated by large objects\&. @@ -2018,16 +1980,6 @@ stats\&.arenas\&.\&.large\&.nrequests (\fBuint64_t\ Cumulative number of allocation requests satisfied by all large size classes\&. .RE .PP -stats\&.arenas\&.\&.large\&.nfills (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] -.RS 4 -Cumulative number of tcache fills by all large size classes\&. -.RE -.PP -stats\&.arenas\&.\&.large\&.nflushes (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] -.RS 4 -Cumulative number of tcache flushes by all large size classes\&. -.RE -.PP stats\&.arenas\&.\&.bins\&.\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] .RS 4 Cumulative number of times a bin region of the corresponding size class was allocated from the arena, whether to fill the relevant tcache if @@ -2077,11 +2029,6 @@ stats\&.arenas\&.\&.bins\&.\&.curslabs (\fBsize_ Current number of slabs\&. .RE .PP -stats\&.arenas\&.\&.bins\&.\&.nonfull_slabs (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] -.RS 4 -Current number of nonfull slabs\&. -.RE -.PP stats\&.arenas\&.\&.bins\&.\&.mutex\&.{counter} (\fBcounter specific type\fR) r\- [\fB\-\-enable\-stats\fR] .RS 4 Statistics on @@ -2090,16 +2037,6 @@ mutex (arena bin scope; bin operation related)\&. {counter} is one of the counters in mutex profiling counters\&. -.RE -.PP -stats\&.arenas\&.\&.extents\&.\&.n{extent_type} (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] -.RS 4 -Number of extents of the given type in this arena in the bucket corresponding to page size index \&. The extent type is one of dirty, muzzy, or retained\&. -.RE -.PP -stats\&.arenas\&.\&.extents\&.\&.{extent_type}_bytes (\fBsize_t\fR) r\- [\fB\-\-enable\-stats\fR] -.RS 4 -Sum of the bytes managed by extents of the given type in this arena in the bucket corresponding to page size index \&. The extent type is one of dirty, muzzy, or retained\&. .RE .PP stats\&.arenas\&.\&.lextents\&.\&.nmalloc (\fBuint64_t\fR) r\- [\fB\-\-enable\-stats\fR] Modified: head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h Mon Nov 11 03:27:14 2019 (r354605) +++ head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h Mon Nov 11 05:06:49 2019 (r354606) @@ -3,8 +3,8 @@ #include "jemalloc/internal/bin.h" #include "jemalloc/internal/extent_dss.h" -#include "jemalloc/internal/hook.h" #include "jemalloc/internal/pages.h" +#include "jemalloc/internal/size_classes.h" #include "jemalloc/internal/stats.h" extern ssize_t opt_dirty_decay_ms; @@ -16,17 +16,13 @@ extern const char *percpu_arena_mode_names[]; extern const uint64_t h_steps[SMOOTHSTEP_NSTEPS]; extern malloc_mutex_t arenas_lock; -extern size_t opt_oversize_threshold; -extern size_t oversize_threshold; - void arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads, const char **dss, ssize_t *dirty_decay_ms, ssize_t *muzzy_decay_ms, size_t *nactive, size_t *ndirty, size_t *nmuzzy); void arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads, const char **dss, ssize_t *dirty_decay_ms, ssize_t *muzzy_decay_ms, size_t *nactive, size_t *ndirty, size_t *nmuzzy, arena_stats_t *astats, - bin_stats_t *bstats, arena_stats_large_t *lstats, - arena_stats_extents_t *estats); + bin_stats_t *bstats, arena_stats_large_t *lstats); void arena_extents_dirty_dalloc(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks, extent_t *extent); #ifdef JEMALLOC_JET @@ -60,17 +56,16 @@ void *arena_malloc_hard(tsdn_t *tsdn, arena_t *arena, szind_t ind, bool zero); void *arena_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment, bool zero, tcache_t *tcache); -void arena_prof_promote(tsdn_t *tsdn, void *ptr, size_t usize); +void arena_prof_promote(tsdn_t *tsdn, const void *ptr, size_t usize); void arena_dalloc_promoted(tsdn_t *tsdn, void *ptr, tcache_t *tcache, bool slow_path); -void arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena, bin_t *bin, - szind_t binind, extent_t *extent, void *ptr); +void arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena, + extent_t *extent, void *ptr); void arena_dalloc_small(tsdn_t *tsdn, void *ptr); bool arena_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size, - size_t extra, bool zero, size_t *newsize); + size_t extra, bool zero); void *arena_ralloc(tsdn_t *tsdn, arena_t *arena, void *ptr, size_t oldsize, - size_t size, size_t alignment, bool zero, tcache_t *tcache, - hook_ralloc_args_t *hook_args); + size_t size, size_t alignment, bool zero, tcache_t *tcache); dss_prec_t arena_dss_prec_get(arena_t *arena); bool arena_dss_prec_set(arena_t *arena, dss_prec_t dss_prec); ssize_t arena_dirty_decay_ms_default_get(void); @@ -84,12 +79,7 @@ void arena_nthreads_inc(arena_t *arena, bool internal) void arena_nthreads_dec(arena_t *arena, bool internal); size_t arena_extent_sn_next(arena_t *arena); arena_t *arena_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks); -bool arena_init_huge(void); -bool arena_is_huge(unsigned arena_ind); -arena_t *arena_choose_huge(tsd_t *tsd); -bin_t *arena_bin_choose_lock(tsdn_t *tsdn, arena_t *arena, szind_t binind, - unsigned *binshard); -void arena_boot(sc_data_t *sc_data); +void arena_boot(void); void arena_prefork0(tsdn_t *tsdn, arena_t *arena); void arena_prefork1(tsdn_t *tsdn, arena_t *arena); void arena_prefork2(tsdn_t *tsdn, arena_t *arena); Modified: head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h Mon Nov 11 03:27:14 2019 (r354605) +++ head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h Mon Nov 11 05:06:49 2019 (r354606) @@ -4,36 +4,10 @@ #include "jemalloc/internal/jemalloc_internal_types.h" #include "jemalloc/internal/mutex.h" #include "jemalloc/internal/rtree.h" -#include "jemalloc/internal/sc.h" +#include "jemalloc/internal/size_classes.h" #include "jemalloc/internal/sz.h" #include "jemalloc/internal/ticker.h" -JEMALLOC_ALWAYS_INLINE bool -arena_has_default_hooks(arena_t *arena) { - return (extent_hooks_get(arena) == &extent_hooks_default); -} - -JEMALLOC_ALWAYS_INLINE arena_t * -arena_choose_maybe_huge(tsd_t *tsd, arena_t *arena, size_t size) { - if (arena != NULL) { - return arena; - } - - /* - * For huge allocations, use the dedicated huge arena if both are true: - * 1) is using auto arena selection (i.e. arena == NULL), and 2) the - * thread is not assigned to a manual arena. - */ - if (unlikely(size >= oversize_threshold)) { - arena_t *tsd_arena = tsd_arena_get(tsd); - if (tsd_arena == NULL || arena_is_auto(tsd_arena)) { - return arena_choose_huge(tsd); - } - } - - return arena_choose(tsd, NULL); -} - JEMALLOC_ALWAYS_INLINE prof_tctx_t * arena_prof_tctx_get(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx) { cassert(config_prof); @@ -54,7 +28,7 @@ arena_prof_tctx_get(tsdn_t *tsdn, const void *ptr, all } JEMALLOC_ALWAYS_INLINE void -arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize, +arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, UNUSED size_t usize, alloc_ctx_t *alloc_ctx, prof_tctx_t *tctx) { cassert(config_prof); assert(ptr != NULL); @@ -73,7 +47,7 @@ arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, siz } static inline void -arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, prof_tctx_t *tctx) { +arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, UNUSED prof_tctx_t *tctx) { cassert(config_prof); assert(ptr != NULL); @@ -83,33 +57,7 @@ arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, p large_prof_tctx_reset(tsdn, extent); } -JEMALLOC_ALWAYS_INLINE nstime_t -arena_prof_alloc_time_get(tsdn_t *tsdn, const void *ptr, - alloc_ctx_t *alloc_ctx) { - cassert(config_prof); - assert(ptr != NULL); - - extent_t *extent = iealloc(tsdn, ptr); - /* - * Unlike arena_prof_prof_tctx_{get, set}, we only call this once we're - * sure we have a sampled allocation. - */ - assert(!extent_slab_get(extent)); - return large_prof_alloc_time_get(extent); -} - JEMALLOC_ALWAYS_INLINE void -arena_prof_alloc_time_set(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx, - nstime_t t) { - cassert(config_prof); - assert(ptr != NULL); - - extent_t *extent = iealloc(tsdn, ptr); - assert(!extent_slab_get(extent)); - large_prof_alloc_time_set(extent, t); -} - -JEMALLOC_ALWAYS_INLINE void arena_decay_ticks(tsdn_t *tsdn, arena_t *arena, unsigned nticks) { tsd_t *tsd; ticker_t *decay_ticker; @@ -135,33 +83,14 @@ arena_decay_tick(tsdn_t *tsdn, arena_t *arena) { arena_decay_ticks(tsdn, arena, 1); } -/* Purge a single extent to retained / unmapped directly. */ -JEMALLOC_ALWAYS_INLINE void -arena_decay_extent(tsdn_t *tsdn,arena_t *arena, extent_hooks_t **r_extent_hooks, - extent_t *extent) { - size_t extent_size = extent_size_get(extent); - extent_dalloc_wrapper(tsdn, arena, - r_extent_hooks, extent); - if (config_stats) { - /* Update stats accordingly. */ - arena_stats_lock(tsdn, &arena->stats); - arena_stats_add_u64(tsdn, &arena->stats, - &arena->decay_dirty.stats->nmadvise, 1); - arena_stats_add_u64(tsdn, &arena->stats, - &arena->decay_dirty.stats->purged, extent_size >> LG_PAGE); - arena_stats_sub_zu(tsdn, &arena->stats, &arena->stats.mapped, - extent_size); - arena_stats_unlock(tsdn, &arena->stats); - } -} - JEMALLOC_ALWAYS_INLINE void * arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero, tcache_t *tcache, bool slow_path) { assert(!tsdn_null(tsdn) || tcache == NULL); + assert(size != 0); if (likely(tcache != NULL)) { - if (likely(size <= SC_SMALL_MAXCLASS)) { + if (likely(size <= SMALL_MAXCLASS)) { return tcache_alloc_small(tsdn_tsd(tsdn), arena, tcache, size, ind, zero, slow_path); } @@ -190,7 +119,7 @@ arena_salloc(tsdn_t *tsdn, const void *ptr) { szind_t szind = rtree_szind_read(tsdn, &extents_rtree, rtree_ctx, (uintptr_t)ptr, true); - assert(szind != SC_NSIZES); + assert(szind != NSIZES); return sz_index2size(szind); } @@ -223,22 +152,12 @@ arena_vsalloc(tsdn_t *tsdn, const void *ptr) { /* Only slab members should be looked up via interior pointers. */ assert(extent_addr_get(extent) == ptr || extent_slab_get(extent)); - assert(szind != SC_NSIZES); + assert(szind != NSIZES); return sz_index2size(szind); } static inline void -arena_dalloc_large_no_tcache(tsdn_t *tsdn, void *ptr, szind_t szind) { - if (config_prof && unlikely(szind < SC_NBINS)) { - arena_dalloc_promoted(tsdn, ptr, NULL, true); - } else { - extent_t *extent = iealloc(tsdn, ptr); - large_dalloc(tsdn, extent); - } -} - -static inline void arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) { assert(ptr != NULL); @@ -254,7 +173,7 @@ arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) { extent_t *extent = rtree_extent_read(tsdn, &extents_rtree, rtree_ctx, (uintptr_t)ptr, true); assert(szind == extent_szind_get(extent)); - assert(szind < SC_NSIZES); + assert(szind < NSIZES); assert(slab == extent_slab_get(extent)); } @@ -262,21 +181,6 @@ arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) { /* Small allocation. */ arena_dalloc_small(tsdn, ptr); } else { - arena_dalloc_large_no_tcache(tsdn, ptr, szind); - } -} - -JEMALLOC_ALWAYS_INLINE void -arena_dalloc_large(tsdn_t *tsdn, void *ptr, tcache_t *tcache, szind_t szind, - bool slow_path) { - if (szind < nhbins) { - if (config_prof && unlikely(szind < SC_NBINS)) { - arena_dalloc_promoted(tsdn, ptr, tcache, slow_path); - } else { - tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr, szind, - slow_path); - } - } else { extent_t *extent = iealloc(tsdn, ptr); large_dalloc(tsdn, extent); } @@ -299,7 +203,7 @@ arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache if (alloc_ctx != NULL) { szind = alloc_ctx->szind; slab = alloc_ctx->slab; - assert(szind != SC_NSIZES); + assert(szind != NSIZES); } else { rtree_ctx = tsd_rtree_ctx(tsdn_tsd(tsdn)); rtree_szind_slab_read(tsdn, &extents_rtree, rtree_ctx, @@ -311,7 +215,7 @@ arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache extent_t *extent = rtree_extent_read(tsdn, &extents_rtree, rtree_ctx, (uintptr_t)ptr, true); assert(szind == extent_szind_get(extent)); - assert(szind < SC_NSIZES); + assert(szind < NSIZES); assert(slab == extent_slab_get(extent)); } @@ -320,14 +224,25 @@ arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache tcache_dalloc_small(tsdn_tsd(tsdn), tcache, ptr, szind, slow_path); } else { - arena_dalloc_large(tsdn, ptr, tcache, szind, slow_path); + if (szind < nhbins) { + if (config_prof && unlikely(szind < NBINS)) { + arena_dalloc_promoted(tsdn, ptr, tcache, + slow_path); + } else { + tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr, + szind, slow_path); + } + } else { + extent_t *extent = iealloc(tsdn, ptr); + large_dalloc(tsdn, extent); + } } } static inline void arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_t size) { assert(ptr != NULL); - assert(size <= SC_LARGE_MAXCLASS); + assert(size <= LARGE_MAXCLASS); szind_t szind; bool slab; @@ -337,7 +252,7 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_ * object, so base szind and slab on the given size. */ szind = sz_size2index(size); - slab = (szind < SC_NBINS); + slab = (szind < NBINS); } if ((config_prof && opt_prof) || config_debug) { @@ -349,7 +264,7 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_ (uintptr_t)ptr, true, &szind, &slab); assert(szind == sz_size2index(size)); - assert((config_prof && opt_prof) || slab == (szind < SC_NBINS)); + assert((config_prof && opt_prof) || slab == (szind < NBINS)); if (config_debug) { extent_t *extent = rtree_extent_read(tsdn, @@ -363,7 +278,8 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_ /* Small allocation. */ arena_dalloc_small(tsdn, ptr); } else { - arena_dalloc_large_no_tcache(tsdn, ptr, szind); + extent_t *extent = iealloc(tsdn, ptr); + large_dalloc(tsdn, extent); } } @@ -372,7 +288,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tc alloc_ctx_t *alloc_ctx, bool slow_path) { assert(!tsdn_null(tsdn) || tcache == NULL); assert(ptr != NULL); - assert(size <= SC_LARGE_MAXCLASS); + assert(size <= LARGE_MAXCLASS); if (unlikely(tcache == NULL)) { arena_sdalloc_no_tcache(tsdn, ptr, size); @@ -381,7 +297,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tc szind_t szind; bool slab; - alloc_ctx_t local_ctx; + UNUSED alloc_ctx_t local_ctx; if (config_prof && opt_prof) { if (alloc_ctx == NULL) { /* Uncommon case and should be a static check. */ @@ -402,7 +318,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tc * object, so base szind and slab on the given size. */ szind = sz_size2index(size); - slab = (szind < SC_NBINS); + slab = (szind < NBINS); } if (config_debug) { @@ -420,7 +336,18 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tc tcache_dalloc_small(tsdn_tsd(tsdn), tcache, ptr, szind, slow_path); } else { - arena_dalloc_large(tsdn, ptr, tcache, szind, slow_path); + if (szind < nhbins) { + if (config_prof && unlikely(szind < NBINS)) { + arena_dalloc_promoted(tsdn, ptr, tcache, + slow_path); + } else { + tcache_dalloc_large(tsdn_tsd(tsdn), + tcache, ptr, szind, slow_path); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Nov 11 06:28:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2513E1AC6E2; Mon, 11 Nov 2019 06:28:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BLY606x2z3KZR; Mon, 11 Nov 2019 06:28:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7530B37E; Mon, 11 Nov 2019 06:28:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAB6SPvA004194; Mon, 11 Nov 2019 06:28:25 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAB6SP72004193; Mon, 11 Nov 2019 06:28:25 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911110628.xAB6SP72004193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 11 Nov 2019 06:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354607 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 06:28:26 -0000 Author: glebius Date: Mon Nov 11 06:28:25 2019 New Revision: 354607 URL: https://svnweb.freebsd.org/changeset/base/354607 Log: It is unclear why in6_pcblookup_local() would require write access to the PCB hash. The function doesn't modify the hash. It always asserted write lock historically, but with epoch conversion this fails in some special cases. Reviewed by: rwatson, bz Reported-by: syzbot+0b0488ca537e20cb2429@syzkaller.appspotmail.com Modified: head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Mon Nov 11 05:06:49 2019 (r354606) +++ head/sys/netinet6/in6_pcb.c Mon Nov 11 06:28:25 2019 (r354607) @@ -714,7 +714,7 @@ in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - INP_HASH_WLOCK_ASSERT(pcbinfo); + INP_HASH_LOCK_ASSERT(pcbinfo); if ((lookupflags & INPLOOKUP_WILDCARD) == 0) { struct inpcbhead *head; From owner-svn-src-head@freebsd.org Mon Nov 11 14:48:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 197B41B7248; Mon, 11 Nov 2019 14:48:22 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BYdw4RqWz4Fky; Mon, 11 Nov 2019 14:48:20 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qv1-xf41.google.com with SMTP id cg2so4954901qvb.10; Mon, 11 Nov 2019 06:48:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=FeBJ1V+4kEVanjNv81ggrbYV6j2z+EUIgG7DB4g78o4=; b=TZP0v06W+fhgu8YAgGPflqgkN3tttQJBzNiB/52lnd1bqhwQJUShz749xEKUyt2mP7 Dy5bTlGa6KdeSg4JERxOmpQv5gw/pI4PvzUU31TJsWN/spMX8ZGeldAzPZ1k1JNLCYVf Qd3DHFxVkNM6GfLlXRxpM7KD2XF9NDZG/l0+ce44oBf4z2fTYjnJN4ZnI60Ty/YJi4he +V2CLnIrw4UfX9haA197NWFDl7+EhZkMiBaQdOHkxIgVDRSCRStDQiCmXVUzg6tesi8q NA38pqqdIHCF2HaTnelYgvN4Q4nLm6qsL+wo4r1fenHAtsIUd5fb8UPK6hjRvLfqgJZs d5Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=FeBJ1V+4kEVanjNv81ggrbYV6j2z+EUIgG7DB4g78o4=; b=A3dQ9WwPFhmz6xWf9J03FqU4YkvYBKIxJaV3ciZgX3eeugO0GENkGOy3PwHt3XpqLl sLBbUM0OgHPnhNc68YDhI9DoaHHiTMWxzzXcb1P96LcgL4E7RsGSx+cwoVeX1BrO4IVH bUuR5gMNJsV+b/xGHT2ggas9yhVwxaVAIcte5yvFJUeUGc6dc3fL/koyOHDsV/PEmvmc UiC5+DcqOC5FW0GGfus+JfDGoMbseHvEpQBmwDreJKKZB+mknwnJ74lZGRuQEkpdnz8w VgNuHxn/VCG+KoKnKrdo3KxGc4qeXF+8hVlpHezR6KiDvTDjNw9yU3MrQW3NAKYCXkjz NdJg== X-Gm-Message-State: APjAAAWw1o1SgzlzQFpdU3P+wtpKsMKvno5lYuVLM9lG04oxb3VdlMRT hOUynagcgSrQXdLOdF4BzWhBuEL4 X-Google-Smtp-Source: APXvYqzeVaBtUyvHtG7SMluJZWj3hzTThgIUeRYVWmTUNNPxLB1xI6Qyw9wdfECYC9J2p2oW5hKQ+w== X-Received: by 2002:ad4:57aa:: with SMTP id g10mr24460936qvx.164.1573483693658; Mon, 11 Nov 2019 06:48:13 -0800 (PST) Received: from mbp.home ([2804:f1c:800:fc00:d88:a60c:39d3:b514]) by smtp.gmail.com with ESMTPSA id 76sm8388017qke.111.2019.11.11.06.48.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Nov 2019 06:48:12 -0800 (PST) Sender: Renato Botelho Subject: Re: svn commit: r354149 - head/sys/net To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910291736.x9THa6Gd018030@repo.freebsd.org> <781d285f-0b6d-45f1-f4b4-4bab60b789ae@FreeBSD.org> <20191109041623.GS2195@FreeBSD.org> From: Renato Botelho Autocrypt: addr=garga@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFn4ZqUBCACxJRWi57JkmsCrSU0gZd/CwB+B90OTUeXmF63lDPETOQ+pBA4+vJgzjW1C pv7rR25wxvESJKphxZJOOk9AXTXsg5QrhdP3+KQG/zNcKd2ukbt3ezkhdMx8q81wn4wY2oTl WXdGIVdDKvC8sCp1fc6pPKJin71/skb9wg6ThtlRFlv9en4f8QSVmRuzRKQ6VjCbl+yIpiye /I5BQ4I99uouPzPhzf9ya3cvp4xbiw5wSo1F3nLsThBT2osYy/nRNz2ciuCYyyX87dGhio0T 8Pxl37eBbGQvCGwPQBApCcfoiZBN/5F65Tt4p72gIqT+AYuqq5G7Bhj+fGTC7q0QotL/ABEB AAG0LFJlbmF0byBCb3RlbGhvIChGcmVlQlNEKSA8Z2FyZ2FARnJlZUJTRC5vcmc+iQFXBBMB CgBBAhsDBQkFo5qABQsJCAcDBRUKCQgLBRYDAgEAAh4BAheAFiEExxiLNMqsn7yXmTy7W54E w5ZrhhoFAln4aeUCGQEACgkQW54Ew5ZrhhpTIwf+OS+Gv/ITOy7+8D+8SKXNmkfczsTO+Uqz 6SraXcq32j1C4QcRQCwGPhVJJgKnFSvPm3kbNPFXaQh1zD+mTQ4r/Loc78Rz+fZljYcgNx7n aQKhd9pdpXaELOe+Y10jvGUrT0SE06Y10BP/NmQaLplt9qG8VgLAAB9ZcsuZ9pzbBbQjd9In OK5VcXQzHT/EBBQ1rHsl1Aq8TYdmjbKl+HKc1c8dJ5OfXrgnTIUwQdN1rauXbmH/YW/CKN7z zF59v/sPBTaWfFl2CS/BORhWhe1PBudrVZWFT0oJGNuG6k8dlnssoL/0ojFaN5w5xm8mvMAf uAuixGf4bK6C7hcE34D/ULkBDQRZ+GalAQgApiTibUM0OpeCcxf5YUep4F4y853ClU4TMqZO +ho38sz0GdshQWuBEBqahOtxapHUMtlmC+wJNCBAav5JYjHHrXXE9pgRm5EgVssDpMvplLB4 5CFdx5jBu02Bt9Wp5bD21TPH3rsYJUB3rYmxWfVmdRhNBERrCJu49OIsBSKAlIinx8altYrh Z7bO2C1hKOG6QHWRr4ml4HTD/gZ6TTfsrR+sktBNv/5ZRkcJNDVM+eOGagXkEUOVFe9KXynD 3KcZBbBKpwoaW5GK8OglKJt8ggUfc78CG1xk4b5nL8QCk0CBrC6VPPOYvXTpYSTHmx1QkElm 1iNu1Tc5ccvcyAwTswARAQABiQE8BBgBCgAmFiEExxiLNMqsn7yXmTy7W54Ew5ZrhhoFAln4 ZqUCGwwFCQWjmoAACgkQW54Ew5ZrhhoH3wf+KuIeDyvIJOui+0C5FD5r44Bwkj/SAUVUerfp 0qtRktc+BZoSifPs3Rqjh/PpwRvLTuJnSsiqWLz8NCTThogRzVqEcQHqZR3vOjtYM60sjYJ+ BGQl/bjm1C/YtWEEmKs7mJc+02U8qJA4rbNKSRRRoz6XngnuN6YC0fkeD7c7rxRhOg6OWasZ JinB9+dO1IH7eZ5c97v518qSaLRp0T7I+FpEGOp7tTFHaepZWEnuojr5D6jI1MOEywy0EWJu 3m0TYlh935I8o7gLABqoHEmUeW7JK7r91SZaFnr8zQ6XOAxkPh50uFMTNtNZTnM7k1pRv5Ov fms0VzARITYzTwmpDQ== Message-ID: <8f5c71ce-5dff-a715-79b8-b7e01415a480@FreeBSD.org> Date: Mon, 11 Nov 2019 11:48:09 -0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191109041623.GS2195@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47BYdw4RqWz4Fky X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=TZP0v06W; dmarc=none; spf=pass (mx1.freebsd.org: domain of gargabsd@gmail.com designates 2607:f8b0:4864:20::f41 as permitted sender) smtp.mailfrom=gargabsd@gmail.com X-Spamd-Result: default: False [-3.08 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_NEQ_ENVFROM(0.00)[garga@FreeBSD.org,gargabsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.88)[ipnet: 2607:f8b0::/32(-2.33), asn: 15169(-2.00), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FORGED_SENDER(0.30)[garga@FreeBSD.org,gargabsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 14:48:22 -0000 On 09/11/19 01:16, Gleb Smirnoff wrote: > Renato, > > can you please try out the attached patch? I upgraded to r354607 with the patch applied and the problem is now fixed. Thanks -- Renato Botelho From owner-svn-src-head@freebsd.org Mon Nov 11 16:59:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 782091B98D4; Mon, 11 Nov 2019 16:59:50 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BcYf2XWfz4NS9; Mon, 11 Nov 2019 16:59:50 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A66E1A5ED; Mon, 11 Nov 2019 16:59:50 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xABGxoQd075507; Mon, 11 Nov 2019 16:59:50 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABGxoND075506; Mon, 11 Nov 2019 16:59:50 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201911111659.xABGxoND075506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Mon, 11 Nov 2019 16:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354618 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 16:59:50 -0000 Author: dougm Date: Mon Nov 11 16:59:49 2019 New Revision: 354618 URL: https://svnweb.freebsd.org/changeset/base/354618 Log: swap_pager_meta_free() frees allocated blocks in a way that exploits the sparsity of allocated blocks in a range, without issuing an "are you there?" query for every block in the range. swap_pager_copy() is not so smart. Modify the implementation of swap_pager_meta_free() slightly so that swap_pager_copy() can use that smarter implementation too. Based on an observation of: Yoshihiro Ota (ota_j.email.ne.jp) Reviewed by: kib,alc Tested by: pho Differential Revision: https://reviews.freebsd.org/D22280 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Mon Nov 11 16:11:15 2019 (r354617) +++ head/sys/vm/swap_pager.c Mon Nov 11 16:59:49 2019 (r354618) @@ -422,6 +422,8 @@ static daddr_t swp_pager_getswapspace(int *npages, int */ static daddr_t swp_pager_meta_build(vm_object_t, vm_pindex_t, daddr_t); static void swp_pager_meta_free(vm_object_t, vm_pindex_t, vm_pindex_t); +static void swp_pager_meta_transfer(vm_object_t src, vm_object_t dst, + vm_pindex_t pindex, vm_pindex_t count); static void swp_pager_meta_free_all(vm_object_t); static daddr_t swp_pager_meta_ctl(vm_object_t, vm_pindex_t, int); @@ -933,6 +935,33 @@ swap_pager_reserve(vm_object_t object, vm_pindex_t sta return (0); } +static bool +swp_pager_xfer_source(vm_object_t srcobject, vm_object_t dstobject, + vm_pindex_t pindex, daddr_t addr) +{ + daddr_t dstaddr; + + if (swp_pager_meta_ctl(dstobject, pindex, 0) != SWAPBLK_NONE) { + /* Caller should destroy the source block. */ + return (false); + } + + /* + * Destination has no swapblk and is not resident, transfer source. + * swp_pager_meta_build() can sleep. + */ + vm_object_pip_add(srcobject, 1); + VM_OBJECT_WUNLOCK(srcobject); + vm_object_pip_add(dstobject, 1); + dstaddr = swp_pager_meta_build(dstobject, pindex, addr); + KASSERT(dstaddr == SWAPBLK_NONE, + ("Unexpected destination swapblk")); + vm_object_pip_wakeup(dstobject); + VM_OBJECT_WLOCK(srcobject); + vm_object_pip_wakeup(srcobject); + return (true); +} + /* * SWAP_PAGER_COPY() - copy blocks from source pager to destination pager * and destroy the source. @@ -956,8 +985,6 @@ void swap_pager_copy(vm_object_t srcobject, vm_object_t dstobject, vm_pindex_t offset, int destroysource) { - vm_pindex_t i; - daddr_t dstaddr, n_free, s_free, srcaddr; VM_OBJECT_ASSERT_WLOCKED(srcobject); VM_OBJECT_ASSERT_WLOCKED(dstobject); @@ -984,39 +1011,8 @@ swap_pager_copy(vm_object_t srcobject, vm_object_t dst /* * Transfer source to destination. */ - swp_pager_init_freerange(&s_free, &n_free); - for (i = 0; i < dstobject->size; ++i) { - srcaddr = swp_pager_meta_ctl(srcobject, i + offset, SWM_POP); - if (srcaddr == SWAPBLK_NONE) - continue; - dstaddr = swp_pager_meta_ctl(dstobject, i, 0); - if (dstaddr != SWAPBLK_NONE) { - /* - * Destination has valid swapblk or it is represented - * by a resident page. We destroy the source block. - */ - swp_pager_update_freerange(&s_free, &n_free, srcaddr); - continue; - } + swp_pager_meta_transfer(srcobject, dstobject, offset, dstobject->size); - /* - * Destination has no swapblk and is not resident, - * copy source. - * - * swp_pager_meta_build() can sleep. - */ - vm_object_pip_add(srcobject, 1); - VM_OBJECT_WUNLOCK(srcobject); - vm_object_pip_add(dstobject, 1); - dstaddr = swp_pager_meta_build(dstobject, i, srcaddr); - KASSERT(dstaddr == SWAPBLK_NONE, - ("Unexpected destination swapblk")); - vm_object_pip_wakeup(dstobject); - VM_OBJECT_WLOCK(srcobject); - vm_object_pip_wakeup(srcobject); - } - swp_pager_freeswapspace(s_free, n_free); - /* * Free left over swap blocks in source. * @@ -2003,31 +1999,30 @@ allocated: } /* - * SWP_PAGER_META_FREE() - free a range of blocks in the object's swap metadata + * SWP_PAGER_META_TRANSFER() - free a range of blocks in the srcobject's swap + * metadata, or transfer it into dstobject. * - * The requested range of blocks is freed, with any associated swap - * returned to the swap bitmap. - * * This routine will free swap metadata structures as they are cleaned - * out. This routine does *NOT* operate on swap metadata associated - * with resident pages. + * out. */ static void -swp_pager_meta_free(vm_object_t object, vm_pindex_t pindex, vm_pindex_t count) +swp_pager_meta_transfer(vm_object_t srcobject, vm_object_t dstobject, + vm_pindex_t pindex, vm_pindex_t count) { struct swblk *sb; daddr_t n_free, s_free; - vm_pindex_t last; + vm_pindex_t offset, last; int i, limit, start; - VM_OBJECT_ASSERT_WLOCKED(object); - if (object->type != OBJT_SWAP || count == 0) + VM_OBJECT_ASSERT_WLOCKED(srcobject); + if (srcobject->type != OBJT_SWAP || count == 0) return; swp_pager_init_freerange(&s_free, &n_free); + offset = pindex; last = pindex + count; for (;;) { - sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, + sb = SWAP_PCTRIE_LOOKUP_GE(&srcobject->un_pager.swp.swp_blks, rounddown(pindex, SWAP_META_PAGES)); if (sb == NULL || sb->p >= last) break; @@ -2037,18 +2032,39 @@ swp_pager_meta_free(vm_object_t object, vm_pindex_t pi for (i = start; i < limit; i++) { if (sb->d[i] == SWAPBLK_NONE) continue; - swp_pager_update_freerange(&s_free, &n_free, sb->d[i]); + if (dstobject == NULL || + !swp_pager_xfer_source(srcobject, dstobject, + sb->p + i - offset, sb->d[i])) { + swp_pager_update_freerange(&s_free, &n_free, + sb->d[i]); + } sb->d[i] = SWAPBLK_NONE; } pindex = sb->p + SWAP_META_PAGES; if (swp_pager_swblk_empty(sb, 0, start) && swp_pager_swblk_empty(sb, limit, SWAP_META_PAGES)) { - SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, + SWAP_PCTRIE_REMOVE(&srcobject->un_pager.swp.swp_blks, sb->p); uma_zfree(swblk_zone, sb); } } swp_pager_freeswapspace(s_free, n_free); +} + +/* + * SWP_PAGER_META_FREE() - free a range of blocks in the object's swap metadata + * + * The requested range of blocks is freed, with any associated swap + * returned to the swap bitmap. + * + * This routine will free swap metadata structures as they are cleaned + * out. This routine does *NOT* operate on swap metadata associated + * with resident pages. + */ +static void +swp_pager_meta_free(vm_object_t object, vm_pindex_t pindex, vm_pindex_t count) +{ + swp_pager_meta_transfer(object, NULL, pindex, count); } /* From owner-svn-src-head@freebsd.org Mon Nov 11 17:11:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7EAEB1B9D07; Mon, 11 Nov 2019 17:11:50 +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 47BcqV2gB9z4PMQ; Mon, 11 Nov 2019 17:11:50 +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 3ED931A82E; Mon, 11 Nov 2019 17:11:50 +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 xABHBoFO085242; Mon, 11 Nov 2019 17:11:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABHBogk085241; Mon, 11 Nov 2019 17:11:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911111711.xABHBogk085241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 11 Nov 2019 17:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354619 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 17:11:50 -0000 Author: avg Date: Mon Nov 11 17:11:49 2019 New Revision: 354619 URL: https://svnweb.freebsd.org/changeset/base/354619 Log: db_nextframe/amd64: remove TRAP_INTERRUPT frame type Besides the confusing name, this type is effectively unused. In all cases where it could be set, the INTERRUPT type is set by the earlier code. The conditions for TRAP_INTERRUPT are a subset of the conditions for INTERRUPT. Reviewed by: kib, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22305 Modified: head/sys/amd64/amd64/db_trace.c Modified: head/sys/amd64/amd64/db_trace.c ============================================================================== --- head/sys/amd64/amd64/db_trace.c Mon Nov 11 16:59:49 2019 (r354618) +++ head/sys/amd64/amd64/db_trace.c Mon Nov 11 17:11:49 2019 (r354619) @@ -123,7 +123,6 @@ db_frame(struct db_variable *vp, db_expr_t *valuep, in #define TRAP 1 #define INTERRUPT 2 #define SYSCALL 3 -#define TRAP_INTERRUPT 5 static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread *); static void db_print_stack_entry(const char *, db_addr_t, void *); @@ -218,13 +217,6 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, s else if (strcmp(name, "Xint0x80_syscall") == 0) frame_type = SYSCALL; #endif - /* XXX: These are interrupts with trap frames. */ - else if (strcmp(name, "Xtimerint") == 0 || - strcmp(name, "Xcpustop") == 0 || - strcmp(name, "Xcpususpend") == 0 || - strcmp(name, "Xrendezvous") == 0 || - strcmp(name, "Xipi_intr_bitmap_handler") == 0) - frame_type = TRAP_INTERRUPT; } /* @@ -256,7 +248,6 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, s db_printf("--- syscall"); decode_syscall(tf->tf_rax, td); break; - case TRAP_INTERRUPT: case INTERRUPT: db_printf("--- interrupt"); break; From owner-svn-src-head@freebsd.org Mon Nov 11 17:36:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 076231BA39E; Mon, 11 Nov 2019 17:36:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BdNB67qjz4Qbp; Mon, 11 Nov 2019 17:36:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B18C61AD14; Mon, 11 Nov 2019 17:36:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xABHagV1098936; Mon, 11 Nov 2019 17:36:42 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABHagOD098935; Mon, 11 Nov 2019 17:36:42 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911111736.xABHagOD098935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 11 Nov 2019 17:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354620 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 354620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 17:36:43 -0000 Author: imp Date: Mon Nov 11 17:36:42 2019 New Revision: 354620 URL: https://svnweb.freebsd.org/changeset/base/354620 Log: Fix panic message to indicate right action that was improper. Reviewed by: scottl, ken Differential Revision: https://reviews.freebsd.org/D22295 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:11:49 2019 (r354619) +++ head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:42 2019 (r354620) @@ -1686,7 +1686,7 @@ da_periph_release_locked(struct cam_periph *periph, da da_ref_text[token], token); cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); if (cnt != 1) - panic("Unholding %d with cnt = %d", token, cnt); + panic("releasing (locked) %d with cnt = %d", token, cnt); cam_periph_release_locked(periph); } From owner-svn-src-head@freebsd.org Mon Nov 11 17:36:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5985A1BA3C0; Mon, 11 Nov 2019 17:36:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BdNJ1Qwkz4QgD; Mon, 11 Nov 2019 17:36:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F19861AD15; Mon, 11 Nov 2019 17:36:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xABHal8Y098990; Mon, 11 Nov 2019 17:36:47 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABHalvq098989; Mon, 11 Nov 2019 17:36:47 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911111736.xABHalvq098989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 11 Nov 2019 17:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354621 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 354621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 17:36:48 -0000 Author: imp Date: Mon Nov 11 17:36:47 2019 New Revision: 354621 URL: https://svnweb.freebsd.org/changeset/base/354621 Log: Require and enforce that dareprobe() has to be called with the periph lock held. Reviewed by: scottl, ken Differential Revision: https://reviews.freebsd.org/D22295 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:42 2019 (r354620) +++ head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:47 2019 (r354621) @@ -2133,8 +2133,8 @@ daasync(void *callback_arg, u_int32_t code, "Capacity data has changed\n"); cam_periph_lock(periph); softc->flags &= ~DA_FLAG_PROBED; - cam_periph_unlock(periph); dareprobe(periph); + cam_periph_unlock(periph); } else if (asc == 0x28 && ascq == 0x00) { cam_periph_lock(periph); softc->flags &= ~DA_FLAG_PROBED; @@ -2145,8 +2145,8 @@ daasync(void *callback_arg, u_int32_t code, "INQUIRY data has changed\n"); cam_periph_lock(periph); softc->flags &= ~DA_FLAG_PROBED; - cam_periph_unlock(periph); dareprobe(periph); + cam_periph_unlock(periph); } } break; @@ -5826,6 +5826,8 @@ dareprobe(struct cam_periph *periph) int status; softc = (struct da_softc *)periph->softc; + + cam_periph_assert(periph, MA_OWNED); /* Probe in progress; don't interfere. */ if (softc->state != DA_STATE_NORMAL) From owner-svn-src-head@freebsd.org Mon Nov 11 17:36:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A0B91BA3ED; Mon, 11 Nov 2019 17:36:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BdNP1j7zz4Qpk; Mon, 11 Nov 2019 17:36:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCDC31AD16; Mon, 11 Nov 2019 17:36:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xABHaqps099046; Mon, 11 Nov 2019 17:36:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABHaq30099045; Mon, 11 Nov 2019 17:36:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911111736.xABHaq30099045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 11 Nov 2019 17:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354622 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 354622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 17:36:53 -0000 Author: imp Date: Mon Nov 11 17:36:52 2019 New Revision: 354622 URL: https://svnweb.freebsd.org/changeset/base/354622 Log: Update the softc state of the da driver before releasing the CCB. There are contexts where releasing the ccb triggers dastart() to be run inline. When da was written, there was always a deferral, so it didn't matter much. Now, with direct dispatch, we can call dastart from the dadone* routines. If the probe state isn't updated, then dastart will redo things with stale information. This normally isn't a problem, because we run the probe state machine once at boot... Except that we also run it for each open of the device, which means we can have multiple threads racing each other to try to kick off the probe. However, if we update the state before we release the CCB, we can avoid the race. While it's needed only for the probewp and proberc* states, do it everywhere because it won't hurt the other places. The race here happens because we reprobe dozens of times on boot when drives have lots of partitions. We should consider caching this info for 1-2 seconds to avoid this thundering hurd. Reviewed by: scottl, ken Differential Revision: https://reviews.freebsd.org/D22295 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:47 2019 (r354621) +++ head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:52 2019 (r354622) @@ -4645,11 +4645,11 @@ dadone_probewp(struct cam_periph *periph, union ccb *d } free(csio->data_ptr, M_SCSIDA); - xpt_release_ccb(done_ccb); if ((softc->flags & DA_FLAG_CAN_RC16) != 0) softc->state = DA_STATE_PROBE_RC16; else softc->state = DA_STATE_PROBE_RC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4709,8 +4709,8 @@ dadone_proberc(struct cam_periph *periph, union ccb *d */ if (maxsector == 0xffffffff) { free(rdcap, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_RC16; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4816,8 +4816,8 @@ dadone_proberc(struct cam_periph *periph, union ccb *d cam_periph_assert(periph, MA_OWNED); softc->flags &= ~DA_FLAG_CAN_RC16; free(rdcap, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_RC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4924,14 +4924,14 @@ dadone_proberc(struct cam_periph *periph, union ccb *d dadeleteflag(softc, DA_DELETE_WS10, 1); dadeleteflag(softc, DA_DELETE_UNMAP, 1); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_LBP; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BDC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4988,8 +4988,8 @@ dadone_probelbp(struct cam_periph *periph, union ccb * } free(lbp, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BLK_LIMITS; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -5082,8 +5082,8 @@ dadone_probeblklimits(struct cam_periph *periph, union } free(block_limits, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BDC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -5183,8 +5183,8 @@ dadone_probebdc(struct cam_periph *periph, union ccb * } free(bdc, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_ATA; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -5323,8 +5323,8 @@ dadone_probeata(struct cam_periph *periph, union ccb * continue_probe = 1; } if (continue_probe != 0) { - xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); + xpt_release_ccb(done_ccb); return; } else daprobedone(periph, done_ccb); @@ -5813,8 +5813,8 @@ dadone_tur(struct cam_periph *periph, union ccb *done_ /*timeout*/0, /*getcount_only*/0); } - xpt_release_ccb(done_ccb); softc->flags &= ~DA_FLAG_TUR_PENDING; + xpt_release_ccb(done_ccb); da_periph_release_locked(periph, DA_REF_TUR); return; } From owner-svn-src-head@freebsd.org Mon Nov 11 17:36:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEE0A1BA43C; Mon, 11 Nov 2019 17:36:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BdNT5Nvcz4QvP; Mon, 11 Nov 2019 17:36:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 830C41AD17; Mon, 11 Nov 2019 17:36:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xABHavl5099102; Mon, 11 Nov 2019 17:36:57 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABHavhQ099101; Mon, 11 Nov 2019 17:36:57 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911111736.xABHavhQ099101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 11 Nov 2019 17:36:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354623 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 354623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 17:36:58 -0000 Author: imp Date: Mon Nov 11 17:36:57 2019 New Revision: 354623 URL: https://svnweb.freebsd.org/changeset/base/354623 Log: Add asserts for some state transitions For the PROBEWP and PROBERC* states, add assertiosn that both the da device state is in the right state, as well as the ccb state is the right one when we enter dadone_probe{wp,rc}. This will ensure that we don't sneak through when we're re-probing the size and write protection status of the device and thereby leak a reference which can later lead to an invalidated peripheral going away before all references are released (and resulting panic). Reviewed by: scottl, ken Differential Revision: https://reviews.freebsd.org/D22295 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:52 2019 (r354622) +++ head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:57 2019 (r354623) @@ -4613,6 +4613,14 @@ dadone_probewp(struct cam_periph *periph, union ccb *d cam_periph_assert(periph, MA_OWNED); + KASSERT(softc->state == DA_STATE_PROBE_WP, + ("State (%d) not PROBE_WP in dadone_probewp, periph %p ccb %p", + softc->state, periph, done_ccb)); + KASSERT((csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) == DA_CCB_PROBE_WP, + ("CCB State (%lu) not PROBE_WP in dadone_probewp, periph %p ccb %p", + (unsigned long)csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK, periph, + done_ccb)); + if (softc->minimum_cmd_size > 6) { mode_hdr10 = (struct scsi_mode_header_10 *)csio->data_ptr; dev_spec = mode_hdr10->dev_spec; @@ -4672,6 +4680,13 @@ dadone_proberc(struct cam_periph *periph, union ccb *d priority = done_ccb->ccb_h.pinfo.priority; csio = &done_ccb->csio; state = csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK; + + KASSERT(softc->state == DA_STATE_PROBE_RC || softc->state == DA_STATE_PROBE_RC16, + ("State (%d) not PROBE_RC* in dadone_proberc, periph %p ccb %p", + softc->state, periph, done_ccb)); + KASSERT(state == DA_CCB_PROBE_RC || state == DA_CCB_PROBE_RC16, + ("CCB State (%lu) not PROBE_RC* in dadone_probewp, periph %p ccb %p", + (unsigned long)state, periph, done_ccb)); lbp = 0; rdcap = NULL; From owner-svn-src-head@freebsd.org Mon Nov 11 17:41:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 437161BA626; Mon, 11 Nov 2019 17:41:53 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BdV9121Tz4RRX; Mon, 11 Nov 2019 17:41:53 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07DB11AE99; Mon, 11 Nov 2019 17:41:53 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xABHfqKt001825; Mon, 11 Nov 2019 17:41:52 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABHfqth001824; Mon, 11 Nov 2019 17:41:52 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201911111741.xABHfqth001824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 11 Nov 2019 17:41:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354624 - head/usr.bin/tip/tip X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/usr.bin/tip/tip X-SVN-Commit-Revision: 354624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 17:41:53 -0000 Author: vangyzen Date: Mon Nov 11 17:41:52 2019 New Revision: 354624 URL: https://svnweb.freebsd.org/changeset/base/354624 Log: tip/cu: check for EOF on input on the local side If cu reads an EOF on the input side, it goes into a tight loop sending a garbage byte to the remote. With this change, it exits gracefully, along with its child. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/usr.bin/tip/tip/tip.c Modified: head/usr.bin/tip/tip/tip.c ============================================================================== --- head/usr.bin/tip/tip/tip.c Mon Nov 11 17:36:57 2019 (r354623) +++ head/usr.bin/tip/tip/tip.c Mon Nov 11 17:41:52 2019 (r354624) @@ -252,7 +252,6 @@ cucommon: tipin(); else tipout(); - /*NOTREACHED*/ exit(0); } @@ -402,11 +401,16 @@ tipin(void) } while (1) { - gch = getchar()&STRIP_PAR; - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; if ((gch == character(value(ESCAPE))) && bol) { if (!noesc) { - if (!(gch = escape())) + gch = escape(); + if (gch == EOF) + return; + if (gch == 0) continue; } } else if (!cumode && gch == character(value(RAISECHAR))) { @@ -420,7 +424,10 @@ tipin(void) printf("\r\n"); continue; } else if (!cumode && gch == character(value(FORCE))) - gch = getchar()&STRIP_PAR; + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; bol = any(gch, value(EOL)); if (boolean(value(RAISE)) && islower(gch)) gch = toupper(gch); @@ -444,8 +451,10 @@ escape(void) esctable_t *p; char c = character(value(ESCAPE)); - gch = (getchar()&STRIP_PAR); - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return (EOF); + gch = gch & STRIP_PAR; for (p = etable; p->e_char; p++) if (p->e_char == gch) { if ((p->e_flags&PRIV) && uid) From owner-svn-src-head@freebsd.org Mon Nov 11 17:41:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F08A71BA646; Mon, 11 Nov 2019 17:41:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BdVD6CBdz4RTW; Mon, 11 Nov 2019 17:41:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9A311AEA1; Mon, 11 Nov 2019 17:41:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xABHfuqE001877; Mon, 11 Nov 2019 17:41:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABHfuhF001875; Mon, 11 Nov 2019 17:41:56 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911111741.xABHfuhF001875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 11 Nov 2019 17:41:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354625 - head/contrib/libc++/include X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/libc++/include X-SVN-Commit-Revision: 354625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 17:41:57 -0000 Author: dim Date: Mon Nov 11 17:41:56 2019 New Revision: 354625 URL: https://svnweb.freebsd.org/changeset/base/354625 Log: Merge commit 371ea70bb from llvm git (by Louis Dionne): [libc++] Harden usage of static_assert against C++03 In C++03, we emulate static_assert with a macro, and we must parenthesize multiple arguments. llvm-svn: 373328 This is a follow-up to r354460, which causes errors for pre-C++11 programs using , similar to: /usr/include/c++/v1/cmath:622:68: error: too many arguments provided to function-like macro invocation Reported by: antoine MFC after: immediately (because of ports breakage) Modified: head/contrib/libc++/include/cmath Modified: head/contrib/libc++/include/cmath ============================================================================== --- head/contrib/libc++/include/cmath Mon Nov 11 17:41:52 2019 (r354624) +++ head/contrib/libc++/include/cmath Mon Nov 11 17:41:56 2019 (r354625) @@ -644,8 +644,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_fl static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); static_assert(is_integral<_IntT>::value, "must be an integral type"); static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); - static_assert(_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value - || _IsSame<_FloatT,long double>::value, "unsupported floating point type"); + static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value + || _IsSame<_FloatT,long double>::value), "unsupported floating point type"); return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); } From owner-svn-src-head@freebsd.org Mon Nov 11 19:06:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B3171BC18C; Mon, 11 Nov 2019 19:06:05 +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 47BgMK0kz8z4XpD; Mon, 11 Nov 2019 19:06:05 +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 F0CCA1BDBC; Mon, 11 Nov 2019 19:06:04 +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 xABJ643P053968; Mon, 11 Nov 2019 19:06:04 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABJ64jM053967; Mon, 11 Nov 2019 19:06:04 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911111906.xABJ64jM053967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 11 Nov 2019 19:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354627 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 354627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 19:06:05 -0000 Author: avg Date: Mon Nov 11 19:06:04 2019 New Revision: 354627 URL: https://svnweb.freebsd.org/changeset/base/354627 Log: db_nextframe/i386: reduce the number of special frame types This change removes TRAP_INTERRUPT and TRAP_TIMERINT frame types. Their names are a bit confusing: trap + interrupt, what is that? The TRAP_TIMERINT name is too specific -- can it only be used for timer "trap-interrupts"? What is so special about them? My understanding of the code is that INTERRUPT, TRAP_INTERRUPT and TRAP_TIMERINT differ only in how an offset from callee's frame pointer to a trap frame on the stack is calculated. And that depends on a number of arguments that a special handler passes to a callee (a function with a normal C calling convention). So, this change makes that logic explicit and collapses all interrupt frame types into the INTERRUPT type. Reviewed by: markj Discussed with: kib, jhb MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D22303 Modified: head/sys/i386/i386/db_trace.c Modified: head/sys/i386/i386/db_trace.c ============================================================================== --- head/sys/i386/i386/db_trace.c Mon Nov 11 17:45:06 2019 (r354626) +++ head/sys/i386/i386/db_trace.c Mon Nov 11 19:06:04 2019 (r354627) @@ -191,8 +191,6 @@ db_ss(struct db_variable *vp, db_expr_t *valuep, int o #define INTERRUPT 2 #define SYSCALL 3 #define DOUBLE_FAULT 4 -#define TRAP_INTERRUPT 5 -#define TRAP_TIMERINT 6 static void db_nextframe(struct i386_frame **, db_addr_t *, struct thread *); static int db_numargs(struct i386_frame *); @@ -299,6 +297,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st { struct trapframe *tf; int frame_type; + int narg; int eip, esp, ebp; db_expr_t offset; c_db_sym_t sym; @@ -317,6 +316,15 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st * actually made the call. */ frame_type = NORMAL; + + /* + * This is the number of arguments that a syscall / trap / interrupt + * service routine passes to its callee. This number is used only for + * special frame types. In most cases there is one argument: the trap + * frame address. + */ + narg = 1; + if (eip >= PMAP_TRM_MIN_ADDRESS) { sym = db_search_symbol(eip - 1 - setidt_disp, DB_STGY_ANY, &offset); @@ -329,20 +337,24 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st strcmp(name, "fork_trampoline") == 0) frame_type = TRAP; else if (strncmp(name, "Xatpic_intr", 11) == 0 || - strncmp(name, "Xapic_isr", 9) == 0) + strncmp(name, "Xapic_isr", 9) == 0) { + /* Additional argument: vector number. */ + narg = 2; frame_type = INTERRUPT; - else if (strcmp(name, "Xlcall_syscall") == 0 || + } else if (strcmp(name, "Xlcall_syscall") == 0 || strcmp(name, "Xint0x80_syscall") == 0) frame_type = SYSCALL; else if (strcmp(name, "dblfault_handler") == 0) frame_type = DOUBLE_FAULT; - /* XXX: These are interrupts with trap frames. */ else if (strcmp(name, "Xtimerint") == 0) - frame_type = TRAP_TIMERINT; + frame_type = INTERRUPT; else if (strcmp(name, "Xcpustop") == 0 || strcmp(name, "Xrendezvous") == 0 || - strcmp(name, "Xipi_intr_bitmap_handler") == 0) - frame_type = TRAP_INTERRUPT; + strcmp(name, "Xipi_intr_bitmap_handler") == 0) { + /* No arguments. */ + narg = 0; + frame_type = INTERRUPT; + } } /* @@ -375,14 +387,11 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st /* * Point to base of trapframe which is just above the - * current frame. + * current frame. Note that struct i386_frame already accounts for one + * argument. */ - if (frame_type == INTERRUPT) - tf = (struct trapframe *)((int)*fp + 16); - else if (frame_type == TRAP_INTERRUPT) - tf = (struct trapframe *)((int)*fp + 8); - else - tf = (struct trapframe *)((int)*fp + 12); + tf = (struct trapframe *)((char *)*fp + sizeof(struct i386_frame) + + 4 * (narg - 1)); esp = get_esp(tf); eip = tf->tf_eip; @@ -395,8 +404,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st db_printf("--- syscall"); decode_syscall(tf->tf_eax, td); break; - case TRAP_TIMERINT: - case TRAP_INTERRUPT: case INTERRUPT: db_printf("--- interrupt"); break; @@ -407,8 +414,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st switch (frame_type) { case TRAP: - case TRAP_TIMERINT: - case TRAP_INTERRUPT: case INTERRUPT: if ((tf->tf_eflags & PSL_VM) != 0 || (tf->tf_cs & SEL_RPL_MASK) != 0) @@ -418,7 +423,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st ebp = 0; break; } - + *ip = (db_addr_t) eip; *fp = (struct i386_frame *) ebp; } From owner-svn-src-head@freebsd.org Mon Nov 11 20:16:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AE1A1BD8E4; Mon, 11 Nov 2019 20:16:11 +0000 (UTC) (envelope-from Alexander@leidinger.net) Received: from mailgate.Leidinger.net (mailgate.leidinger.net [IPv6:2a00:1828:2000:313::1:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47BhwB39xMz4cQT; Mon, 11 Nov 2019 20:16:10 +0000 (UTC) (envelope-from Alexander@leidinger.net) Received: from outgoing.leidinger.net (p5B1659D6.dip0.t-ipconnect.de [91.22.89.214]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (Client did not present a certificate) by mailgate.Leidinger.net (Postfix) with ESMTPSA id 2AC2325E; Mon, 11 Nov 2019 21:16:02 +0100 (CET) Received: from webmail.leidinger.net (webmail.Leidinger.net [IPv6:fd73:10c7:2053:1::3:102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by outgoing.leidinger.net (Postfix) with ESMTPS id 3FEE1A6AC; Mon, 11 Nov 2019 21:15:59 +0100 (CET) Received: (from www@localhost) by webmail.leidinger.net (8.15.2/8.14.4/Submit) id xABKFxRX024524; Mon, 11 Nov 2019 21:15:59 +0100 (CET) (envelope-from Alexander@leidinger.net) X-Authentication-Warning: webmail.leidinger.net: www set sender to Alexander@leidinger.net using -f Received: from [::ffff:192.168.1.28] ([::ffff:192.168.1.28]) by webmail.leidinger.net (Horde Framework) with HTTPS; Mon, 11 Nov 2019 21:15:59 +0100 Date: Mon, 11 Nov 2019 21:15:59 +0100 Message-ID: <20191111211559.Horde.WORqkr_xMQfIqIWKvR_jExq@webmail.leidinger.net> From: Alexander Leidinger To: Edward Tomasz =?utf-8?b?TmFwaWVyYcWCYQ==?= Cc: Conrad Meyer , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r354458 - head/libexec/rc/rc.d References: <201911071815.xA7IFOhI070066@repo.freebsd.org> <20191109204958.Horde.B0ynnS_aur1OZimnDNObsAt@webmail.leidinger.net> <20191110160819.GA1095@brick> <20191110202504.GA1070@brick> In-Reply-To: <20191110202504.GA1070@brick> User-Agent: Horde Application Framework 5 Accept-Language: de,en Content-Type: multipart/signed; boundary="=_CyBMCs-XY3xwmagdr6GcldL"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 47BhwB39xMz4cQT X-Spamd-Bar: ------- X-Spamd-Result: default: False [-7.82 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[leidinger.net:s=outgoing-alex]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; XAW_SERVICE_ACCT(1.00)[]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[leidinger.net:+]; DMARC_POLICY_ALLOW(-0.50)[leidinger.net,quarantine]; SIGNED_PGP(-2.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[214.89.22.91.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:34240, ipnet:2a00:1828::/32, country:DE]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-3.72)[ip: (-9.81), ipnet: 2a00:1828::/32(-4.90), asn: 34240(-3.90), country: DE(-0.01)] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 20:16:11 -0000 This message is in MIME format and has been PGP signed. --=_CyBMCs-XY3xwmagdr6GcldL Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Quoting Edward Tomasz Napiera=C5=82a (from Sun, 10 Nov= =20=20 2019=2020:25:04 +0000): > On 1110T1147, Conrad Meyer wrote: >> I am on board with making this stuff more =E2=80=9Cbatteries included=E2= =80=9D and usable >> by default, but just echoing the request for configurable knobs (I don= =E2=80=99t >> care about the defaults). > > My point is... well, there are two. First is, it's configurable already: > you can comment out parts of the rc script you don't want, or you can not We want to have the system rc scripts "no touch" scripts, don't we? > set linux_enable in the first place and do things it would otherwise do > for you by in the usual manner - add the modules to loader.conf, add a > line to sysctl.conf etc. The script simply provides a shortcut to match > what 90% of users want. I agree. > Second, in order to implement something properly, I need to understand > how it's going to be used. I guess I worded it quite badly in the > previous mail; it's wasn't supposed to sound like "Can you give me some > use case because I think you're wrong", but rather a "Can you give me > some use case, because without it I have no idea how to design it to > fit it". What about a config variable which enables or disables the mounts?=20=20 That=20way we don't have to modify the rc script to get back to the old=20= =20 behavior=20in cases were we need it. Bye, Alexander. --=20 http://www.Leidinger.net=20Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF --=_CyBMCs-XY3xwmagdr6GcldL Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJdycF+AAoJEBINsJsD+NiGkaIQAIuUIkZCbtPhgnzZhEJrtetH dUESv//sKe704Dy3kA5AEBxqiMyo29spY3+7TKiYqg5YvkCt7AbOBjnCxFoafQ9W rXuy66JSw65wBCvro58YTbL3JgU2gMxrLw227QNNmKOvNtXhIRnFa2c1CA/4rT7B yh67TbUZcV5j9RPvGyC/tgAmwjTJrZiYLzcwBM5jgjs4D/mqSKNxRM2ej2i9Xjaw cXuMaAKLNgk8o0K4Jylvgl0MGbp/VUkYGQkCV9Ne0+HP5ighE4SjORA3Fkd3H7qU ycZer1jFzoufnIaL842ir+H94O/zIZpCLSxl0GtfsmcrIhB6mtWVj1Djkx0VNoRi 5af7WBwc3nzVmCgNqDJ42Tp2VDNydHvuVYzruJRw4G66nLAqI/NaOLSk6BPPE+tk TV7bu4OnqaJsrZoxz4w4epYCeTDLb0ZJ6wzfuXO4+MWs3g8IWuNjQ4773naBsbKN X9ZMSYSAR9x2t+lpQ1gsa9EAYe6LCyvVrlIhVZfzSQ7AhKf/gplZE0ju5PiMdHjj OOOI4ZH5MGaQf+5SV4Fxja6kt01ImrlvlwuYNaVLujYsrEKhoKh7Y9pyTVmcb2MF 9r3+ehvqFRc3cYShjz3h+TRKF+prtbmdgfFCeIIZIGj0wGIKXAnv30HIru0FtHZR bqrGjRzU8HQsOhtXCbJL =X0dj -----END PGP SIGNATURE----- --=_CyBMCs-XY3xwmagdr6GcldL-- From owner-svn-src-head@freebsd.org Mon Nov 11 20:44:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A416A1BE2D9; Mon, 11 Nov 2019 20:44:31 +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 47BjXv3s6vz4dt3; Mon, 11 Nov 2019 20:44:31 +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 68C8C1CFFE; Mon, 11 Nov 2019 20:44:31 +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 xABKiVV1013095; Mon, 11 Nov 2019 20:44:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABKiV82013094; Mon, 11 Nov 2019 20:44:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911112044.xABKiV82013094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 11 Nov 2019 20:44:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354629 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 20:44:31 -0000 Author: markj Date: Mon Nov 11 20:44:30 2019 New Revision: 354629 URL: https://svnweb.freebsd.org/changeset/base/354629 Log: Fix handling of PIPE_EOF in the direct write path. Suppose a writing thread has pinned its pages and gone to sleep with pipe_map.cnt > 0. Suppose that the thread is woken up by a signal (so error != 0) and the other end of the pipe has simultaneously been closed. In this case, to satisfy the assertion about pipe_map.cnt in pipe_destroy_write_buffer(), we must mark the buffer as empty. Reported by: syzbot+5cce271bf2cb1b1e1876@syzkaller.appspotmail.com Reviewed by: kib Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22261 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Mon Nov 11 19:54:08 2019 (r354628) +++ head/sys/kern/sys_pipe.c Mon Nov 11 20:44:30 2019 (r354629) @@ -970,15 +970,8 @@ retry: goto error1; } - while (wpipe->pipe_map.cnt != 0) { - if (wpipe->pipe_state & PIPE_EOF) { - wpipe->pipe_map.cnt = 0; - pipe_destroy_write_buffer(wpipe); - pipeselwakeup(wpipe); - pipeunlock(wpipe); - error = EPIPE; - goto error1; - } + while (wpipe->pipe_map.cnt != 0 && + (wpipe->pipe_state & PIPE_EOF) == 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; wakeup(wpipe); @@ -993,12 +986,16 @@ retry: break; } - if (wpipe->pipe_state & PIPE_EOF) + if ((wpipe->pipe_state & PIPE_EOF) != 0) { + wpipe->pipe_map.cnt = 0; + pipe_destroy_write_buffer(wpipe); + pipeselwakeup(wpipe); error = EPIPE; - if (error == EINTR || error == ERESTART) + } else if (error == EINTR || error == ERESTART) { pipe_clone_write_buffer(wpipe); - else + } else { pipe_destroy_write_buffer(wpipe); + } pipeunlock(wpipe); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0, ("pipe %p leaked PIPE_DIRECTW", wpipe)); From owner-svn-src-head@freebsd.org Mon Nov 11 20:49:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C26E91BE448 for ; Mon, 11 Nov 2019 20:49:09 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47BjfF2Xqcz4f6f for ; Mon, 11 Nov 2019 20:49:09 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1573505347; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=I1apb/62Ni0XxHsx1qPRZcvEK2MVz1vpA919yAINPDwWXfx/uMiOHa7+vFuKnnoyf5jHWeZI3WFsD uAcMJ8ieqdw4QigGoVCfGZg7n8SHMUC2gdCyCU7awVW+e6Fdb1dH1dVdDmzOTckNPBv+0GC1vNA1qI HYsZdAKNGZ+JhEaHliepC2uUS5iZCDPfsZp8bTJv1qFEGycA0+dz3wGJ4STiWIPT4JLcW1/YSLWVtk fe113Tvo6LZp1HYYBnx8MJJlOziDNNXkYBJxWgWZwvaNAtRUYXr03vW5BvI2jNpbsxTy0RwmaAx3RG Vyfc8JEsH/l2Txz7k6O6FBrpbPlk4pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=JBDnBl7GfYvQ+RQ2X8E6Q9R8/o3B4zoO0R6YC4/jCAI=; b=KBC/ZfY+u2JML4nKPqxcEjOjPK9jC8tJXhl1oBQQM9ywhY3SumrN06S4k276UvVEuYw3LcogpAR5W HPAE5pnVnsJUYQRIt+bUSG+8vG/GMrWke8uXFRkWyykzkFNFe0CvSE0Bi5lmoci3/y0E0uw98nUXU0 4jbcD9sV1Mfw0LPEYZnrvgTRg+4O7GF4BDdBl+4YzB+3dMh4E5JWDjdatpk/bfwLrQvJf4vIFVA1hw xOKv1HTb0N82wFYLEf6l0MwOfzxTwWbZ8fio3JFvVX6eRwiGxeMe0ZTcYLdkr4RNKG9UY1FyKoZMGY aydjwW8KEXD02sXtL42LBxvTRMtEKfg== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=JBDnBl7GfYvQ+RQ2X8E6Q9R8/o3B4zoO0R6YC4/jCAI=; b=OqdR8s2TLEkyJeb8oflqaij9R0k58uKft0Nl3GY/jUNw5vfoR7Il5Ci11BBrzfWKDovwiPWbWqKmS rww5cDtDVrfWrhs+3ORZyLOLmuOM68gjQVvx1avDxyktWvzd9PMLWDWzdRGH9AMMdMEbHUG/EEKeOT l/jC6wWQdMHlZvJ83vPfgooempB59sU9J9LBcoDLHxs9950bc/7OAh82KFqzNM5B9fRl2dyYxniJC+ YXy3FvrXJJBZgz3+LfldGt8fYlXBC4lks858+DuXrgfTdLY04V6sOazvgsO4fbxGk3eDhXpAo1ELVa VWQN7jl1hsiKp4qdduGUvnxZ8t92T0Q== X-MHO-RoutePath: aGlwcGll X-MHO-User: b1e62bc7-04c4-11ea-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id b1e62bc7-04c4-11ea-829e-79a40d15cccd; Mon, 11 Nov 2019 20:49:05 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xABKn3EF016510; Mon, 11 Nov 2019 13:49:03 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r354458 - head/libexec/rc/rc.d From: Ian Lepore To: Edward Tomasz Napierala , Alexander Leidinger Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 11 Nov 2019 13:49:03 -0700 In-Reply-To: <20191110160819.GA1095@brick> References: <201911071815.xA7IFOhI070066@repo.freebsd.org> <20191109204958.Horde.B0ynnS_aur1OZimnDNObsAt@webmail.leidinger.net> <20191110160819.GA1095@brick> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47BjfF2Xqcz4f6f X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.94 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.94)[-0.939,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 20:49:09 -0000 On Sun, 2019-11-10 at 16:08 +0000, Edward Tomasz Napierala wrote: > On 1109T2049, Alexander Leidinger wrote: > > Quoting Edward Tomasz Napierala (from Thu, 7 > > Nov > > 2019 18:15:24 +0000 (UTC)): > > > > > Author: trasz > > > Date: Thu Nov 7 18:15:24 2019 > > > New Revision: 354458 > > > URL: https://svnweb.freebsd.org/changeset/base/354458 > > > > > > Log: > > > Extend the linux rc script to mount the neccessary file > > > systems, > > > set ELF fallback brand, and load pty(4). > > > > We never did something like that. We have it documented > > everywhere > > that it needs to be done manually. So this is at least a POLA > > violation. It is great that the nocover option is used in the > > mount, > > but it's still some kind of layering violation (I may want to > > have > > only a subset mounted, or nothing at all). > > It is kind of a POLA violation, but previously the linux_enable > knob didn't do much apart from loading the linux{,64}.ko kernel > module and doing something weird with ldconfig, which I'm not > even sure is actually useful. In other words, the old behaviour > can be restored by just not using linux_enable, and instead > loading the kernel modules the same way all the others are loaded. > > Could you give me some use case why someone would want only a subset > of the filesystems? > Well, there's my use case, where the subset of those filesystems that I want mounted is: none of them. The apps I use under the linuxlator work fine without having a single one of those filesystems mounted, and I don't want something to start mounting them for me when I don't even need them. -- Ian From owner-svn-src-head@freebsd.org Mon Nov 11 21:59:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FEC61BF791; Mon, 11 Nov 2019 21:59:21 +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 47BlCF281wz3Drf; Mon, 11 Nov 2019 21:59:21 +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 2CFE11DCB7; Mon, 11 Nov 2019 21:59:21 +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 xABLxLSA054438; Mon, 11 Nov 2019 21:59:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABLxLOS054437; Mon, 11 Nov 2019 21:59:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911112159.xABLxLOS054437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 11 Nov 2019 21:59:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354630 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 21:59:21 -0000 Author: kib Date: Mon Nov 11 21:59:20 2019 New Revision: 354630 URL: https://svnweb.freebsd.org/changeset/base/354630 Log: amd64: Issue MFENCE on context switch on AMD CPUs when reusing address space. On some AMD CPUs, in particular, machines that do not implement CLFLUSHOPT but do provide CLFLUSH, the CLFLUSH instruction is only synchronized with MFENCE. Code using CLFLUSH typicall needs to brace it with MFENCE both before and after flush, see for instance pmap_invalidate_cache_range(). If context switch occurs while inside the protected region, we need to ensure visibility of flushes done on the old CPU, to new CPU. For all other machines, locked operation done to lock switched thread, should be enough. For case of different address spaces, reload of %cr3 is serializing. Reviewed by: cem, jhb, scottph Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22007 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Nov 11 20:44:30 2019 (r354629) +++ head/sys/amd64/amd64/pmap.c Mon Nov 11 21:59:20 2019 (r354630) @@ -8810,8 +8810,11 @@ pmap_activate_sw(struct thread *td) oldpmap = PCPU_GET(curpmap); pmap = vmspace_pmap(td->td_proc->p_vmspace); - if (oldpmap == pmap) + if (oldpmap == pmap) { + if (cpu_vendor_id != CPU_VENDOR_INTEL) + mfence(); return; + } cpuid = PCPU_GET(cpuid); #ifdef SMP CPU_SET_ATOMIC(cpuid, &pmap->pm_active); From owner-svn-src-head@freebsd.org Mon Nov 11 22:11:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF40F1BFB7B; Mon, 11 Nov 2019 22:11:44 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BlTW5bm3z3Ffx; Mon, 11 Nov 2019 22:11:43 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr1-x429.google.com with SMTP id i10so16345260wrs.7; Mon, 11 Nov 2019 14:11:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=24FeQbWcuBdtlD+2Iyx4H3BZhnDz5RsqcRTGR+Lt7JI=; b=PW38d6fjADky0UJY7NJ5cE41kKCkfyHP5a/mOxuMYTeiWJ+OeANO8nvw4qwESciwHb 3cOfuItZI7xXUY1hBKSPz7z2j7gclRwfuFtcX6xNp6DEdeiGJ+SwUYB1abyyBzdrUfTd YdxOYjWKOzNXC0Vs4xD0lKbtcqJXgQmDIARlkQmxkMEjT9qDdpgPbSq/kbGwkt+3+tBB DsVOrkbOAkIGHPE3HTyagGMKl/GfxdilxyLVpPTuYLRZ4mWyDe8qrcxCsXY7cPeLpxAJ FD427KA5RJF5wP58Ny37duAObLw+IDn1ZTehxEiTHNjwKnlKGKtnU8SVYzF5ZHVrNtpc dxmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=24FeQbWcuBdtlD+2Iyx4H3BZhnDz5RsqcRTGR+Lt7JI=; b=P9qYANUWZv0u5AXUXNzWI/sn62GQxAe5sA24o8fQhJR4sZDpFd7wWea+Vu6Wml1gNE EYrVEcPKwSk5CFvW/oxdZr5k4AUljpktwbC8Z1jP+jUc0OBUvnB3Jm6+HfACrC3Pzr9V 1O5G+FdrfKbk4Vr8qK4/vhVoExLQwd0sHiGnLyH96b1BvHROKq/j5vrjTVWC625ac+80 HY3kfFDpuAi2Ip/b6l7eSx6PDYbjEI6/fsmqTyvwgX24DRfFQ1v/VfvJB8b7PNKo0afM O/Fgl8Dy0vN1CsLPqkM2pWwbUBCOPabz2unuv/BqRgiTKg+3HT8vSAJ4lGHbp4qd/IP7 0CQg== X-Gm-Message-State: APjAAAUlMoNSwhkM9qTN9tJJ5PaMIkxhC8F050fFmv5DUFkTWUZQmPkO tSDmHeNcGt09X1hMuVS9BRQ= X-Google-Smtp-Source: APXvYqw3prWK40rqiAWYb//oefjcDlZGB3bUjdi59Gi/06XC3lugdu0UQYtJvd/zph6sT8UmXjFgXQ== X-Received: by 2002:adf:e881:: with SMTP id d1mr7927273wrm.296.1573510301577; Mon, 11 Nov 2019 14:11:41 -0800 (PST) Received: from brick (cpc92302-cmbg19-2-0-cust461.5-4.cable.virginm.net. [82.1.209.206]) by smtp.gmail.com with ESMTPSA id a5sm17939557wrv.56.2019.11.11.14.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2019 14:11:40 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Mon, 11 Nov 2019 22:11:38 +0000 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Alexander Leidinger Cc: Conrad Meyer , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r354458 - head/libexec/rc/rc.d Message-ID: <20191111221138.GA1111@brick> Mail-Followup-To: Alexander Leidinger , Conrad Meyer , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org References: <201911071815.xA7IFOhI070066@repo.freebsd.org> <20191109204958.Horde.B0ynnS_aur1OZimnDNObsAt@webmail.leidinger.net> <20191110160819.GA1095@brick> <20191110202504.GA1070@brick> <20191111211559.Horde.WORqkr_xMQfIqIWKvR_jExq@webmail.leidinger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191111211559.Horde.WORqkr_xMQfIqIWKvR_jExq@webmail.leidinger.net> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47BlTW5bm3z3Ffx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=PW38d6fj; dmarc=none; spf=pass (mx1.freebsd.org: domain of etnapierala@gmail.com designates 2a00:1450:4864:20::429 as permitted sender) smtp.mailfrom=etnapierala@gmail.com X-Spamd-Result: default: False [-4.52 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[9.2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.82)[ip: (-9.31), ipnet: 2a00:1450::/32(-2.75), asn: 15169(-2.00), country: US(-0.05)]; FORGED_SENDER(0.30)[trasz@freebsd.org,etnapierala@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[206.209.1.82.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[trasz@freebsd.org,etnapierala@gmail.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 22:11:45 -0000 On 1111T2115, Alexander Leidinger wrote: > Quoting Edward Tomasz Napierała (from Sun, 10 Nov > 2019 20:25:04 +0000): > > > On 1110T1147, Conrad Meyer wrote: > > >> I am on board with making this stuff more “batteries included” and usable > >> by default, but just echoing the request for configurable knobs (I don’t > >> care about the defaults). > > > > My point is... well, there are two. First is, it's configurable already: > > you can comment out parts of the rc script you don't want, or you can not > > We want to have the system rc scripts "no touch" scripts, don't we? I don't quite agree, but I'm not going to fight for it. > > set linux_enable in the first place and do things it would otherwise do > > for you by in the usual manner - add the modules to loader.conf, add a > > line to sysctl.conf etc. The script simply provides a shortcut to match > > what 90% of users want. > > I agree. > > > Second, in order to implement something properly, I need to understand > > how it's going to be used. I guess I worded it quite badly in the > > previous mail; it's wasn't supposed to sound like "Can you give me some > > use case because I think you're wrong", but rather a "Can you give me > > some use case, because without it I have no idea how to design it to > > fit it". > > What about a config variable which enables or disables the mounts? > That way we don't have to modify the rc script to get back to the old > behavior in cases were we need it. Okay, this is easy to do; see https://reviews.freebsd.org/D22320. From owner-svn-src-head@freebsd.org Mon Nov 11 22:12:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFADF1BFBF3; Mon, 11 Nov 2019 22:12:30 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BlVQ56hfz3FrJ; Mon, 11 Nov 2019 22:12:30 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm1-x343.google.com with SMTP id a17so885275wmb.0; Mon, 11 Nov 2019 14:12:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=FkoGT9EUOfElAMOvQBaacrRPtvKb0up1asKh4dpvGTQ=; b=CkSx508+fcX5fiXCG0KUMc6fEDe7z9xjRvw9DoehVSYniOicgZVAPamgM4FuOL5p19 jFtrEpNlalotMzap0sonuRep0zPuY1rmR7vt2Xg0YoSEZsIGU01tfgU8GgFBfNjXWanN 6l4J5tqETFQwSVLz8j5lh1j/saF8NLuy6A4J6nBbmC05R658CUxyms5V9YFBz9mDbCL3 nwxZmtOcuaru83KNHum2Q+jTKp7++i3SmmiF7pUcNkiFdR1qMUHoSHqEKslT6ODiap2c R0tR44hvd0Axj0JlD9LrGfLjz3VnoWByi06ByeDzOvnrw1XBm8aOQM7qBtBEgdvQ4D96 pn/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=FkoGT9EUOfElAMOvQBaacrRPtvKb0up1asKh4dpvGTQ=; b=XVBMQz8eSAFWz6u1SCA1X64dLWiR1Ecgk4TeG1iqVZGGB7Wa7q1yw8OK2KROynIXy8 aR1Nr91flyBbKvy5lmFSKQ4UH1IYno0zmuxkzCb39/LrvQqPPZCkc2BYOOZuFZWGgtry Iyo57K++V+PVeGgMlvtkUgFSAp1RfFgdzhAqh+oheUT5EKkOfizn4CaaOuAMHr50n0vP SRdVYwknsRUkyj5xzyXrFVMi6C96GMXKzrDK+4ya9NoRlgpVIFhkTZZkWMQt4JTllGt8 v3BCk08tuxatu0NXZABnAYWHFNBawZJzFpkFHNGXPD/tnaj5F76AuYGaFN5NgKP7WAw/ Ggqw== X-Gm-Message-State: APjAAAXEKfZTFrsEN4oScO7mQb6+oVEj8ZQnKo8tifnyCv8+/xvSYrYu 02YvWA2zHI9txRAOFPFPsOo8tlQe X-Google-Smtp-Source: APXvYqxOSij/wU6z/QPNEXyxH3wpKkgV+59Bm8Cur5mTFNzxnqyP63ngjZZgNJ0qseiaBEOd9m5IYw== X-Received: by 2002:a1c:1b8f:: with SMTP id b137mr995586wmb.5.1573510349042; Mon, 11 Nov 2019 14:12:29 -0800 (PST) Received: from brick (cpc92302-cmbg19-2-0-cust461.5-4.cable.virginm.net. [82.1.209.206]) by smtp.gmail.com with ESMTPSA id k125sm1680469wmf.2.2019.11.11.14.12.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2019 14:12:28 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Mon, 11 Nov 2019 22:12:26 +0000 From: Edward Tomasz Napierala To: Ian Lepore Cc: Alexander Leidinger , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354458 - head/libexec/rc/rc.d Message-ID: <20191111221226.GB1111@brick> Mail-Followup-To: Ian Lepore , Alexander Leidinger , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911071815.xA7IFOhI070066@repo.freebsd.org> <20191109204958.Horde.B0ynnS_aur1OZimnDNObsAt@webmail.leidinger.net> <20191110160819.GA1095@brick> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47BlVQ56hfz3FrJ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.984,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 22:12:30 -0000 On 1111T1349, Ian Lepore wrote: > On Sun, 2019-11-10 at 16:08 +0000, Edward Tomasz Napierala wrote: > > On 1109T2049, Alexander Leidinger wrote: > > > Quoting Edward Tomasz Napierala (from Thu, 7 > > > Nov > > > 2019 18:15:24 +0000 (UTC)): > > > > > > > Author: trasz > > > > Date: Thu Nov 7 18:15:24 2019 > > > > New Revision: 354458 > > > > URL: https://svnweb.freebsd.org/changeset/base/354458 > > > > > > > > Log: > > > > Extend the linux rc script to mount the neccessary file > > > > systems, > > > > set ELF fallback brand, and load pty(4). > > > > > > We never did something like that. We have it documented > > > everywhere > > > that it needs to be done manually. So this is at least a POLA > > > violation. It is great that the nocover option is used in the > > > mount, > > > but it's still some kind of layering violation (I may want to > > > have > > > only a subset mounted, or nothing at all). > > > > It is kind of a POLA violation, but previously the linux_enable > > knob didn't do much apart from loading the linux{,64}.ko kernel > > module and doing something weird with ldconfig, which I'm not > > even sure is actually useful. In other words, the old behaviour > > can be restored by just not using linux_enable, and instead > > loading the kernel modules the same way all the others are loaded. > > > > Could you give me some use case why someone would want only a subset > > of the filesystems? > > > > Well, there's my use case, where the subset of those filesystems that I > want mounted is: none of them. > > The apps I use under the linuxlator work fine without having a single > one of those filesystems mounted, and I don't want something to start > mounting them for me when I don't even need them. Thanks, makes sense. See https://reviews.freebsd.org/D22320; I've added both you and Alexander as reviewers. From owner-svn-src-head@freebsd.org Mon Nov 11 22:18:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CBBA1BFCFB; Mon, 11 Nov 2019 22:18:06 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Blct2D4Fz3G5C; Mon, 11 Nov 2019 22:18:06 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30B111E04B; Mon, 11 Nov 2019 22:18:06 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xABMI66N065876; Mon, 11 Nov 2019 22:18:06 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABMI6rf065875; Mon, 11 Nov 2019 22:18:06 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911112218.xABMI6rf065875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Mon, 11 Nov 2019 22:18:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354631 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 354631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 22:18:06 -0000 Author: scottl Date: Mon Nov 11 22:18:05 2019 New Revision: 354631 URL: https://svnweb.freebsd.org/changeset/base/354631 Log: Add the text attribute for MDS_NO in the IA32_ARCH_CAP MSR. Modified: head/sys/x86/x86/identcpu.c Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Mon Nov 11 21:59:20 2019 (r354630) +++ head/sys/x86/x86/identcpu.c Mon Nov 11 22:18:05 2019 (r354631) @@ -1045,6 +1045,7 @@ printcpuinfo(void) "\003RSBA" "\004SKIP_L1DFL_VME" "\005SSB_NO" + "\006MDS_NO" ); } From owner-svn-src-head@freebsd.org Tue Nov 12 00:32:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5E781C1C4E; Tue, 12 Nov 2019 00:32:34 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Bpc23tlJz3MHt; Tue, 12 Nov 2019 00:32:34 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69EFC1F945; Tue, 12 Nov 2019 00:32:34 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAC0WYv1063590; Tue, 12 Nov 2019 00:32:34 GMT (envelope-from chs@FreeBSD.org) Received: (from chs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAC0WYoi063589; Tue, 12 Nov 2019 00:32:34 GMT (envelope-from chs@FreeBSD.org) Message-Id: <201911120032.xAC0WYoi063589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chs set sender to chs@FreeBSD.org using -f From: Chuck Silvers Date: Tue, 12 Nov 2019 00:32:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354632 - head/sys/ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: chs X-SVN-Commit-Paths: head/sys/ufs/ufs X-SVN-Commit-Revision: 354632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 00:32:34 -0000 Author: chs Date: Tue Nov 12 00:32:33 2019 New Revision: 354632 URL: https://svnweb.freebsd.org/changeset/base/354632 Log: In ufs_dir_dd_ino(), always initialize *dd_vp since the caller expects it. Reviewed by: kib, mckusick Approved by: imp (mentor) Sponsored by: Netflix Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Mon Nov 11 22:18:05 2019 (r354631) +++ head/sys/ufs/ufs/ufs_lookup.c Tue Nov 12 00:32:33 2019 (r354632) @@ -1408,6 +1408,7 @@ ufs_dir_dd_ino(struct vnode *vp, struct ucred *cred, i int error, namlen; ASSERT_VOP_LOCKED(vp, "ufs_dir_dd_ino"); + *dd_vp = NULL; if (vp->v_type != VDIR) return (ENOTDIR); /* @@ -1440,7 +1441,6 @@ ufs_dir_dd_ino(struct vnode *vp, struct ucred *cred, i dirbuf.dotdot_name[1] != '.') return (ENOTDIR); *dd_ino = dirbuf.dotdot_ino; - *dd_vp = NULL; return (0); } From owner-svn-src-head@freebsd.org Tue Nov 12 01:03:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C4A71C24ED; Tue, 12 Nov 2019 01:03:09 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BqHK2frNz3PB5; Tue, 12 Nov 2019 01:03:09 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E6091FEAC; Tue, 12 Nov 2019 01:03:09 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAC139km081658; Tue, 12 Nov 2019 01:03:09 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAC139S8081657; Tue, 12 Nov 2019 01:03:09 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201911120103.xAC139S8081657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Tue, 12 Nov 2019 01:03:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354633 - head/usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: karels X-SVN-Commit-Paths: head/usr.bin/netstat X-SVN-Commit-Revision: 354633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 01:03:09 -0000 Author: karels Date: Tue Nov 12 01:03:08 2019 New Revision: 354633 URL: https://svnweb.freebsd.org/changeset/base/354633 Log: Fix netstat -gs with ip_mroute module and/or vnet The code for "netstat -gs -f inet" failed if the kernel namelist did not include the _mrtstat symbol. However, that symbol is not in a standard kernel even with the ip_mroute module loaded, where the functionality is available. It is also not in a kernel with MROUTING but also VIMAGE, as there can be multiple sets of stats. However, when running the command on a live system, the symbol is not used; a sysctl is used. Go ahead and try the sysctl in any case, and complain that IPv4 MROUTING is not present only if the sysctl fails with ENOENT. Also fail if _mrtstat is not defined when running on a core file; netstat doesn't know about vnets, so can only work if MROUTING was included, and VIMAGE was not. Reviewed by: bz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22311 Modified: head/usr.bin/netstat/mroute.c Modified: head/usr.bin/netstat/mroute.c ============================================================================== --- head/usr.bin/netstat/mroute.c Tue Nov 12 00:32:33 2019 (r354632) +++ head/usr.bin/netstat/mroute.c Tue Nov 12 01:03:08 2019 (r354633) @@ -409,14 +409,12 @@ mrt_stats() mstaddr = nl[N_MRTSTAT].n_value; - if (mstaddr == 0) { - fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); - return; - } - if (fetch_stats("net.inet.ip.mrtstat", mstaddr, &mrtstat, - sizeof(mrtstat), kread_counters) != 0) + sizeof(mrtstat), kread_counters) != 0) { + if ((live && errno == ENOENT) || (!live && mstaddr == 0)) + fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); return; + } xo_emit("{T:IPv4 multicast forwarding}:\n"); From owner-svn-src-head@freebsd.org Tue Nov 12 10:02:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37EE51A85FA; Tue, 12 Nov 2019 10:02:40 +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 47C3Fr0kqTz4LxS; Tue, 12 Nov 2019 10:02:40 +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 F08AB260D8; Tue, 12 Nov 2019 10:02:39 +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 xACA2dpn002265; Tue, 12 Nov 2019 10:02:39 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACA2d3h002264; Tue, 12 Nov 2019 10:02:39 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911121002.xACA2d3h002264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 12 Nov 2019 10:02:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354635 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 10:02:40 -0000 Author: tsoome Date: Tue Nov 12 10:02:39 2019 New Revision: 354635 URL: https://svnweb.freebsd.org/changeset/base/354635 Log: reverting r354594 In our case the structure is more complex and simple static initializer will upset compiler diagnostics - using memset is still better than building more complext initializer. Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Tue Nov 12 09:54:48 2019 (r354634) +++ head/stand/libsa/zfs/zfsimpl.c Tue Nov 12 10:02:39 2019 (r354635) @@ -1697,7 +1697,7 @@ vdev_uberblock_load(vdev_t *vd, uberblock_t *ub) static int vdev_probe(vdev_phys_read_t *_read, void *read_priv, spa_t **spap) { - vdev_t vtmp = { 0 }; + vdev_t vtmp; spa_t *spa; vdev_t *vdev, *top_vdev, *pool_vdev; unsigned char *nvlist; @@ -1713,6 +1713,7 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s * Load the vdev label and figure out which * uberblock is most current. */ + memset(&vtmp, 0, sizeof(vtmp)); vtmp.v_phys_read = _read; vtmp.v_read_priv = read_priv; vtmp.v_psize = P2ALIGN(ldi_get_size(read_priv), From owner-svn-src-head@freebsd.org Tue Nov 12 10:31:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 969D51A8FB4; Tue, 12 Nov 2019 10:31:29 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47C3v53Y0wz4NKj; Tue, 12 Nov 2019 10:31:29 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E15F264D6; Tue, 12 Nov 2019 10:31:29 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACAVT8k018482; Tue, 12 Nov 2019 10:31:29 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACAVTsw018481; Tue, 12 Nov 2019 10:31:29 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201911121031.xACAVTsw018481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Tue, 12 Nov 2019 10:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354637 - head/sys/x86/xen X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: head/sys/x86/xen X-SVN-Commit-Revision: 354637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 10:31:29 -0000 Author: royger Date: Tue Nov 12 10:31:28 2019 New Revision: 354637 URL: https://svnweb.freebsd.org/changeset/base/354637 Log: xen: fix dispatching of NMIs Currently NMIs are sent over event channels, but that defeats the purpose of NMIs since event channels can be masked. Fix this by issuing NMIs using a hypercall, which injects a NMI (vector #2) to the desired vCPU. Note that NMIs could also be triggered using the emulated local APIC, but using a hypercall is better from a performance point of view since it doesn't involve instruction decoding when not using x2APIC mode. Reported and Tested by: avg Sponsored by: Citrix Systems R&D Modified: head/sys/x86/xen/xen_apic.c Modified: head/sys/x86/xen/xen_apic.c ============================================================================== --- head/sys/x86/xen/xen_apic.c Tue Nov 12 10:22:48 2019 (r354636) +++ head/sys/x86/xen/xen_apic.c Tue Nov 12 10:31:28 2019 (r354637) @@ -72,7 +72,6 @@ static driver_filter_t xen_invlcache; static driver_filter_t xen_ipi_bitmap_handler; static driver_filter_t xen_cpustop_handler; static driver_filter_t xen_cpususpend_handler; -static driver_filter_t xen_cpustophard_handler; #endif /*---------------------------------- Macros ----------------------------------*/ @@ -96,7 +95,6 @@ static struct xen_ipi_handler xen_ipis[] = [IPI_TO_IDX(IPI_BITMAP_VECTOR)] = { xen_ipi_bitmap_handler, "b" }, [IPI_TO_IDX(IPI_STOP)] = { xen_cpustop_handler, "st" }, [IPI_TO_IDX(IPI_SUSPEND)] = { xen_cpususpend_handler, "sp" }, - [IPI_TO_IDX(IPI_STOP_HARD)] = { xen_cpustophard_handler, "sth" }, }; #endif @@ -259,12 +257,52 @@ xen_pv_lapic_ipi_raw(register_t icrlo, u_int dest) XEN_APIC_UNSUPPORTED; } +#define PCPU_ID_GET(id, field) (pcpu_find(id)->pc_##field) static void +send_nmi(int dest) +{ + unsigned int cpu; + + /* + * NMIs are not routed over event channels, and instead delivered as on + * native using the exception vector (#2). Triggering them can be done + * using the local APIC, or an hypercall as a shortcut like it's done + * below. + */ + switch(dest) { + case APIC_IPI_DEST_SELF: + HYPERVISOR_vcpu_op(VCPUOP_send_nmi, PCPU_GET(vcpu_id), NULL); + break; + case APIC_IPI_DEST_ALL: + CPU_FOREACH(cpu) + HYPERVISOR_vcpu_op(VCPUOP_send_nmi, + PCPU_ID_GET(cpu, vcpu_id), NULL); + break; + case APIC_IPI_DEST_OTHERS: + CPU_FOREACH(cpu) + if (cpu != PCPU_GET(cpuid)) + HYPERVISOR_vcpu_op(VCPUOP_send_nmi, + PCPU_ID_GET(cpu, vcpu_id), NULL); + break; + default: + HYPERVISOR_vcpu_op(VCPUOP_send_nmi, + PCPU_ID_GET(apic_cpuid(dest), vcpu_id), NULL); + break; + } +} +#undef PCPU_ID_GET + +static void xen_pv_lapic_ipi_vectored(u_int vector, int dest) { xen_intr_handle_t *ipi_handle; int ipi_idx, to_cpu, self; + if (vector >= IPI_NMI_FIRST) { + send_nmi(dest); + return; + } + ipi_idx = IPI_TO_IDX(vector); if (ipi_idx >= nitems(xen_ipis)) panic("IPI out of range"); @@ -519,14 +557,6 @@ xen_cpususpend_handler(void *arg) { cpususpend_handler(); - return (FILTER_HANDLED); -} - -static int -xen_cpustophard_handler(void *arg) -{ - - ipi_nmi_handler(); return (FILTER_HANDLED); } From owner-svn-src-head@freebsd.org Tue Nov 12 11:00:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDC231A9A1D; Tue, 12 Nov 2019 11:00:01 +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 47C4X164xpz4PvB; Tue, 12 Nov 2019 11:00:01 +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 B4D3226A13; Tue, 12 Nov 2019 11:00:01 +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 xACB01Yn031929; Tue, 12 Nov 2019 11:00:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACB01Cw031927; Tue, 12 Nov 2019 11:00:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911121100.xACB01Cw031927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 12 Nov 2019 11:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354638 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 354638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 11:00:02 -0000 Author: avg Date: Tue Nov 12 11:00:01 2019 New Revision: 354638 URL: https://svnweb.freebsd.org/changeset/base/354638 Log: teach db_nextframe/x86 about [X]xen_intr_upcall interrupt handler Discussed with: kib, royger MFC after: 3 weeks Sponsored by: Panzura Modified: head/sys/amd64/amd64/db_trace.c head/sys/i386/i386/db_trace.c Modified: head/sys/amd64/amd64/db_trace.c ============================================================================== --- head/sys/amd64/amd64/db_trace.c Tue Nov 12 10:31:28 2019 (r354637) +++ head/sys/amd64/amd64/db_trace.c Tue Nov 12 11:00:01 2019 (r354638) @@ -203,6 +203,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, s frame_type = TRAP; else if (strncmp(name, "Xatpic_intr", 11) == 0 || strncmp(name, "Xapic_isr", 9) == 0 || + strcmp(name, "Xxen_intr_upcall") == 0 || strcmp(name, "Xtimerint") == 0 || strcmp(name, "Xipi_intr_bitmap_handler") == 0 || strcmp(name, "Xcpustop") == 0 || Modified: head/sys/i386/i386/db_trace.c ============================================================================== --- head/sys/i386/i386/db_trace.c Tue Nov 12 10:31:28 2019 (r354637) +++ head/sys/i386/i386/db_trace.c Tue Nov 12 11:00:01 2019 (r354638) @@ -346,7 +346,8 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st frame_type = SYSCALL; else if (strcmp(name, "dblfault_handler") == 0) frame_type = DOUBLE_FAULT; - else if (strcmp(name, "Xtimerint") == 0) + else if (strcmp(name, "Xtimerint") == 0 || + strcmp(name, "Xxen_intr_upcall") == 0) frame_type = INTERRUPT; else if (strcmp(name, "Xcpustop") == 0 || strcmp(name, "Xrendezvous") == 0 || From owner-svn-src-head@freebsd.org Tue Nov 12 13:57:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BCE01AE7CB; Tue, 12 Nov 2019 13:57:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47C8SY6dQSz4ZjW; Tue, 12 Nov 2019 13:57:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6A19AAB; Tue, 12 Nov 2019 13:57:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACDvHVH038048; Tue, 12 Nov 2019 13:57:17 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACDvHv4038047; Tue, 12 Nov 2019 13:57:17 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911121357.xACDvHv4038047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 12 Nov 2019 13:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354639 - head/usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/usr.bin/netstat X-SVN-Commit-Revision: 354639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 13:57:18 -0000 Author: bz Date: Tue Nov 12 13:57:17 2019 New Revision: 354639 URL: https://svnweb.freebsd.org/changeset/base/354639 Log: netstat: igmp stats, error on unexpected information, not only warn The igmp stats tend to print two lines of warning for an unexpected version and length. Despite an invalid version and struct size it continues to try to do something with the data. Do not try to parse the remainder of the struct and error on warning. Note the underlying issue of the data not being available properly is still there and needs to be fixed seperately. Reported by: test cases, lwhsu MFC after: 3 weeks Modified: head/usr.bin/netstat/inet.c Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Tue Nov 12 11:00:01 2019 (r354638) +++ head/usr.bin/netstat/inet.c Tue Nov 12 13:57:17 2019 (r354639) @@ -1230,10 +1230,12 @@ igmp_stats(u_long off, const char *name, int af1 __unu if (igmpstat.igps_version != IGPS_VERSION_3) { xo_warnx("%s: version mismatch (%d != %d)", __func__, igmpstat.igps_version, IGPS_VERSION_3); + return; } if (igmpstat.igps_len != IGPS_VERSION3_LEN) { xo_warnx("%s: size mismatch (%d != %d)", __func__, igmpstat.igps_len, IGPS_VERSION3_LEN); + return; } xo_open_container(name); From owner-svn-src-head@freebsd.org Tue Nov 12 15:46:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D3BB1B1366; Tue, 12 Nov 2019 15:46:31 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CBtZ6Yznz3D4C; Tue, 12 Nov 2019 15:46:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C01A01E95; Tue, 12 Nov 2019 15:46:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACFkUat003764; Tue, 12 Nov 2019 15:46:30 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACFkTbo003756; Tue, 12 Nov 2019 15:46:29 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911121546.xACFkTbo003756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 12 Nov 2019 15:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354643 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 354643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 15:46:31 -0000 Author: bz Date: Tue Nov 12 15:46:28 2019 New Revision: 354643 URL: https://svnweb.freebsd.org/changeset/base/354643 Log: netinet*: update *mp to pass the proper value back In ip6_[direct_]input() we are looping over the extension headers to deal with the next header. We pass a pointer to an mbuf pointer to the handling functions. In certain cases the mbuf can be updated there and we need to pass the new one back. That missing in dest6_input() and route6_input(). In tcp6_input() we should also update it before we call tcp_input(). In addition to that mark the mbuf NULL all the times when we return that we are done with handling the packet and no next header should be checked (IPPROTO_DONE). This will eventually allow us to assert proper behaviour and catch the above kind of errors more easily, expecting *mp to always be set. This change is extracted from a larger patch and not an exhaustive change across the entire stack yet. PR: 240135 Reported by: prabhakar.lakhera gmail.com MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet/tcp_input.c head/sys/netinet6/dest6.c head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/ip6_input.c head/sys/netinet6/route6.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Nov 12 15:34:19 2019 (r354642) +++ head/sys/netinet/tcp_input.c Tue Nov 12 15:46:28 2019 (r354643) @@ -530,11 +530,13 @@ tcp6_input(struct mbuf **mp, int *offp, int proto) ifa_free(&ia6->ia_ifa); icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); + *mp = NULL; return (IPPROTO_DONE); } if (ia6) ifa_free(&ia6->ia_ifa); + *mp = m; return (tcp_input(mp, offp, proto)); } #endif /* INET6 */ Modified: head/sys/netinet6/dest6.c ============================================================================== --- head/sys/netinet6/dest6.c Tue Nov 12 15:34:19 2019 (r354642) +++ head/sys/netinet6/dest6.c Tue Nov 12 15:46:28 2019 (r354643) @@ -113,17 +113,21 @@ dest6_input(struct mbuf **mp, int *offp, int proto) default: /* unknown option */ optlen = ip6_unknown_opt(opt, m, opt - mtod(m, u_int8_t *)); - if (optlen == -1) + if (optlen == -1) { + *mp = NULL; return (IPPROTO_DONE); + } optlen += 2; break; } } *offp = off; + *mp = m; return (dstopts->ip6d_nxt); bad: m_freem(m); + *mp = NULL; return (IPPROTO_DONE); } Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Tue Nov 12 15:34:19 2019 (r354642) +++ head/sys/netinet6/frag6.c Tue Nov 12 15:46:28 2019 (r354643) @@ -419,6 +419,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) if (ip6->ip6_plen == 0) { icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset); in6_ifstat_inc(dstifp, ifs6_reass_fail); + *mp = NULL; return (IPPROTO_DONE); } @@ -433,6 +434,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offsetof(struct ip6_hdr, ip6_plen)); in6_ifstat_inc(dstifp, ifs6_reass_fail); + *mp = NULL; return (IPPROTO_DONE); } @@ -476,6 +478,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) offsetof(struct ip6_hdr, ip6_plen)); in6_ifstat_inc(dstifp, ifs6_reass_fail); IP6STAT_INC(ip6s_fragdropped); + *mp = NULL; return (IPPROTO_DONE); } @@ -611,6 +614,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset - sizeof(struct ip6_frag) + offsetof(struct ip6_frag, ip6f_offlg)); + *mp = NULL; return (IPPROTO_DONE); } } else if (fragoff + frgpartlen > IPV6_MAXPACKET) { @@ -627,6 +631,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset - sizeof(struct ip6_frag) + offsetof(struct ip6_frag, ip6f_offlg)); + *mp = NULL; return (IPPROTO_DONE); } @@ -777,6 +782,7 @@ postinsert: frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); + *mp = NULL; return (IPPROTO_DONE); } plen += af6->ip6af_frglen; @@ -788,6 +794,7 @@ postinsert: frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); + *mp = NULL; return (IPPROTO_DONE); } @@ -877,6 +884,7 @@ postinsert: #ifdef RSS /* Queue/dispatch for reprocessing. */ netisr_dispatch(NETISR_IPV6_DIRECT, m); + *mp = NULL; return (IPPROTO_DONE); #endif @@ -892,6 +900,7 @@ dropfrag2: in6_ifstat_inc(dstifp, ifs6_reass_fail); IP6STAT_INC(ip6s_fragdropped); m_freem(m); + *mp = NULL; return (IPPROTO_DONE); } Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Tue Nov 12 15:34:19 2019 (r354642) +++ head/sys/netinet6/icmp6.c Tue Nov 12 15:46:28 2019 (r354643) @@ -617,8 +617,10 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) */ if ((ip6->ip6_hlim != 1) || (m->m_flags & M_RTALERT_MLD) == 0) goto freeit; - if (mld_input(m, off, icmp6len) != 0) + if (mld_input(m, off, icmp6len) != 0) { + *mp = NULL; return (IPPROTO_DONE); + } /* m stays. */ break; @@ -853,6 +855,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) deliver: if (icmp6_notify_error(&m, off, icmp6len, code) != 0) { /* In this case, m should've been freed. */ + *mp = NULL; return (IPPROTO_DONE); } break; @@ -869,11 +872,13 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) /* deliver the packet to appropriate sockets */ icmp6_rip6_input(&m, *offp); - return IPPROTO_DONE; + *mp = m; + return (IPPROTO_DONE); freeit: m_freem(m); - return IPPROTO_DONE; + *mp = NULL; + return (IPPROTO_DONE); } static int @@ -1106,6 +1111,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp freeit: m_freem(m); + *mp = NULL; return (-1); } @@ -1918,6 +1924,7 @@ icmp6_rip6_input(struct mbuf **mp, int off) fromsa.sin6_addr = ip6->ip6_src; if (sa6_recoverscope(&fromsa)) { m_freem(m); + *mp = NULL; return (IPPROTO_DONE); } @@ -2041,7 +2048,8 @@ icmp6_rip6_input(struct mbuf **mp, int off) m_freem(m); IP6STAT_DEC(ip6s_delivered); } - return IPPROTO_DONE; + *mp = NULL; + return (IPPROTO_DONE); } /* Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Tue Nov 12 15:34:19 2019 (r354642) +++ head/sys/netinet6/ip6_input.c Tue Nov 12 15:46:28 2019 (r354643) @@ -1010,8 +1010,10 @@ ip6_hopopts_input(u_int32_t *plenp, u_int32_t *rtalert off += hbhlen; hbhlen -= sizeof(struct ip6_hbh); if (ip6_process_hopopts(m, (u_int8_t *)hbh + sizeof(struct ip6_hbh), - hbhlen, rtalertp, plenp) < 0) + hbhlen, rtalertp, plenp) < 0) { + *mp = NULL; return (-1); + } *offp = off; *mp = m; Modified: head/sys/netinet6/route6.c ============================================================================== --- head/sys/netinet6/route6.c Tue Nov 12 15:34:19 2019 (r354642) +++ head/sys/netinet6/route6.c Tue Nov 12 15:46:28 2019 (r354643) @@ -110,9 +110,11 @@ route6_input(struct mbuf **mp, int *offp, int proto) IP6STAT_INC(ip6s_badoptions); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, (caddr_t)&rh->ip6r_type - (caddr_t)ip6); + *mp = NULL; return (IPPROTO_DONE); } *offp += rhlen; + *mp = m; return (rh->ip6r_nxt); } Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Tue Nov 12 15:34:19 2019 (r354642) +++ head/sys/netinet6/udp6_usrreq.c Tue Nov 12 15:46:28 2019 (r354643) @@ -394,8 +394,11 @@ udp6_input(struct mbuf **mp, int *offp, int proto) else UDP_PROBE(receive, NULL, last, ip6, last, uh); - if (udp6_append(last, n, off, fromsa)) + if (udp6_append(last, n, off, fromsa)) { + /* XXX-BZ do we leak m here? */ + *mp = NULL; return (IPPROTO_DONE); + } } INP_RUNLOCK(last); } @@ -434,6 +437,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) INP_RUNLOCK(last); } else INP_RUNLOCK(last); + *mp = NULL; return (IPPROTO_DONE); } /* @@ -501,6 +505,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) if (V_udp_blackhole) goto badunlocked; icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0); + *mp = NULL; return (IPPROTO_DONE); } INP_RLOCK_ASSERT(inp); @@ -509,6 +514,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) if (up->u_rxcslen == 0 || up->u_rxcslen > ulen) { INP_RUNLOCK(inp); m_freem(m); + *mp = NULL; return (IPPROTO_DONE); } } @@ -518,11 +524,13 @@ udp6_input(struct mbuf **mp, int *offp, int proto) UDP_PROBE(receive, NULL, inp, ip6, inp, uh); if (udp6_append(inp, m, off, fromsa) == 0) INP_RUNLOCK(inp); + *mp = NULL; return (IPPROTO_DONE); badunlocked: if (m) m_freem(m); + *mp = NULL; return (IPPROTO_DONE); } From owner-svn-src-head@freebsd.org Tue Nov 12 15:47:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B04A1B13F8; Tue, 12 Nov 2019 15:47:47 +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 47CBw272J8z3DD4; Tue, 12 Nov 2019 15:47:46 +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 D47201EA1; Tue, 12 Nov 2019 15:47:46 +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 xACFlks6003872; Tue, 12 Nov 2019 15:47:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACFlk0L003871; Tue, 12 Nov 2019 15:47:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911121547.xACFlk0L003871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 12 Nov 2019 15:47:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354644 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 15:47:47 -0000 Author: kib Date: Tue Nov 12 15:47:46 2019 New Revision: 354644 URL: https://svnweb.freebsd.org/changeset/base/354644 Log: amd64: assert that size of the software prototype table for gdt is equal to the size of hardware gdt. Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22302 Modified: head/sys/amd64/amd64/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Nov 12 15:46:28 2019 (r354643) +++ head/sys/amd64/amd64/machdep.c Tue Nov 12 15:47:46 2019 (r354644) @@ -794,6 +794,7 @@ struct soft_segment_descriptor gdt_segs[] = { .ssd_def32 = 0, .ssd_gran = 0 }, }; +_Static_assert(nitems(gdt_segs) == NGDT, "Stale NGDT"); void setidt(int idx, inthand_t *func, int typ, int dpl, int ist) From owner-svn-src-head@freebsd.org Tue Nov 12 15:50:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D7E51B14AF; Tue, 12 Nov 2019 15:50:31 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CBzC2FPZz3DNt; Tue, 12 Nov 2019 15:50:31 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 305481EC5; Tue, 12 Nov 2019 15:50:31 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACFoVng004079; Tue, 12 Nov 2019 15:50:31 GMT (envelope-from scottph@FreeBSD.org) Received: (from scottph@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACFoUix004074; Tue, 12 Nov 2019 15:50:30 GMT (envelope-from scottph@FreeBSD.org) Message-Id: <201911121550.xACFoUix004074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottph set sender to scottph@FreeBSD.org using -f From: D Scott Phillips Date: Tue, 12 Nov 2019 15:50:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354645 - head/sys/dev/nvdimm X-SVN-Group: head X-SVN-Commit-Author: scottph X-SVN-Commit-Paths: head/sys/dev/nvdimm X-SVN-Commit-Revision: 354645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 15:50:31 -0000 Author: scottph Date: Tue Nov 12 15:50:30 2019 New Revision: 354645 URL: https://svnweb.freebsd.org/changeset/base/354645 Log: nvdimm(4): Only expose namespaces for accessible data SPAs Apply the same user accessible filter to namespaces as is applied to full-SPA devices. Also, explicitly filter out control region SPAs which don't expose the nvdimm data area. Reviewed by: cem Approved by: scottl (mentor) MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21987 Modified: head/sys/dev/nvdimm/nvdimm_acpi.c head/sys/dev/nvdimm/nvdimm_spa.c head/sys/dev/nvdimm/nvdimm_var.h Modified: head/sys/dev/nvdimm/nvdimm_acpi.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_acpi.c Tue Nov 12 15:47:46 2019 (r354644) +++ head/sys/dev/nvdimm/nvdimm_acpi.c Tue Nov 12 15:50:30 2019 (r354645) @@ -144,7 +144,9 @@ nvdimm_root_create_spas(struct nvdimm_root_dev *dev, A free(spa_mapping, M_NVDIMM_ACPI); break; } - nvdimm_create_namespaces(spa_mapping, nfitbl); + if (nvdimm_spa_type_user_accessible(spa_type) && + spa_type != SPA_TYPE_CONTROL_REGION) + nvdimm_create_namespaces(spa_mapping, nfitbl); SLIST_INSERT_HEAD(&dev->spas, spa_mapping, link); } free(spas, M_NVDIMM_ACPI); Modified: head/sys/dev/nvdimm/nvdimm_spa.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_spa.c Tue Nov 12 15:47:46 2019 (r354644) +++ head/sys/dev/nvdimm/nvdimm_spa.c Tue Nov 12 15:50:30 2019 (r354645) @@ -155,6 +155,15 @@ nvdimm_spa_type_from_uuid(struct uuid *uuid) return (SPA_TYPE_UNKNOWN); } +bool +nvdimm_spa_type_user_accessible(enum SPA_mapping_type spa_type) +{ + + if ((int)spa_type < 0 || spa_type >= nitems(nvdimm_SPA_uuid_list)) + return (false); + return (nvdimm_SPA_uuid_list[spa_type].u_usr_acc); +} + static vm_memattr_t nvdimm_spa_memattr(uint64_t efi_mem_flags) { Modified: head/sys/dev/nvdimm/nvdimm_var.h ============================================================================== --- head/sys/dev/nvdimm/nvdimm_var.h Tue Nov 12 15:47:46 2019 (r354644) +++ head/sys/dev/nvdimm/nvdimm_var.h Tue Nov 12 15:50:30 2019 (r354645) @@ -166,6 +166,7 @@ void acpi_nfit_get_flush_addrs(ACPI_TABLE_NFIT *nfitbl uint64_t ***listp, int *countp); enum SPA_mapping_type nvdimm_spa_type_from_name(const char *); enum SPA_mapping_type nvdimm_spa_type_from_uuid(struct uuid *); +bool nvdimm_spa_type_user_accessible(enum SPA_mapping_type); struct nvdimm_dev *nvdimm_find_by_handle(nfit_handle_t nv_handle); int nvdimm_spa_init(struct SPA_mapping *spa, ACPI_NFIT_SYSTEM_ADDRESS *nfitaddr, enum SPA_mapping_type spa_type); From owner-svn-src-head@freebsd.org Tue Nov 12 15:51:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 747CE1B1799; Tue, 12 Nov 2019 15:51:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CC0j2ZGnz3Dg8; Tue, 12 Nov 2019 15:51:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C9D82054; Tue, 12 Nov 2019 15:51:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACFpn8u008956; Tue, 12 Nov 2019 15:51:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACFplgQ008943; Tue, 12 Nov 2019 15:51:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911121551.xACFplgQ008943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 12 Nov 2019 15:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354646 - in head/sys: amd64/amd64 amd64/include amd64/vmm cddl/contrib/opensolaris/uts/intel/dtrace X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include amd64/vmm cddl/contrib/opensolaris/uts/intel/dtrace X-SVN-Commit-Revision: 354646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 15:51:49 -0000 Author: kib Date: Tue Nov 12 15:51:47 2019 New Revision: 354646 URL: https://svnweb.freebsd.org/changeset/base/354646 Log: amd64: move GDT into PCPU area. Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22302 Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/amd64/trap.c head/sys/amd64/include/pcpu.h head/sys/amd64/include/segments.h head/sys/amd64/vmm/vmm_host.h head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Nov 12 15:50:30 2019 (r354645) +++ head/sys/amd64/amd64/machdep.c Tue Nov 12 15:51:47 2019 (r354646) @@ -658,8 +658,6 @@ cpu_setregs(void) /* * Initialize segments & interrupt table */ - -struct user_segment_descriptor gdt[NGDT * MAXCPU];/* global descriptor tables */ static struct gate_descriptor idt0[NIDT]; struct gate_descriptor *idt = &idt0[0]; /* interrupt descriptor table */ @@ -1546,8 +1544,10 @@ amd64_conf_fast_syscall(void) void amd64_bsp_pcpu_init1(struct pcpu *pc) { + struct user_segment_descriptor *gdt; PCPU_SET(prvspace, pc); + gdt = *PCPU_PTR(gdt); PCPU_SET(curthread, &thread0); PCPU_SET(tssp, PCPU_PTR(common_tss)); PCPU_SET(tss, (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); @@ -1610,6 +1610,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct xstate_hdr *xhdr; u_int64_t rsp0; char *env; + struct user_segment_descriptor *gdt; struct region_descriptor r_gdt; size_t kstack0_sz; int late_console; @@ -1667,6 +1668,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) pmap_thread_init_invl_gen(&thread0); pc = &temp_bsp_pcpu; + pcpu_init(pc, 0, sizeof(struct pcpu)); + gdt = &temp_bsp_pcpu.pc_gdt[0]; /* * make gdt memory segments @@ -1681,14 +1684,13 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); r_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; - r_gdt.rd_base = (long) gdt; + r_gdt.rd_base = (long)gdt; lgdt(&r_gdt); wrmsr(MSR_FSBASE, 0); /* User value */ wrmsr(MSR_GSBASE, (u_int64_t)pc); wrmsr(MSR_KGSBASE, 0); /* User value while in the kernel */ - pcpu_init(pc, 0, sizeof(struct pcpu)); dpcpu_init((void *)(physfree + KERNBASE), 0); physfree += DPCPU_SIZE; amd64_bsp_pcpu_init1(pc); Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Tue Nov 12 15:50:30 2019 (r354645) +++ head/sys/amd64/amd64/mp_machdep.c Tue Nov 12 15:51:47 2019 (r354646) @@ -275,9 +275,10 @@ init_secondary(void) { struct pcpu *pc; struct nmi_pcpu *np; + struct user_segment_descriptor *gdt; + struct region_descriptor ap_gdt; u_int64_t cr0; int cpu, gsel_tss, x; - struct region_descriptor ap_gdt; /* Set by the startup code for us to use */ cpu = bootAP; @@ -298,12 +299,11 @@ init_secondary(void) pc->pc_rsp0 = 0; pc->pc_pti_rsp0 = (((vm_offset_t)&pc->pc_pti_stack + PC_PTI_STACK_SZ * sizeof(uint64_t)) & ~0xful); - pc->pc_tss = (struct system_segment_descriptor *)&gdt[NGDT * cpu + - GPROC0_SEL]; - pc->pc_fs32p = &gdt[NGDT * cpu + GUFS32_SEL]; - pc->pc_gs32p = &gdt[NGDT * cpu + GUGS32_SEL]; - pc->pc_ldt = (struct system_segment_descriptor *)&gdt[NGDT * cpu + - GUSERLDT_SEL]; + gdt = pc->pc_gdt; + pc->pc_tss = (struct system_segment_descriptor *)&gdt[GPROC0_SEL]; + pc->pc_fs32p = &gdt[GUFS32_SEL]; + pc->pc_gs32p = &gdt[GUGS32_SEL]; + pc->pc_ldt = (struct system_segment_descriptor *)&gdt[GUSERLDT_SEL]; /* See comment in pmap_bootstrap(). */ pc->pc_pcid_next = PMAP_PCID_KERN + 2; pc->pc_pcid_gen = 1; @@ -331,14 +331,14 @@ init_secondary(void) /* Prepare private GDT */ gdt_segs[GPROC0_SEL].ssd_base = (long)&pc->pc_common_tss; for (x = 0; x < NGDT; x++) { - if (x != GPROC0_SEL && x != (GPROC0_SEL + 1) && - x != GUSERLDT_SEL && x != (GUSERLDT_SEL + 1)) - ssdtosd(&gdt_segs[x], &gdt[NGDT * cpu + x]); + if (x != GPROC0_SEL && x != GPROC0_SEL + 1 && + x != GUSERLDT_SEL && x != GUSERLDT_SEL + 1) + ssdtosd(&gdt_segs[x], &gdt[x]); } ssdtosyssd(&gdt_segs[GPROC0_SEL], - (struct system_segment_descriptor *)&gdt[NGDT * cpu + GPROC0_SEL]); + (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); ap_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; - ap_gdt.rd_base = (u_long)&gdt[NGDT * cpu]; + ap_gdt.rd_base = (u_long)gdt; lgdt(&ap_gdt); /* does magic intra-segment return */ /* Save the per-cpu pointer for use by the NMI handler. */ Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Nov 12 15:50:30 2019 (r354645) +++ head/sys/amd64/amd64/pmap.c Tue Nov 12 15:51:47 2019 (r354646) @@ -1669,6 +1669,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) { vm_offset_t va; pt_entry_t *pte, *pcpu_pte; + struct region_descriptor r_gdt; uint64_t cr4, pcpu_phys; u_long res; int i; @@ -1760,14 +1761,25 @@ pmap_bootstrap(vm_paddr_t *firstaddr) pcpu_pte[i] = (pcpu_phys + ptoa(i)) | X86_PG_V | X86_PG_RW | pg_g | pg_nx | X86_PG_M | X86_PG_A; } + + /* + * Re-initialize PCPU area for BSP after switching. + * Make hardware use gdt and common_tss from the new PCPU. + */ STAILQ_INIT(&cpuhead); wrmsr(MSR_GSBASE, (uint64_t)&__pcpu[0]); pcpu_init(&__pcpu[0], 0, sizeof(struct pcpu)); amd64_bsp_pcpu_init1(&__pcpu[0]); amd64_bsp_ist_init(&__pcpu[0]); + memcpy(__pcpu[0].pc_gdt, temp_bsp_pcpu.pc_gdt, NGDT * + sizeof(struct user_segment_descriptor)); gdt_segs[GPROC0_SEL].ssd_base = (uintptr_t)&__pcpu[0].pc_common_tss; ssdtosyssd(&gdt_segs[GPROC0_SEL], - (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); + (struct system_segment_descriptor *)&__pcpu[0].pc_gdt[GPROC0_SEL]); + r_gdt.rd_limit = NGDT * sizeof(struct user_segment_descriptor) - 1; + r_gdt.rd_base = (long)__pcpu[0].pc_gdt; + lgdt(&r_gdt); + wrmsr(MSR_GSBASE, (uint64_t)&__pcpu[0]); ltr(GSEL(GPROC0_SEL, SEL_KPL)); __pcpu[0].pc_dynamic = temp_bsp_pcpu.pc_dynamic; __pcpu[0].pc_acpi_id = temp_bsp_pcpu.pc_acpi_id; @@ -9722,8 +9734,6 @@ pmap_pti_init(void) } pmap_pti_add_kva_locked((vm_offset_t)&__pcpu[0], (vm_offset_t)&__pcpu[0] + sizeof(__pcpu[0]) * MAXCPU, false); - pmap_pti_add_kva_locked((vm_offset_t)gdt, (vm_offset_t)gdt + - sizeof(struct user_segment_descriptor) * NGDT * MAXCPU, false); pmap_pti_add_kva_locked((vm_offset_t)idt, (vm_offset_t)idt + sizeof(struct gate_descriptor) * NIDT, false); CPU_FOREACH(i) { Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Tue Nov 12 15:50:30 2019 (r354645) +++ head/sys/amd64/amd64/trap.c Tue Nov 12 15:51:47 2019 (r354646) @@ -861,14 +861,15 @@ trap_fatal(frame, eva) int code, ss; u_int type; struct soft_segment_descriptor softseg; + struct user_segment_descriptor *gdt; #ifdef KDB bool handled; #endif code = frame->tf_err; type = frame->tf_trapno; - sdtossd(&gdt[NGDT * PCPU_GET(cpuid) + IDXSEL(frame->tf_cs & 0xffff)], - &softseg); + gdt = *PCPU_PTR(gdt); + sdtossd(&gdt[IDXSEL(frame->tf_cs & 0xffff)], &softseg); printf("\n\nFatal trap %d: %s while in %s mode\n", type, type < nitems(trap_msg) ? trap_msg[type] : UNKNOWN, Modified: head/sys/amd64/include/pcpu.h ============================================================================== --- head/sys/amd64/include/pcpu.h Tue Nov 12 15:50:30 2019 (r354645) +++ head/sys/amd64/include/pcpu.h Tue Nov 12 15:51:47 2019 (r354646) @@ -35,6 +35,7 @@ #error "sys/cdefs.h is a prerequisite for this file" #endif +#include #include #define PC_PTI_STACK_SZ 16 @@ -92,7 +93,8 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x c uint8_t pc_mds_tmp[64]; \ u_int pc_ipi_bitmap; \ struct amd64tss pc_common_tss; \ - char __pad[3068] /* pad to UMA_PCPU_ALLOC_SIZE */ + struct user_segment_descriptor pc_gdt[NGDT]; \ + char __pad[2956] /* pad to UMA_PCPU_ALLOC_SIZE */ #define PC_DBREG_CMD_NONE 0 #define PC_DBREG_CMD_LOAD 1 Modified: head/sys/amd64/include/segments.h ============================================================================== --- head/sys/amd64/include/segments.h Tue Nov 12 15:50:30 2019 (r354645) +++ head/sys/amd64/include/segments.h Tue Nov 12 15:51:47 2019 (r354646) @@ -89,7 +89,6 @@ struct region_descriptor { } __packed; #ifdef _KERNEL -extern struct user_segment_descriptor gdt[]; extern struct soft_segment_descriptor gdt_segs[]; extern struct gate_descriptor *idt; extern struct region_descriptor r_idt; Modified: head/sys/amd64/vmm/vmm_host.h ============================================================================== --- head/sys/amd64/vmm/vmm_host.h Tue Nov 12 15:50:30 2019 (r354645) +++ head/sys/amd64/vmm/vmm_host.h Tue Nov 12 15:51:47 2019 (r354646) @@ -69,7 +69,7 @@ static __inline uint64_t vmm_get_host_gdtrbase(void) { - return ((uint64_t)&gdt[NGDT * curcpu]); + return ((uint64_t)*PCPU_PTR(gdt)); } static __inline uint64_t Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Tue Nov 12 15:50:30 2019 (r354645) +++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Tue Nov 12 15:51:47 2019 (r354646) @@ -855,7 +855,7 @@ fasttrap_do_seg(fasttrap_tracepoint_t *tp, struct reg #ifdef __i386__ desc = &gdt[ndx].sd; #else - desc = &gdt[ndx]; + desc = PCPU_PTR(gdt)[ndx]; #endif } From owner-svn-src-head@freebsd.org Tue Nov 12 15:56:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B0FF1B1AEA; Tue, 12 Nov 2019 15:56:28 +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 47CC6370r3z3FCy; Tue, 12 Nov 2019 15:56:27 +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 D479920B7; Tue, 12 Nov 2019 15:56:27 +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 xACFuRET010072; Tue, 12 Nov 2019 15:56:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACFuR79010070; Tue, 12 Nov 2019 15:56:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911121556.xACFuR79010070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 12 Nov 2019 15:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354647 - in head/sys/i386: i386 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/i386: i386 include X-SVN-Commit-Revision: 354647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 15:56:28 -0000 Author: kib Date: Tue Nov 12 15:56:27 2019 New Revision: 354647 URL: https://svnweb.freebsd.org/changeset/base/354647 Log: i386: stop guessing the address of the trap frame in ddb backtrace. Save the address of the trap frame in %ebp on kernel entry. This automatically provides it in struct i386_frame.f_frame to unwinder. While there, more accurately handle the terminating frames, Reviewed by: avg, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22321 Modified: head/sys/i386/i386/db_trace.c head/sys/i386/include/asmacros.h Modified: head/sys/i386/i386/db_trace.c ============================================================================== --- head/sys/i386/i386/db_trace.c Tue Nov 12 15:51:47 2019 (r354646) +++ head/sys/i386/i386/db_trace.c Tue Nov 12 15:56:27 2019 (r354647) @@ -297,7 +297,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st { struct trapframe *tf; int frame_type; - int narg; int eip, esp, ebp; db_expr_t offset; c_db_sym_t sym; @@ -317,14 +316,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st */ frame_type = NORMAL; - /* - * This is the number of arguments that a syscall / trap / interrupt - * service routine passes to its callee. This number is used only for - * special frame types. In most cases there is one argument: the trap - * frame address. - */ - narg = 1; - if (eip >= PMAP_TRM_MIN_ADDRESS) { sym = db_search_symbol(eip - 1 - setidt_disp, DB_STGY_ANY, &offset); @@ -338,8 +329,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st frame_type = TRAP; else if (strncmp(name, "Xatpic_intr", 11) == 0 || strncmp(name, "Xapic_isr", 9) == 0) { - /* Additional argument: vector number. */ - narg = 2; frame_type = INTERRUPT; } else if (strcmp(name, "Xlcall_syscall") == 0 || strcmp(name, "Xint0x80_syscall") == 0) @@ -353,7 +342,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st strcmp(name, "Xrendezvous") == 0 || strcmp(name, "Xipi_intr_bitmap_handler") == 0) { /* No arguments. */ - narg = 0; frame_type = INTERRUPT; } } @@ -387,13 +375,23 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st } /* - * Point to base of trapframe which is just above the - * current frame. Note that struct i386_frame already accounts for one - * argument. + * Point to base of trapframe which is just above the current + * frame. Pointer to it was put into %ebp by the kernel entry + * code. */ - tf = (struct trapframe *)((char *)*fp + sizeof(struct i386_frame) + - 4 * (narg - 1)); + tf = (struct trapframe *)(*fp)->f_frame; + /* + * This can be the case for e.g. fork_trampoline, last frame + * of a kernel thread stack. + */ + if (tf == NULL) { + *ip = 0; + *fp = 0; + db_printf("--- kthread start\n"); + return; + } + esp = get_esp(tf); eip = tf->tf_eip; ebp = tf->tf_ebp; @@ -413,15 +411,20 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st } db_printf(", eip = %#r, esp = %#r, ebp = %#r ---\n", eip, esp, ebp); + /* + * Detect the last (trap) frame on the kernel stack, where we + * entered kernel from usermode. Terminate tracing in this + * case. + */ switch (frame_type) { case TRAP: case INTERRUPT: - if ((tf->tf_eflags & PSL_VM) != 0 || - (tf->tf_cs & SEL_RPL_MASK) != 0) - ebp = 0; - break; + if (!TRAPF_USERMODE(tf)) + break; + /* FALLTHROUGH */ case SYSCALL: ebp = 0; + eip = 0; break; } @@ -575,9 +578,12 @@ out: * after printing the pc if it is the kernel. */ if (frame == NULL || frame <= actframe) { - sym = db_search_symbol(pc, DB_STGY_ANY, &offset); - db_symbol_values(sym, &name, NULL); - db_print_stack_entry(name, 0, 0, 0, pc, frame); + if (pc != 0) { + sym = db_search_symbol(pc, DB_STGY_ANY, + &offset); + db_symbol_values(sym, &name, NULL); + db_print_stack_entry(name, 0, 0, 0, pc, frame); + } break; } } Modified: head/sys/i386/include/asmacros.h ============================================================================== --- head/sys/i386/include/asmacros.h Tue Nov 12 15:51:47 2019 (r354646) +++ head/sys/i386/include/asmacros.h Tue Nov 12 15:56:27 2019 (r354647) @@ -157,6 +157,7 @@ movw %es,(%esp) pushl $0 movw %fs,(%esp) + movl %esp,%ebp .endm .macro PUSH_FRAME From owner-svn-src-head@freebsd.org Tue Nov 12 16:24:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA7131B220C; Tue, 12 Nov 2019 16:24:37 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CCkY4rmQz3GXS; Tue, 12 Nov 2019 16:24:37 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AC3A260B; Tue, 12 Nov 2019 16:24:37 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACGOb7U027785; Tue, 12 Nov 2019 16:24:37 GMT (envelope-from scottph@FreeBSD.org) Received: (from scottph@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACGObd5027784; Tue, 12 Nov 2019 16:24:37 GMT (envelope-from scottph@FreeBSD.org) Message-Id: <201911121624.xACGObd5027784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottph set sender to scottph@FreeBSD.org using -f From: D Scott Phillips Date: Tue, 12 Nov 2019 16:24:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354648 - head/sys/dev/nvdimm X-SVN-Group: head X-SVN-Commit-Author: scottph X-SVN-Commit-Paths: head/sys/dev/nvdimm X-SVN-Commit-Revision: 354648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 16:24:37 -0000 Author: scottph Date: Tue Nov 12 16:24:37 2019 New Revision: 354648 URL: https://svnweb.freebsd.org/changeset/base/354648 Log: nvdimm(4): Fix various problems when the using the second label index block struct nvdimm_label_index is dynamically sized, with the `free` bitfield expanding to hold `slot_cnt` entries. Fix a few places where we were treating the struct as though it had a fixed sized. Reviewed by: cem Approved by: scottl (mentor) MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D22253 Modified: head/sys/dev/nvdimm/nvdimm.c Modified: head/sys/dev/nvdimm/nvdimm.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm.c Tue Nov 12 15:56:27 2019 (r354647) +++ head/sys/dev/nvdimm/nvdimm.c Tue Nov 12 16:24:37 2019 (r354648) @@ -183,7 +183,7 @@ label_index_is_valid(struct nvdimm_label_index *index, { uint64_t checksum; - index = (struct nvdimm_label_index *)((uint8_t *)index + offset); + index = (struct nvdimm_label_index *)((uint8_t *)index + size * offset); if (strcmp(index->signature, NVDIMM_INDEX_BLOCK_SIGNATURE) != 0) return false; checksum = index->checksum; @@ -242,7 +242,7 @@ read_label(struct nvdimm_dev *nv, int num) static int read_labels(struct nvdimm_dev *nv) { - struct nvdimm_label_index *indices; + struct nvdimm_label_index *indices, *index1; size_t bitfield_size, index_size, num_labels; int error, n; bool index_0_valid, index_1_valid; @@ -258,6 +258,7 @@ read_labels(struct nvdimm_dev *nv) sizeof(struct nvdimm_label); bitfield_size = roundup2(num_labels, 8) / 8; indices = malloc(2 * index_size, M_NVDIMM, M_WAITOK); + index1 = (void *)((uint8_t *)indices + index_size); error = read_label_area(nv, (void *)indices, 0, 2 * index_size); if (error != 0) { free(indices, M_NVDIMM); @@ -271,18 +272,29 @@ read_labels(struct nvdimm_dev *nv) free(indices, M_NVDIMM); return (ENXIO); } - if (index_0_valid && index_1_valid && - (indices[1].seq > indices[0].seq || - (indices[1].seq == 1 && indices[0].seq == 3))) - index_0_valid = false; + if (index_0_valid && index_1_valid) { + if (((int)indices->seq - (int)index1->seq + 3) % 3 == 1) { + /* index 0 was more recently updated */ + index_1_valid = false; + } else { + /* + * either index 1 was more recently updated, + * or the sequence numbers are equal, in which + * case the specification says the block with + * the higher offset is to be treated as valid + */ + index_0_valid = false; + } + } nv->label_index = malloc(index_size, M_NVDIMM, M_WAITOK); - bcopy(indices + (index_0_valid ? 0 : 1), nv->label_index, index_size); + bcopy(index_0_valid ? indices : index1, nv->label_index, index_size); free(indices, M_NVDIMM); - for (bit_ffc_at((bitstr_t *)nv->label_index->free, 0, num_labels, &n); - n >= 0; - bit_ffc_at((bitstr_t *)nv->label_index->free, n + 1, num_labels, - &n)) { + bit_ffc_at((bitstr_t *)nv->label_index->free, 0, + nv->label_index->slot_cnt, &n); + while (n >= 0) { read_label(nv, n); + bit_ffc_at((bitstr_t *)nv->label_index->free, n + 1, + nv->label_index->slot_cnt, &n); } return (0); } From owner-svn-src-head@freebsd.org Tue Nov 12 18:01:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CD311B3EE3; Tue, 12 Nov 2019 18:01:35 +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 47CFtR1N3tz3Ltx; Tue, 12 Nov 2019 18:01:35 +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 1338B397B; Tue, 12 Nov 2019 18:01:35 +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 xACI1Y9a081664; Tue, 12 Nov 2019 18:01:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACI1Y3j081660; Tue, 12 Nov 2019 18:01:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911121801.xACI1Y3j081660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 12 Nov 2019 18:01:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354649 - in head: share/man/man7 sys/amd64/amd64 sys/amd64/include sys/dev/cpuctl sys/x86/include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: share/man/man7 sys/amd64/amd64 sys/amd64/include sys/dev/cpuctl sys/x86/include X-SVN-Commit-Revision: 354649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 18:01:35 -0000 Author: kib Date: Tue Nov 12 18:01:33 2019 New Revision: 354649 URL: https://svnweb.freebsd.org/changeset/base/354649 Log: Workaround for Intel SKL002/SKL012S errata. Disable the use of executable 2M page mappings in EPT-format page tables on affected CPUs. For bhyve virtual machines, this effectively disables all use of superpage mappings on affected CPUs. The vm.pmap.allow_2m_x_ept sysctl can be set to override the default and enable mappings on affected CPUs. Alternate approaches have been suggested, but at present we do not believe the complexity is warranted for typical bhyve's use cases. Reviewed by: alc, emaste, markj, scottl Security: CVE-2018-12207 Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21884 Modified: head/share/man/man7/security.7 head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/dev/cpuctl/cpuctl.c head/sys/x86/include/specialreg.h Modified: head/share/man/man7/security.7 ============================================================================== --- head/share/man/man7/security.7 Tue Nov 12 16:24:37 2019 (r354648) +++ head/share/man/man7/security.7 Tue Nov 12 18:01:33 2019 (r354649) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 13, 2019 +.Dd November 12, 2019 .Dt SECURITY 7 .Os .Sh NAME @@ -1015,6 +1015,13 @@ hardware information leak. .It Dv hw.vmm.vmx.l1d_flush amd64. Controls the mitigation of L1 Terminal Fault in bhyve hypervisor. +.It Dv vm.pmap.allow_2m_x_ept +amd64. +Allows the use of superpages for executable mappings under the EPT +page table format used by hypervisors on Intel CPUs to map the guest +physical address space to machine physical memory. +May be disabled to work around a CPU Erratum called +Machine Check Error Avoidance on Page Size Change. .It Dv kern.elf32.aslr.enable Controls system-global Address Space Layout Randomization (ASLR) for normal non-PIE (Position Independent Executable) 32bit binaries. Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Nov 12 16:24:37 2019 (r354648) +++ head/sys/amd64/amd64/pmap.c Tue Nov 12 18:01:33 2019 (r354649) @@ -1894,6 +1894,51 @@ pmap_page_init(vm_page_t m) m->md.pat_mode = PAT_WRITE_BACK; } +static int pmap_allow_2m_x_ept; +SYSCTL_INT(_vm_pmap, OID_AUTO, allow_2m_x_ept, CTLFLAG_RWTUN | CTLFLAG_NOFETCH, + &pmap_allow_2m_x_ept, 0, + "Allow executable superpage mappings in EPT"); + +void +pmap_allow_2m_x_ept_recalculate(void) +{ + /* + * SKL002, SKL012S. Since the EPT format is only used by + * Intel CPUs, the vendor check is merely a formality. + */ + if (!(cpu_vendor_id != CPU_VENDOR_INTEL || + (cpu_ia32_arch_caps & IA32_ARCH_CAP_IF_PSCHANGE_MC_NO) != 0 || + (CPUID_TO_FAMILY(cpu_id) == 0x6 && + (CPUID_TO_MODEL(cpu_id) == 0x26 || /* Atoms */ + CPUID_TO_MODEL(cpu_id) == 0x27 || + CPUID_TO_MODEL(cpu_id) == 0x35 || + CPUID_TO_MODEL(cpu_id) == 0x36 || + CPUID_TO_MODEL(cpu_id) == 0x37 || + CPUID_TO_MODEL(cpu_id) == 0x86 || + CPUID_TO_MODEL(cpu_id) == 0x1c || + CPUID_TO_MODEL(cpu_id) == 0x4a || + CPUID_TO_MODEL(cpu_id) == 0x4c || + CPUID_TO_MODEL(cpu_id) == 0x4d || + CPUID_TO_MODEL(cpu_id) == 0x5a || + CPUID_TO_MODEL(cpu_id) == 0x5c || + CPUID_TO_MODEL(cpu_id) == 0x5d || + CPUID_TO_MODEL(cpu_id) == 0x5f || + CPUID_TO_MODEL(cpu_id) == 0x6e || + CPUID_TO_MODEL(cpu_id) == 0x7a || + CPUID_TO_MODEL(cpu_id) == 0x57 || /* Knights */ + CPUID_TO_MODEL(cpu_id) == 0x85)))) + pmap_allow_2m_x_ept = 1; + TUNABLE_INT_FETCH("hw.allow_2m_x_ept", &pmap_allow_2m_x_ept); +} + +static bool +pmap_allow_2m_x_page(pmap_t pmap, bool executable) +{ + + return (pmap->pm_type != PT_EPT || !executable || + !pmap_allow_2m_x_ept); +} + #ifdef NUMA static void pmap_init_pv_table(void) @@ -2037,6 +2082,9 @@ pmap_init(void) } } + /* IFU */ + pmap_allow_2m_x_ept_recalculate(); + /* * Initialize the vm page array entries for the kernel pmap's * page table pages. @@ -5718,6 +5766,15 @@ retry: } #if VM_NRESERVLEVEL > 0 +static bool +pmap_pde_ept_executable(pmap_t pmap, pd_entry_t pde) +{ + + if (pmap->pm_type != PT_EPT) + return (false); + return ((pde & EPT_PG_EXECUTE) != 0); +} + /* * Tries to promote the 512, contiguous 4KB page mappings that are within a * single page table page (PTP) to a single 2MB page mapping. For promotion @@ -5753,7 +5810,9 @@ pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offs firstpte = (pt_entry_t *)PHYS_TO_DMAP(*pde & PG_FRAME); setpde: newpde = *firstpte; - if ((newpde & ((PG_FRAME & PDRMASK) | PG_A | PG_V)) != (PG_A | PG_V)) { + if ((newpde & ((PG_FRAME & PDRMASK) | PG_A | PG_V)) != (PG_A | PG_V) || + !pmap_allow_2m_x_page(pmap, pmap_pde_ept_executable(pmap, + newpde))) { atomic_add_long(&pmap_pde_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_pde: failure for va %#lx" " in pmap %p", va, pmap); @@ -6185,6 +6244,12 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t PG_V = pmap_valid_bit(pmap); PMAP_LOCK_ASSERT(pmap, MA_OWNED); + if (!pmap_allow_2m_x_page(pmap, pmap_pde_ept_executable(pmap, + newpde))) { + CTR2(KTR_PMAP, "pmap_enter_pde: 2m x blocked for va %#lx" + " in pmap %p", va, pmap); + return (KERN_FAILURE); + } if ((pdpg = pmap_allocpde(pmap, va, (flags & PMAP_ENTER_NOSLEEP) != 0 ? NULL : lockp)) == NULL) { CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" @@ -6331,6 +6396,7 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_o va = start + ptoa(diff); if ((va & PDRMASK) == 0 && va + NBPDR <= end && m->psind == 1 && pmap_ps_enabled(pmap) && + pmap_allow_2m_x_page(pmap, (prot & VM_PROT_EXECUTE) != 0) && pmap_enter_2mpage(pmap, va, m, prot, &lock)) m = &m[NBPDR / PAGE_SIZE - 1]; else Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Tue Nov 12 16:24:37 2019 (r354648) +++ head/sys/amd64/include/pmap.h Tue Nov 12 18:01:33 2019 (r354649) @@ -422,6 +422,7 @@ struct thread; void pmap_activate_boot(pmap_t pmap); void pmap_activate_sw(struct thread *); +void pmap_allow_2m_x_ept_recalculate(void); void pmap_bootstrap(vm_paddr_t *); int pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde); int pmap_change_attr(vm_offset_t, vm_size_t, int); Modified: head/sys/dev/cpuctl/cpuctl.c ============================================================================== --- head/sys/dev/cpuctl/cpuctl.c Tue Nov 12 16:24:37 2019 (r354648) +++ head/sys/dev/cpuctl/cpuctl.c Tue Nov 12 18:01:33 2019 (r354649) @@ -50,6 +50,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -539,6 +543,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td hw_ssb_recalculate(true); #ifdef __amd64__ amd64_syscall_ret_flush_l1d_recalc(); + pmap_allow_2m_x_ept_recalculate(); #endif hw_mds_recalculate(); printcpuinfo(); Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Tue Nov 12 16:24:37 2019 (r354648) +++ head/sys/x86/include/specialreg.h Tue Nov 12 18:01:33 2019 (r354649) @@ -490,6 +490,7 @@ #define IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY 0x00000008 #define IA32_ARCH_CAP_SSB_NO 0x00000010 #define IA32_ARCH_CAP_MDS_NO 0x00000020 +#define IA32_ARCH_CAP_IF_PSCHANGE_MC_NO 0x00000040 /* * CPUID manufacturers identifiers From owner-svn-src-head@freebsd.org Tue Nov 12 19:15:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B4301B6F9C; Tue, 12 Nov 2019 19:15:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CHWT2P0Lz3y5M; Tue, 12 Nov 2019 19:15:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C520472B; Tue, 12 Nov 2019 19:15:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACJFHES028644; Tue, 12 Nov 2019 19:15:17 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACJFGli028643; Tue, 12 Nov 2019 19:15:16 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911121915.xACJFGli028643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 12 Nov 2019 19:15:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354655 - in head/sys/x86: include x86 X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys/x86: include x86 X-SVN-Commit-Revision: 354655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 19:15:17 -0000 Author: scottl Date: Tue Nov 12 19:15:16 2019 New Revision: 354655 URL: https://svnweb.freebsd.org/changeset/base/354655 Log: Add new bit definitions for TSX, related to the TAA issue. The actual mitigation will follow in a future commit. Sponsored by: Intel Modified: head/sys/x86/include/specialreg.h head/sys/x86/x86/identcpu.c Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Tue Nov 12 18:13:51 2019 (r354654) +++ head/sys/x86/include/specialreg.h Tue Nov 12 19:15:16 2019 (r354655) @@ -491,7 +491,13 @@ #define IA32_ARCH_CAP_SSB_NO 0x00000010 #define IA32_ARCH_CAP_MDS_NO 0x00000020 #define IA32_ARCH_CAP_IF_PSCHANGE_MC_NO 0x00000040 +#define IA32_ARCH_CAP_TSX_CTRL 0x00000080 +#define IA32_ARCH_CAP_TAA_NO 0x00000100 +/* MSR IA32_TSX_CTRL bits */ +#define IA32_TSX_CTRL_RTM_DISABLE 0x00000001 +#define IA32_TSX_CTRL_TSX_CPUID_CLEAR 0x00000002 + /* * CPUID manufacturers identifiers */ @@ -543,6 +549,7 @@ #define MSR_BBL_CR_TRIG 0x11a #define MSR_BBL_CR_BUSY 0x11b #define MSR_BBL_CR_CTL3 0x11e +#define MSR_IA32_TSX_CTRL 0x122 #define MSR_SYSENTER_CS_MSR 0x174 #define MSR_SYSENTER_ESP_MSR 0x175 #define MSR_SYSENTER_EIP_MSR 0x176 Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Tue Nov 12 18:13:51 2019 (r354654) +++ head/sys/x86/x86/identcpu.c Tue Nov 12 19:15:16 2019 (r354655) @@ -1046,6 +1046,8 @@ printcpuinfo(void) "\004SKIP_L1DFL_VME" "\005SSB_NO" "\006MDS_NO" + "\010TSX_CTRL" + "\011TAA_NO" ); } From owner-svn-src-head@freebsd.org Tue Nov 12 21:07:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CACB91BAFB3; Tue, 12 Nov 2019 21:07:51 +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 47CL1M55QFz46Kg; Tue, 12 Nov 2019 21:07:51 +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 938655AC3; Tue, 12 Nov 2019 21:07:51 +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 xACL7pRq093829; Tue, 12 Nov 2019 21:07:51 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACL7pjd093828; Tue, 12 Nov 2019 21:07:51 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911122107.xACL7pjd093828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 12 Nov 2019 21:07:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354659 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 354659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 21:07:51 -0000 Author: vmaffione Date: Tue Nov 12 21:07:51 2019 New Revision: 354659 URL: https://svnweb.freebsd.org/changeset/base/354659 Log: bhyve: rework mevent processing to fix a race condition At the end of both mevent_add() and mevent_update(), mevent_notify() is called to wakeup the I/O thread, that will call kevent(changelist) to update the kernel. A race condition is possible where the client calls mevent_add() and mevent_update(EV_ENABLE) before the I/O thread has the chance to wake up and call mevent_build()+kevent(changelist) in response to mevent_add(). The mevent_add() is therefore ignored by the I/O thread, and kevent(fd, EV_ENABLE) is called before kevent(fd, EV_ADD), resuliting in a failure of the kevent(fd, EV_ENABLE) call. PR: 241808 Reviewed by: jhb, markj MFC with: r354288 Differential Revision: https://reviews.freebsd.org/D22286 Modified: head/usr.sbin/bhyve/mevent.c Modified: head/usr.sbin/bhyve/mevent.c ============================================================================== --- head/usr.sbin/bhyve/mevent.c Tue Nov 12 19:35:46 2019 (r354658) +++ head/usr.sbin/bhyve/mevent.c Tue Nov 12 21:07:51 2019 (r354659) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #include #include #include @@ -62,12 +63,6 @@ __FBSDID("$FreeBSD$"); #define MEVENT_MAX 64 -#define MEV_ADD 1 -#define MEV_ENABLE 2 -#define MEV_DISABLE 3 -#define MEV_DEL_PENDING 4 -#define MEV_ADD_DISABLED 5 - extern char *vmname; static pthread_t mevent_tid; @@ -83,7 +78,7 @@ struct mevent { enum ev_type me_type; void *me_param; int me_cq; - int me_state; + int me_state; /* Desired kevent flags. */ int me_closefd; LIST_ENTRY(mevent) me_list; }; @@ -156,30 +151,7 @@ mevent_kq_filter(struct mevent *mevp) static int mevent_kq_flags(struct mevent *mevp) { - int ret; - - switch (mevp->me_state) { - case MEV_ADD: - ret = EV_ADD; /* implicitly enabled */ - break; - case MEV_ADD_DISABLED: - ret = EV_ADD | EV_DISABLE; - break; - case MEV_ENABLE: - ret = EV_ENABLE; - break; - case MEV_DISABLE: - ret = EV_DISABLE; - break; - case MEV_DEL_PENDING: - ret = EV_DELETE; - break; - default: - assert(0); - break; - } - - return (ret); + return (mevp->me_state); } static int @@ -224,9 +196,15 @@ mevent_build(int mfd, struct kevent *kev) mevp->me_cq = 0; LIST_REMOVE(mevp, me_list); - if (mevp->me_state == MEV_DEL_PENDING) { + if (mevp->me_state & EV_DELETE) { free(mevp); } else { + /* + * We need to add the event only once, so we can + * reset the EV_ADD bit after it has been propagated + * to the kevent() arguments the first time. + */ + mevp->me_state &= ~EV_ADD; LIST_INSERT_HEAD(&global_head, mevp, me_list); } @@ -318,7 +296,7 @@ mevent_add(int tfd, enum ev_type type, void (*func)(int, enum ev_type, void *), void *param) { - return mevent_add_state(tfd, type, func, param, MEV_ADD); + return (mevent_add_state(tfd, type, func, param, EV_ADD)); } struct mevent * @@ -326,36 +304,46 @@ mevent_add_disabled(int tfd, enum ev_type type, void (*func)(int, enum ev_type, void *), void *param) { - return mevent_add_state(tfd, type, func, param, MEV_ADD_DISABLED); + return (mevent_add_state(tfd, type, func, param, EV_ADD | EV_DISABLE)); } static int -mevent_update(struct mevent *evp, int newstate) +mevent_update(struct mevent *evp, bool enable) { + int newstate; + + mevent_qlock(); + /* * It's not possible to enable/disable a deleted event */ - if (evp->me_state == MEV_DEL_PENDING) - return (EINVAL); + assert((evp->me_state & EV_DELETE) == 0); + newstate = evp->me_state; + if (enable) { + newstate |= EV_ENABLE; + newstate &= ~EV_DISABLE; + } else { + newstate |= EV_DISABLE; + newstate &= ~EV_ENABLE; + } + /* * No update needed if state isn't changing */ - if (evp->me_state == newstate) - return (0); - - mevent_qlock(); + if (evp->me_state != newstate) { + evp->me_state = newstate; - evp->me_state = newstate; - - /* - * Place the entry onto the changed list if not already there. - */ - if (evp->me_cq == 0) { - evp->me_cq = 1; - LIST_REMOVE(evp, me_list); - LIST_INSERT_HEAD(&change_head, evp, me_list); - mevent_notify(); + /* + * Place the entry onto the changed list if not + * already there. + */ + if (evp->me_cq == 0) { + evp->me_cq = 1; + LIST_REMOVE(evp, me_list); + LIST_INSERT_HEAD(&change_head, evp, me_list); + mevent_notify(); + } } mevent_qunlock(); @@ -367,14 +355,14 @@ int mevent_enable(struct mevent *evp) { - return (mevent_update(evp, MEV_ENABLE)); + return (mevent_update(evp, true)); } int mevent_disable(struct mevent *evp) { - return (mevent_update(evp, MEV_DISABLE)); + return (mevent_update(evp, false)); } static int @@ -392,7 +380,7 @@ mevent_delete_event(struct mevent *evp, int closefd) LIST_INSERT_HEAD(&change_head, evp, me_list); mevent_notify(); } - evp->me_state = MEV_DEL_PENDING; + evp->me_state = EV_DELETE; if (closefd) evp->me_closefd = 1; From owner-svn-src-head@freebsd.org Tue Nov 12 21:14:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C02D91BB3C5; Tue, 12 Nov 2019 21:14:31 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CL934kmLz471N; Tue, 12 Nov 2019 21:14:31 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Received: from tommy.madpilot.net (host26-128-dynamic.17-87-r.retail.telecomitalia.it [87.17.128.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: madpilot/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 023FCC761; Tue, 12 Nov 2019 21:14:30 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Subject: Re: svn commit: r354491 - in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 To: Brooks Davis , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911072258.xA7MwBkh050268@repo.freebsd.org> From: Guido Falsi Autocrypt: addr=madpilot@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBE+G+l0BCADi/WBQ0aRJfnE7LBPsM0G3m/m3Yx7OPu4iYFvS84xawmRHtCNjWIntsxuX fptkmEo3Rsw816WUrek8dxoUAYdHd+EcpBcnnDzfDH5LW/TZ4gbrFezrHPdRp7wdxi23GN80 qPwHEwXuF0X4Wy5V0OO8B6VT/nA0ADYnBDhXS52HGIJ/GCUjgqJn+phDTdCFLvrSFdmgx4Wl c0W5Z1p5cmDF9l8L/hc959AeyNf7I9dXnjekGM9gVv7UDUYzCifR3U8T0fnfdMmS8NeI9NC+ wuREpRO4lKOkTnj9TtQJRiptlhcHQiAlG1cFqs7EQo57Tqq6cxD1FycZJLuC32bGbgalABEB AAG0Ikd1aWRvIEZhbHNpIDxtYWRwaWxvdEBGcmVlQlNELm9yZz6JATYEEwEIACACGwMCHgEC F4AFAlLvzwUFCwkIBwMFFQoJCAsEFgIDAQAKCRAa5oYOVsvSk6EzCAC4ovSo6XF4x0spuKmp RzVuZ5ywqCJAfRIrJHpW8HjSPkcUYwmXVOE3zjul9j2C2eHPPGobEDN5FqovAtzb7HdYGGcU aUdhDApUMMRVkzflwb23C/CI1RBcZxjC0noajSKgbIHx4+Afg6CFMgpngq+NJwEaaVrKlYzq G+KcfeVKAdwlWHJOgQJIEylUtwtBqXx/iJDrGwKO5A6a1uSEZrZfuwjSh8cBqoUfIwLZUIFE HBjHa8pUkp8mWx7JaZ19vBF6pDpPVZSoLSg8stWd1DPesn/qySYgtSGSY6hpWABVF98HRsBG +VXlHtqCaB0j0cGCDhCpHQUI10oGGc8k4zcvuQINBFMQe0EBEAChYaw3HqD3SvyBw0pqI+kk GIrLzO1XYXJXkuxPQ6BAFbe8jG3+h22zFU02OnJL8E1kLLMsCwVzVasYHOFiyY831IYHn/lh O+TN/lhWJTlUCxmWP8xFYJmta2mJzhzQDs3hyw5hF422T+rxgHg8gWxn0D6RO6hmGe7m3k91 8EDvj5JXAq7zj49mT3AMRjUtsVVPy8zjagqyaizCUiHAnbG4kj+BuT5wxR7TKJGk2OjhK/Dh EHzgHq4XB1Gv8+1LvGLZmqih/kBpBP1hIGkakok579CTkw/g8XoWqr6Cjz2fvtjaQmTBwdou gP8Yn5kMBIiIxF7XLngUc5DVEJMYamcktd0q4aHC/cnbWlTwc2WrQBI1AwxCZgDC1RbOOan8 oTIjWqRyaNp9zFvxOaJqgrxJA3Vl/3p9z+witk3pnmg4ITLIJDSmsf89MDaOVGQpDjzs9MaT YlIpTlW5Lns2WTYOue+NanntpX14UCGmeusk+4aYXPzf89zyALS3s3uLtVUdhFwLmdrFgHZS gjU5STLGlP8e9AVddVnf8qZ1czOvHX3UCCAI9YjBQA/5VxpRFJil4OTr9lUA5U57UKGpwmKw IPvArbT8468nYC2Rat4a7UJn3NLHucr9Vh0uvfgbFDhtPUb72sFA2cVI1tfZMnjfUx2jUYKM N5ErgK1Kes0piQARAQABiQEfBBgBCAAJBQJTEHtBAhsMAAoJEBrmhg5Wy9KTDecIAOGwpF/6 sBFQtOk6HkegtqbrZklkDIKQ2qq7+uR7m6PkBpoNj+HsE2EEOIOqGFktN6h8alVVoSs+xY36 1fnR/Kmwi30oCHL3QYWu2shmVa7IrjCyhm8N+n3JpGT6Ugznx3D9Fx/GfrvQlo9MVJE8QJWf +4uoGElKRtiVjbXZhP1/FVRMl7rAi8MtCtASOtAP+HUUyF9wuECqyd2W1F3oM+9Mp4x3/pUD GfSGSgEqETLkuRaMz0Iemm75sGRD3X+SPa4lBJc7x66ifAcdLdz7o3aLYfsjR6Zwca7TvC5E Ha0OfD9EsHGiF9909lPaRvG4buWFUfPBUPDkNHBLDwaQ53K5AQ0ET4b6XQEIALHepqzqtRkm cJc0bHDUGvVtlgf904+DjeDy9nvQfoXPZU/58tswd2oF7ucG7F088MYCaUE+4TR5AknJFvfI dx0YxX4WTzQoCJ7lBrI3DclYLkIfv+O3JIaYdLO1PugeMjbiIqkGZOJqPFoAjY9WCIoVZhlh LIAzsDGmo2w2GdK9f9xpCpWIzl3lLk/1oKLq60keaGSVTQP5OF9h+zNyVK9QUnN9i+wSbfDO wJ7bpepNeydC/BppLy701LUEzvqfg2EDJ2tp4A9z2wL0EXGxBp5IPQAa3RBdFqeBsfoBhlrM hSpR7z3TLYFgMtybEvq0GqRui6Ft8lCacKRKQPOinQcAEQEAAYkBHwQoAQgACQUCUxB9DQId AQAKCRAa5oYOVsvSkzGXCADErInRheCqYxnCs4ZDStLBKXr3HpUOg84E+5HF7qui0OmDq26H 9vyj4Bonvf06BWXyVx/MxORnn6pCrx2W2LLFopRb5CPdBfZ9d/JBttOTQf9s5WkG++P7/WTF yV3IqZyMfk9rTjAgYByVONSDCZgfjX0beQOgg8rSXYVsaqabBKOY48v+7STNTZ+OxvO7QFfK lTVLc20us3Z2xweFtgScAjm21b/HqS94bvy+Xn1do9rUm1U5sryvwpWDAanbVKN7j1++Rhfy rmAwjj9QUwOc85s6eDzFXfoJh3DIAmSmOpb3BLXYuRSyNMHtpHGPH3z7zNnejDYRbBi2lSPe SdKKiQEfBBgBAgAJBQJPhvpdAhsMAAoJEBrmhg5Wy9KTNfEH/R0zTYbvDdCEirZkfJYD4Sbr vPazhGvCihGra+H0O4C/oZmDhKmf8hy3D0LxsWwJS0exdEoXirwBJOAdWhcBlCz6NEs7jtHf 1rVTBGxmveSU5v+pn4spljJVn/FInw9TAys8z0ezptMm3qDzPEv0UE26FFNVi6cHeJoPaVSZ StMa+eRjkhzX+Ju0vj9ZL5d8YJhI9eM1TKvciQTVhZbECuXIon4e7BaX7sVnRFW7YCHcacyJ ii10iwNLzq6CgL8RUxgawat78VenlJmisneR221no5mn2NbmuXXJ3sPZcaVii3apAtu1bdAp Lvi7U2N99uVfgQoZ3MDXCSUuyDJgc+s= Message-ID: <989e5f0c-fec1-48fc-78e3-744049cfcba8@FreeBSD.org> Date: Tue, 12 Nov 2019 22:14:28 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <201911072258.xA7MwBkh050268@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 21:14:31 -0000 On 07/11/19 23:58, Brooks Davis wrote: > Author: brooks > Date: Thu Nov 7 22:58:10 2019 > New Revision: 354491 > URL: https://svnweb.freebsd.org/changeset/base/354491 > > Log: > libcompat: build 32-bit rtld and ldd as part of "everything" > > Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included > directly so MD paths in Makefiles work. In the process centralize > setting them in LIBCOMPATWMAKEENV. > > Alter .PATH and CFLAGS settings in work when the Makefile is included. > > While here only support LIB32 on supported platforms rather than always > enabling it and requiring users of MK_LIB32 to filter based > TARGET/MACHINE_ARCH. > > The net effect of this change is to make Makefile.libcompat only build > compatability libraries. > > Changes relative to r354449: > > Correct detection of the compiler type when bsd.compat.mk is used > outside Makefile.libcompat. Previously it always matched the clang > case. > > Set LDFLAGS including the linker emulation for mips where -m32 seems to > be insufficent. > > Reviewed by: imp, kib (origional version in r354449) > Obtained from: CheriBSD (conceptually) > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D22251 > Hi, I'm using pkgbase on my head machines and I'm getting this when upgrading packages on head now: Checking integrity... done (1 conflicting) - FreeBSD-clibs-lib32-13.0.s20191112204216 [mpnet-base] conflicts with FreeBSD-clibs-13.0.s20191112204216 [installed] on /usr/share/man/man1/ld-elf.so.1.1.gz So now these packages, which should be able to cohexist conflict on the man page. I'm not sure, but wthis commit looks like a good candidate for causing this. Sorry if I'm wrong. > Modified: head/libexec/rtld-elf/Makefile > ============================================================================== > --- head/libexec/rtld-elf/Makefile Thu Nov 7 22:26:54 2019 (r354490) > +++ head/libexec/rtld-elf/Makefile Thu Nov 7 22:58:10 2019 (r354491) > @@ -4,6 +4,8 @@ > # linker: > # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all > > +RTLD_ELF_DIR:= ${.PARSEDIR} > + > .include > PACKAGE= clibs > MK_PIE= no # Always position independent using local rules > @@ -25,16 +27,16 @@ SRCS= \ > xmalloc.c \ > debug.c \ > libmap.c > -MAN= rtld.1 > +MAN?= rtld.1 Maybe this part is not workking as expected? -- Guido Falsi From owner-svn-src-head@freebsd.org Tue Nov 12 21:26:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA4D01BB843; Tue, 12 Nov 2019 21:26:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CLRG5vF7z47lH; Tue, 12 Nov 2019 21:26:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE28B5E7E; Tue, 12 Nov 2019 21:26:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACLQobq005798; Tue, 12 Nov 2019 21:26:50 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACLQosD005797; Tue, 12 Nov 2019 21:26:50 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911122126.xACLQosD005797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 12 Nov 2019 21:26:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354660 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 21:26:51 -0000 Author: jhb Date: Tue Nov 12 21:26:50 2019 New Revision: 354660 URL: https://svnweb.freebsd.org/changeset/base/354660 Log: Enable the RISC-V LLVM backend by default. Reviewed by: dim, mhorne, emaste MFC after: 1 month Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22284 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Nov 12 21:07:51 2019 (r354659) +++ head/share/mk/src.opts.mk Tue Nov 12 21:26:50 2019 (r354660) @@ -276,6 +276,7 @@ __LLVM_TARGETS= \ arm \ mips \ powerpc \ + riscv \ sparc \ x86 __LLVM_TARGET_FILT= C/(amd64|i386)/x86/:S/sparc64/sparc/:S/arm64/aarch64/:S/powerpc64/powerpc/ @@ -298,7 +299,6 @@ __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__ .endfor __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF -__DEFAULT_NO_OPTIONS+=LLVM_TARGET_RISCV .include # If the compiler is not C++11 capable, disable Clang and use GCC instead. @@ -310,7 +310,7 @@ __DEFAULT_NO_OPTIONS+=LLVM_TARGET_RISCV # Clang is enabled, and will be installed as the default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC -.elif ${COMPILER_FEATURES:Mc++11} && ${__T:Mriscv*} == "" && ${__T} != "sparc64" +.elif ${COMPILER_FEATURES:Mc++11} && ${__T} != "sparc64" # If an external compiler that supports C++11 is used as ${CC} and Clang # supports the target, then Clang is enabled but GCC is installed as the # default /usr/bin/cc. From owner-svn-src-head@freebsd.org Tue Nov 12 21:29:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7170C1BB95B; Tue, 12 Nov 2019 21:29:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CLVn2MCXz47vk; Tue, 12 Nov 2019 21:29:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 342FE5E8C; Tue, 12 Nov 2019 21:29:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACLTrVN005969; Tue, 12 Nov 2019 21:29:53 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACLTril005968; Tue, 12 Nov 2019 21:29:53 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911122129.xACLTril005968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 12 Nov 2019 21:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354661 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 21:29:53 -0000 Author: jhb Date: Tue Nov 12 21:29:52 2019 New Revision: 354661 URL: https://svnweb.freebsd.org/changeset/base/354661 Log: Force MK_CLANG_IS_CC on in XMAKE. This ensures that a bootstrap clang compiler is always installed as cc in WORLDTMP. If it is only installed as 'clang' then /usr/bin/cc is used during the build instead of the bootstrap compiler. Reviewed by: imp MFC after: 1 month Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22332 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Nov 12 21:26:50 2019 (r354660) +++ head/Makefile.inc1 Tue Nov 12 21:29:52 2019 (r354661) @@ -734,6 +734,7 @@ TMAKE= \ # TOOLS_PREFIX set in BMAKE XMAKE= ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ + MK_CLANG_IS_CC=yes \ MK_GDB=no MK_TESTS=no # kernel-tools stage From owner-svn-src-head@freebsd.org Tue Nov 12 21:35:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2C9E1BBCD4; Tue, 12 Nov 2019 21:35:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CLcp3tRZz48Xt; Tue, 12 Nov 2019 21:35:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 692C5605A; Tue, 12 Nov 2019 21:35:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACLZ685011702; Tue, 12 Nov 2019 21:35:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACLZ6Im011701; Tue, 12 Nov 2019 21:35:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911122135.xACLZ6Im011701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 12 Nov 2019 21:35:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354662 - head/lib/clang X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/clang X-SVN-Commit-Revision: 354662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 21:35:06 -0000 Author: jhb Date: Tue Nov 12 21:35:05 2019 New Revision: 354662 URL: https://svnweb.freebsd.org/changeset/base/354662 Log: Sync target triple generation with the version in Makefile.inc1. Reviewed by: dim Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22333 Modified: head/lib/clang/llvm.build.mk Modified: head/lib/clang/llvm.build.mk ============================================================================== --- head/lib/clang/llvm.build.mk Tue Nov 12 21:29:52 2019 (r354661) +++ head/lib/clang/llvm.build.mk Tue Nov 12 21:35:05 2019 (r354662) @@ -36,8 +36,8 @@ TARGET_ABI= VENDOR= unknown OS_VERSION= freebsd13.0 -LLVM_TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI} -LLVM_BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION} +LLVM_TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI} +LLVM_BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-${OS_VERSION} CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${LLVM_TARGET_TRIPLE}\" CFLAGS+= -DLLVM_HOST_TRIPLE=\"${LLVM_BUILD_TRIPLE}\" From owner-svn-src-head@freebsd.org Tue Nov 12 22:32:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D5A81BD4C4; Tue, 12 Nov 2019 22:32:01 +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 47CMtS72sMz4CSZ; Tue, 12 Nov 2019 22:32:00 +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 D51A469F5; Tue, 12 Nov 2019 22:32:00 +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 xACMW0fZ046773; Tue, 12 Nov 2019 22:32:00 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACMW0OO046771; Tue, 12 Nov 2019 22:32:00 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911122232.xACMW0OO046771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 12 Nov 2019 22:32:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354663 - in head: libexec/rtld-elf libexec/rtld-elf32 usr.bin/ldd32 X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: libexec/rtld-elf libexec/rtld-elf32 usr.bin/ldd32 X-SVN-Commit-Revision: 354663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 22:32:01 -0000 Author: brooks Date: Tue Nov 12 22:31:59 2019 New Revision: 354663 URL: https://svnweb.freebsd.org/changeset/base/354663 Log: libcompat: Correct rtld MLINKS Don't install duplicate ld-elf.so.1.1 and ld.so.1 links in rtld-elf32. Do install lib-elf32.so.1.1 and ldd32.1 links. Reported by: madpilot Modified: head/libexec/rtld-elf/Makefile head/libexec/rtld-elf32/Makefile head/usr.bin/ldd32/Makefile Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Tue Nov 12 21:35:05 2019 (r354662) +++ head/libexec/rtld-elf/Makefile Tue Nov 12 22:31:59 2019 (r354663) @@ -49,7 +49,7 @@ INSTALLFLAGS= -C -b PRECIOUSPROG= BINDIR= /libexec SYMLINKS= ../..${BINDIR}/${PROG} ${LIBEXECDIR}/${PROG} -MLINKS= rtld.1 ld-elf.so.1.1 \ +MLINKS?= rtld.1 ld-elf.so.1.1 \ rtld.1 ld.so.1 .if ${MACHINE_CPUARCH} == "sparc64" Modified: head/libexec/rtld-elf32/Makefile ============================================================================== --- head/libexec/rtld-elf32/Makefile Tue Nov 12 21:35:05 2019 (r354662) +++ head/libexec/rtld-elf32/Makefile Tue Nov 12 22:31:59 2019 (r354663) @@ -5,6 +5,7 @@ NEED_COMPAT= 32 PROG= ld-elf32.so.1 MAN= +MLINKS= rtld.1 ld-elf32.so.1 .PATH: ${SRCTOP}/libexec/rtld-elf .include "${SRCTOP}/libexec/rtld-elf/Makefile" Modified: head/usr.bin/ldd32/Makefile ============================================================================== --- head/usr.bin/ldd32/Makefile Tue Nov 12 21:35:05 2019 (r354662) +++ head/usr.bin/ldd32/Makefile Tue Nov 12 22:31:59 2019 (r354663) @@ -5,6 +5,7 @@ NEED_COMPAT= 32 PROG= ldd32 MAN= +MLINKS= ldd.1 ldd32.1 .PATH: ${SRCTOP}/usr.bin/ldd .include "${SRCTOP}/usr.bin/ldd/Makefile" From owner-svn-src-head@freebsd.org Tue Nov 12 22:33:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F8151BD559; Tue, 12 Nov 2019 22:33:42 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47CMwP5LFdz4Clx; Tue, 12 Nov 2019 22:33:41 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id AFAC83C0199; Tue, 12 Nov 2019 22:33:34 +0000 (UTC) Date: Tue, 12 Nov 2019 22:33:34 +0000 From: Brooks Davis To: Guido Falsi Cc: Brooks Davis , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354491 - in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 Message-ID: <20191112223334.GA16457@spindle.one-eyed-alien.net> References: <201911072258.xA7MwBkh050268@repo.freebsd.org> <989e5f0c-fec1-48fc-78e3-744049cfcba8@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OXfL5xGRrasGEqWY" Content-Disposition: inline In-Reply-To: <989e5f0c-fec1-48fc-78e3-744049cfcba8@FreeBSD.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 47CMwP5LFdz4Clx X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-6.51 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE(-3.61)[ip: (-9.44), ipnet: 199.48.128.0/22(-4.71), asn: 36236(-3.85), country: US(-0.05)]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 22:33:42 -0000 --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 12, 2019 at 10:14:28PM +0100, Guido Falsi wrote: > On 07/11/19 23:58, Brooks Davis wrote: > > Author: brooks > > Date: Thu Nov 7 22:58:10 2019 > > New Revision: 354491 > > URL: https://svnweb.freebsd.org/changeset/base/354491 > >=20 > > Log: > > libcompat: build 32-bit rtld and ldd as part of "everything" > > =20 > > Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included > > directly so MD paths in Makefiles work. In the process centralize > > setting them in LIBCOMPATWMAKEENV. > > =20 > > Alter .PATH and CFLAGS settings in work when the Makefile is included. > > =20 > > While here only support LIB32 on supported platforms rather than alwa= ys > > enabling it and requiring users of MK_LIB32 to filter based > > TARGET/MACHINE_ARCH. > > =20 > > The net effect of this change is to make Makefile.libcompat only build > > compatability libraries. > > =20 > > Changes relative to r354449: > > =20 > > Correct detection of the compiler type when bsd.compat.mk is used > > outside Makefile.libcompat. Previously it always matched the clang > > case. > > =20 > > Set LDFLAGS including the linker emulation for mips where -m32 seems = to > > be insufficent. > > =20 > > Reviewed by: imp, kib (origional version in r354449) > > Obtained from: CheriBSD (conceptually) > > Sponsored by: DARPA, AFRL > > Differential Revision: https://reviews.freebsd.org/D22251 > >=20 >=20 > Hi, >=20 > I'm using pkgbase on my head machines and I'm getting this when > upgrading packages on head now: >=20 > Checking integrity... done (1 conflicting) > - FreeBSD-clibs-lib32-13.0.s20191112204216 [mpnet-base] conflicts with > FreeBSD-clibs-13.0.s20191112204216 [installed] on > /usr/share/man/man1/ld-elf.so.1.1.gz >=20 >=20 > So now these packages, which should be able to cohexist conflict on the > man page. >=20 > I'm not sure, but wthis commit looks like a good candidate for causing th= is. It turns out that I'd missed there being an MLINKS variable. The MAN?=3D part worked as designed but the new code was installing duplication links to rtld.1. Should be fixed in r354663. Thanks, Brooks --OXfL5xGRrasGEqWY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJdyzM+AAoJEKzQXbSebgfANrMH/2xuzYRjMW3Kg6mNIahCszm4 Rb2cgqbm+5fnybxRLWYaPx9Ntra2L3cn0CvrcC8IG6oGEBL10Blf7X+DvJ31lqLO SU4Vrtvn5aemTep2j715HssXpLshL7ZcspxnBf4B97mEK8VYkzAgi53lCe2w0EVR xcdm6otH2xh6uILyYXsyZUnHoyfMllE+CeLLCgaSDHI64Zilx71X1ehPCTPKrerI R9UdE0S6A5eRoveizh8WPcdk2LsBTUcriiLmGOwqt7ytl1z2hk7avwIJ6rwe/b11 gmesyl+YNxAw860cB/BbSrV8UXvGLh80DF6/EvUE4ycUOCovx0J8MDOiZPRbjmw= =qD7/ -----END PGP SIGNATURE----- --OXfL5xGRrasGEqWY-- From owner-svn-src-head@freebsd.org Tue Nov 12 22:44:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2A6A1BD862; Tue, 12 Nov 2019 22:44:59 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CN9R59W4z4DF8; Tue, 12 Nov 2019 22:44:59 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Received: from tommy.madpilot.net (host26-128-dynamic.17-87-r.retail.telecomitalia.it [87.17.128.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: madpilot/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 0E886D1A7; Tue, 12 Nov 2019 22:44:58 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Subject: Re: svn commit: r354491 - in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911072258.xA7MwBkh050268@repo.freebsd.org> <989e5f0c-fec1-48fc-78e3-744049cfcba8@FreeBSD.org> <20191112223334.GA16457@spindle.one-eyed-alien.net> From: Guido Falsi Autocrypt: addr=madpilot@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBE+G+l0BCADi/WBQ0aRJfnE7LBPsM0G3m/m3Yx7OPu4iYFvS84xawmRHtCNjWIntsxuX fptkmEo3Rsw816WUrek8dxoUAYdHd+EcpBcnnDzfDH5LW/TZ4gbrFezrHPdRp7wdxi23GN80 qPwHEwXuF0X4Wy5V0OO8B6VT/nA0ADYnBDhXS52HGIJ/GCUjgqJn+phDTdCFLvrSFdmgx4Wl c0W5Z1p5cmDF9l8L/hc959AeyNf7I9dXnjekGM9gVv7UDUYzCifR3U8T0fnfdMmS8NeI9NC+ wuREpRO4lKOkTnj9TtQJRiptlhcHQiAlG1cFqs7EQo57Tqq6cxD1FycZJLuC32bGbgalABEB AAG0Ikd1aWRvIEZhbHNpIDxtYWRwaWxvdEBGcmVlQlNELm9yZz6JATYEEwEIACACGwMCHgEC F4AFAlLvzwUFCwkIBwMFFQoJCAsEFgIDAQAKCRAa5oYOVsvSk6EzCAC4ovSo6XF4x0spuKmp RzVuZ5ywqCJAfRIrJHpW8HjSPkcUYwmXVOE3zjul9j2C2eHPPGobEDN5FqovAtzb7HdYGGcU aUdhDApUMMRVkzflwb23C/CI1RBcZxjC0noajSKgbIHx4+Afg6CFMgpngq+NJwEaaVrKlYzq G+KcfeVKAdwlWHJOgQJIEylUtwtBqXx/iJDrGwKO5A6a1uSEZrZfuwjSh8cBqoUfIwLZUIFE HBjHa8pUkp8mWx7JaZ19vBF6pDpPVZSoLSg8stWd1DPesn/qySYgtSGSY6hpWABVF98HRsBG +VXlHtqCaB0j0cGCDhCpHQUI10oGGc8k4zcvuQINBFMQe0EBEAChYaw3HqD3SvyBw0pqI+kk GIrLzO1XYXJXkuxPQ6BAFbe8jG3+h22zFU02OnJL8E1kLLMsCwVzVasYHOFiyY831IYHn/lh O+TN/lhWJTlUCxmWP8xFYJmta2mJzhzQDs3hyw5hF422T+rxgHg8gWxn0D6RO6hmGe7m3k91 8EDvj5JXAq7zj49mT3AMRjUtsVVPy8zjagqyaizCUiHAnbG4kj+BuT5wxR7TKJGk2OjhK/Dh EHzgHq4XB1Gv8+1LvGLZmqih/kBpBP1hIGkakok579CTkw/g8XoWqr6Cjz2fvtjaQmTBwdou gP8Yn5kMBIiIxF7XLngUc5DVEJMYamcktd0q4aHC/cnbWlTwc2WrQBI1AwxCZgDC1RbOOan8 oTIjWqRyaNp9zFvxOaJqgrxJA3Vl/3p9z+witk3pnmg4ITLIJDSmsf89MDaOVGQpDjzs9MaT YlIpTlW5Lns2WTYOue+NanntpX14UCGmeusk+4aYXPzf89zyALS3s3uLtVUdhFwLmdrFgHZS gjU5STLGlP8e9AVddVnf8qZ1czOvHX3UCCAI9YjBQA/5VxpRFJil4OTr9lUA5U57UKGpwmKw IPvArbT8468nYC2Rat4a7UJn3NLHucr9Vh0uvfgbFDhtPUb72sFA2cVI1tfZMnjfUx2jUYKM N5ErgK1Kes0piQARAQABiQEfBBgBCAAJBQJTEHtBAhsMAAoJEBrmhg5Wy9KTDecIAOGwpF/6 sBFQtOk6HkegtqbrZklkDIKQ2qq7+uR7m6PkBpoNj+HsE2EEOIOqGFktN6h8alVVoSs+xY36 1fnR/Kmwi30oCHL3QYWu2shmVa7IrjCyhm8N+n3JpGT6Ugznx3D9Fx/GfrvQlo9MVJE8QJWf +4uoGElKRtiVjbXZhP1/FVRMl7rAi8MtCtASOtAP+HUUyF9wuECqyd2W1F3oM+9Mp4x3/pUD GfSGSgEqETLkuRaMz0Iemm75sGRD3X+SPa4lBJc7x66ifAcdLdz7o3aLYfsjR6Zwca7TvC5E Ha0OfD9EsHGiF9909lPaRvG4buWFUfPBUPDkNHBLDwaQ53K5AQ0ET4b6XQEIALHepqzqtRkm cJc0bHDUGvVtlgf904+DjeDy9nvQfoXPZU/58tswd2oF7ucG7F088MYCaUE+4TR5AknJFvfI dx0YxX4WTzQoCJ7lBrI3DclYLkIfv+O3JIaYdLO1PugeMjbiIqkGZOJqPFoAjY9WCIoVZhlh LIAzsDGmo2w2GdK9f9xpCpWIzl3lLk/1oKLq60keaGSVTQP5OF9h+zNyVK9QUnN9i+wSbfDO wJ7bpepNeydC/BppLy701LUEzvqfg2EDJ2tp4A9z2wL0EXGxBp5IPQAa3RBdFqeBsfoBhlrM hSpR7z3TLYFgMtybEvq0GqRui6Ft8lCacKRKQPOinQcAEQEAAYkBHwQoAQgACQUCUxB9DQId AQAKCRAa5oYOVsvSkzGXCADErInRheCqYxnCs4ZDStLBKXr3HpUOg84E+5HF7qui0OmDq26H 9vyj4Bonvf06BWXyVx/MxORnn6pCrx2W2LLFopRb5CPdBfZ9d/JBttOTQf9s5WkG++P7/WTF yV3IqZyMfk9rTjAgYByVONSDCZgfjX0beQOgg8rSXYVsaqabBKOY48v+7STNTZ+OxvO7QFfK lTVLc20us3Z2xweFtgScAjm21b/HqS94bvy+Xn1do9rUm1U5sryvwpWDAanbVKN7j1++Rhfy rmAwjj9QUwOc85s6eDzFXfoJh3DIAmSmOpb3BLXYuRSyNMHtpHGPH3z7zNnejDYRbBi2lSPe SdKKiQEfBBgBAgAJBQJPhvpdAhsMAAoJEBrmhg5Wy9KTNfEH/R0zTYbvDdCEirZkfJYD4Sbr vPazhGvCihGra+H0O4C/oZmDhKmf8hy3D0LxsWwJS0exdEoXirwBJOAdWhcBlCz6NEs7jtHf 1rVTBGxmveSU5v+pn4spljJVn/FInw9TAys8z0ezptMm3qDzPEv0UE26FFNVi6cHeJoPaVSZ StMa+eRjkhzX+Ju0vj9ZL5d8YJhI9eM1TKvciQTVhZbECuXIon4e7BaX7sVnRFW7YCHcacyJ ii10iwNLzq6CgL8RUxgawat78VenlJmisneR221no5mn2NbmuXXJ3sPZcaVii3apAtu1bdAp Lvi7U2N99uVfgQoZ3MDXCSUuyDJgc+s= Message-ID: <0c082962-676d-6b43-501f-b4095b7e03fb@FreeBSD.org> Date: Tue, 12 Nov 2019 23:44:57 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191112223334.GA16457@spindle.one-eyed-alien.net> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 22:44:59 -0000 On 12/11/19 23:33, Brooks Davis wrote: > On Tue, Nov 12, 2019 at 10:14:28PM +0100, Guido Falsi wrote: >> On 07/11/19 23:58, Brooks Davis wrote: >>> Author: brooks >>> Date: Thu Nov 7 22:58:10 2019 >>> New Revision: 354491 >>> URL: https://svnweb.freebsd.org/changeset/base/354491 >>> >>> Log: >>> libcompat: build 32-bit rtld and ldd as part of "everything" >>> >>> Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included >>> directly so MD paths in Makefiles work. In the process centralize >>> setting them in LIBCOMPATWMAKEENV. >>> >>> Alter .PATH and CFLAGS settings in work when the Makefile is included. >>> >>> While here only support LIB32 on supported platforms rather than always >>> enabling it and requiring users of MK_LIB32 to filter based >>> TARGET/MACHINE_ARCH. >>> >>> The net effect of this change is to make Makefile.libcompat only build >>> compatability libraries. >>> >>> Changes relative to r354449: >>> >>> Correct detection of the compiler type when bsd.compat.mk is used >>> outside Makefile.libcompat. Previously it always matched the clang >>> case. >>> >>> Set LDFLAGS including the linker emulation for mips where -m32 seems to >>> be insufficent. >>> >>> Reviewed by: imp, kib (origional version in r354449) >>> Obtained from: CheriBSD (conceptually) >>> Sponsored by: DARPA, AFRL >>> Differential Revision: https://reviews.freebsd.org/D22251 >>> >> >> Hi, >> >> I'm using pkgbase on my head machines and I'm getting this when >> upgrading packages on head now: >> >> Checking integrity... done (1 conflicting) >> - FreeBSD-clibs-lib32-13.0.s20191112204216 [mpnet-base] conflicts with >> FreeBSD-clibs-13.0.s20191112204216 [installed] on >> /usr/share/man/man1/ld-elf.so.1.1.gz >> >> >> So now these packages, which should be able to cohexist conflict on the >> man page. >> >> I'm not sure, but wthis commit looks like a good candidate for causing this. > > It turns out that I'd missed there being an MLINKS variable. The MAN?= > part worked as designed but the new code was installing duplication > links to rtld.1. I was looking at that, but had no time to test such a fix. > > Should be fixed in r354663. Thanks a lot for the quick fix! -- Guido Falsi From owner-svn-src-head@freebsd.org Tue Nov 12 23:03:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37EC81BDFF6; Tue, 12 Nov 2019 23:03:53 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CNbF0SPWz4FBX; Tue, 12 Nov 2019 23:03:53 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E887070A8; Tue, 12 Nov 2019 23:03:52 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACN3qhu064528; Tue, 12 Nov 2019 23:03:52 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACN3qbo064527; Tue, 12 Nov 2019 23:03:52 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201911122303.xACN3qbo064527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 12 Nov 2019 23:03:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354664 - head/usr.sbin/sesutil X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/usr.sbin/sesutil X-SVN-Commit-Revision: 354664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 23:03:53 -0000 Author: asomers Date: Tue Nov 12 23:03:52 2019 New Revision: 354664 URL: https://svnweb.freebsd.org/changeset/base/354664 Log: sesutil: fix an out-of-bounds array access sesutil would allow the user to toggle an LED that was one past the maximum element. If he tried, ENCIOC_GETELMSTAT would return EINVAL. Reported by: Coverity Coverity CID: 1398940 MFC after: 2 weeks Sponsored by: Axcient Modified: head/usr.sbin/sesutil/sesutil.c Modified: head/usr.sbin/sesutil/sesutil.c ============================================================================== --- head/usr.sbin/sesutil/sesutil.c Tue Nov 12 22:31:59 2019 (r354663) +++ head/usr.sbin/sesutil/sesutil.c Tue Nov 12 23:03:52 2019 (r354664) @@ -247,7 +247,7 @@ sesled(int argc, char **argv, bool setfault) } if (isses) { - if (sesid > nobj) { + if (sesid >= nobj) { close(fd); xo_errx(EXIT_FAILURE, "Requested SES ID does not exist"); From owner-svn-src-head@freebsd.org Tue Nov 12 23:09:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA7D11BE183; Tue, 12 Nov 2019 23:09:56 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CNkD4VLgz4FPb; Tue, 12 Nov 2019 23:09:56 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D6AA70AD; Tue, 12 Nov 2019 23:09:56 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACN9u8r064857; Tue, 12 Nov 2019 23:09:56 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACN9uKk064856; Tue, 12 Nov 2019 23:09:56 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201911122309.xACN9uKk064856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 12 Nov 2019 23:09:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354665 - head/usr.sbin/sesutil X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/usr.sbin/sesutil X-SVN-Commit-Revision: 354665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 23:09:56 -0000 Author: asomers Date: Tue Nov 12 23:09:55 2019 New Revision: 354665 URL: https://svnweb.freebsd.org/changeset/base/354665 Log: sesutil: fix some memory leaks Reported by: Coverity Coverity CID: 1331665 MFC after: 2 weeks Sponsored by: Axcient Modified: head/usr.sbin/sesutil/sesutil.c Modified: head/usr.sbin/sesutil/sesutil.c ============================================================================== --- head/usr.sbin/sesutil/sesutil.c Tue Nov 12 23:03:52 2019 (r354664) +++ head/usr.sbin/sesutil/sesutil.c Tue Nov 12 23:09:55 2019 (r354665) @@ -242,18 +242,21 @@ sesled(int argc, char **argv, bool setfault) } if (ioctl(fd, ENCIOC_GETELMMAP, (caddr_t) objp) < 0) { + free(objp); close(fd); xo_err(EXIT_FAILURE, "ENCIOC_GETELMMAP"); } if (isses) { if (sesid >= nobj) { + free(objp); close(fd); xo_errx(EXIT_FAILURE, "Requested SES ID does not exist"); } do_led(fd, sesid, objp[sesid].elm_type, onoff, setfault); ndisks++; + free(objp); close(fd); break; } From owner-svn-src-head@freebsd.org Tue Nov 12 23:57:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 160B71BF327; Tue, 12 Nov 2019 23:57:58 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CPnd6trpz4HpX; Tue, 12 Nov 2019 23:57:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0A3F79AB; Tue, 12 Nov 2019 23:57:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACNvvfN094217; Tue, 12 Nov 2019 23:57:57 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACNvvMN094216; Tue, 12 Nov 2019 23:57:57 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201911122357.xACNvvMN094216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 12 Nov 2019 23:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354666 - head/usr.sbin/sesutil X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/usr.sbin/sesutil X-SVN-Commit-Revision: 354666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 23:57:58 -0000 Author: asomers Date: Tue Nov 12 23:57:57 2019 New Revision: 354666 URL: https://svnweb.freebsd.org/changeset/base/354666 Log: sesutil: fix another memory leak Instead of calloc()ing (and forgetting to free) in a tight loop, just put this small array on the stack. Reported by: Coverity Coverity CID: 1331665 MFC after: 2 weeks Sponsored by: Axcient Modified: head/usr.sbin/sesutil/sesutil.c Modified: head/usr.sbin/sesutil/sesutil.c ============================================================================== --- head/usr.sbin/sesutil/sesutil.c Tue Nov 12 23:09:55 2019 (r354665) +++ head/usr.sbin/sesutil/sesutil.c Tue Nov 12 23:57:57 2019 (r354666) @@ -261,19 +261,19 @@ sesled(int argc, char **argv, bool setfault) break; } for (j = 0; j < nobj; j++) { + const int devnames_size = 128; + char devnames[devnames_size]; + if (all) { do_led(fd, objp[j].elm_idx, objp[j].elm_type, onoff, setfault); continue; } memset(&objdn, 0, sizeof(objdn)); + memset(devnames, 0, devnames_size); objdn.elm_idx = objp[j].elm_idx; - objdn.elm_names_size = 128; - objdn.elm_devnames = calloc(128, sizeof(char)); - if (objdn.elm_devnames == NULL) { - close(fd); - xo_err(EXIT_FAILURE, "calloc()"); - } + objdn.elm_names_size = devnames_size; + objdn.elm_devnames = devnames; if (ioctl(fd, ENCIOC_GETELMDEVNAMES, (caddr_t) &objdn) <0) { continue; From owner-svn-src-head@freebsd.org Wed Nov 13 00:53:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88D21178BB0; Wed, 13 Nov 2019 00:53:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CR233qltz4LMb; Wed, 13 Nov 2019 00:53:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68020845E; Wed, 13 Nov 2019 00:53:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAD0rlS5029392; Wed, 13 Nov 2019 00:53:47 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAD0rkL5029385; Wed, 13 Nov 2019 00:53:46 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911130053.xAD0rkL5029385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 13 Nov 2019 00:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354667 - in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom modules/cxgbe/if_cxgbe X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom modules/cxgbe/if_cxgbe X-SVN-Commit-Revision: 354667 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 00:53:47 -0000 Author: jhb Date: Wed Nov 13 00:53:45 2019 New Revision: 354667 URL: https://svnweb.freebsd.org/changeset/base/354667 Log: Create a file to hold shared routines for dealing with T6 key contexts. ccr(4) and TLS support in cxgbe(4) construct key contexts used by the crypto engine in the T6. This consolidates some duplicated code for helper functions used to build key contexts. Reviewed by: np MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D22156 Added: head/sys/dev/cxgbe/crypto/t4_keyctx.c (contents, props changed) Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/crypto/t4_crypto.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/tom/t4_tls.c head/sys/modules/cxgbe/if_cxgbe/Makefile Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Tue Nov 12 23:57:57 2019 (r354666) +++ head/sys/dev/cxgbe/adapter.h Wed Nov 13 00:53:45 2019 (r354667) @@ -1142,7 +1142,6 @@ void t4_os_link_changed(struct port_info *); void t4_iterate(void (*)(struct adapter *, void *), void *); void t4_init_devnames(struct adapter *); void t4_add_adapter(struct adapter *); -void t4_aes_getdeckey(void *, const void *, unsigned int); int t4_detach_common(device_t); int t4_map_bars_0_and_4(struct adapter *); int t4_map_bar_2(struct adapter *); @@ -1169,6 +1168,15 @@ int cxgbe_media_change(struct ifnet *); void cxgbe_media_status(struct ifnet *, struct ifmediareq *); bool t4_os_dump_cimla(struct adapter *, int, bool); void t4_os_dump_devlog(struct adapter *); + +/* t4_keyctx.c */ +struct auth_hash; +union authctx; + +void t4_aes_getdeckey(void *, const void *, unsigned int); +void t4_copy_partial_hash(int, union authctx *, void *); +void t4_init_gmac_hash(const char *, int, char *); +void t4_init_hmac_digest(struct auth_hash *, u_int, char *, int, char *); #ifdef DEV_NETMAP /* t4_netmap.c */ Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Tue Nov 12 23:57:57 2019 (r354666) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Nov 13 00:53:45 2019 (r354667) @@ -141,8 +141,7 @@ struct ccr_session_hmac { unsigned int partial_digest_len; unsigned int auth_mode; unsigned int mk_size; - char ipad[CHCR_HASH_MAX_BLOCK_SIZE_128]; - char opad[CHCR_HASH_MAX_BLOCK_SIZE_128]; + char pads[CHCR_HASH_MAX_BLOCK_SIZE_128 * 2]; }; struct ccr_session_gmac { @@ -530,10 +529,7 @@ ccr_hash(struct ccr_softc *sc, struct ccr_session *s, V_SCMD_LAST_FRAG(0) | V_SCMD_MORE_FRAGS(crd->crd_len == 0 ? 1 : 0) | V_SCMD_MAC_ONLY(1)); - memcpy(crwr->key_ctx.key, s->hmac.ipad, s->hmac.partial_digest_len); - if (use_opad) - memcpy(crwr->key_ctx.key + iopad_size, s->hmac.opad, - s->hmac.partial_digest_len); + memcpy(crwr->key_ctx.key, s->hmac.pads, kctx_len); /* XXX: F_KEY_CONTEXT_SALT_PRESENT set, but 'salt' not set. */ kctx_flits = (sizeof(struct _key_ctx) + kctx_len) / 16; @@ -1069,8 +1065,7 @@ ccr_authenc(struct ccr_softc *sc, struct ccr_session * } dst = crwr->key_ctx.key + roundup2(s->blkcipher.key_len, 16); - memcpy(dst, s->hmac.ipad, s->hmac.partial_digest_len); - memcpy(dst + iopad_size, s->hmac.opad, s->hmac.partial_digest_len); + memcpy(dst, s->hmac.pads, iopad_size * 2); dst = (char *)(crwr + 1) + kctx_len; ccr_write_phys_dsgl(sc, dst, dsgl_nsegs); @@ -2212,44 +2207,6 @@ ccr_detach(device_t dev) } static void -ccr_copy_partial_hash(void *dst, int cri_alg, union authctx *auth_ctx) -{ - uint32_t *u32; - uint64_t *u64; - u_int i; - - u32 = (uint32_t *)dst; - u64 = (uint64_t *)dst; - switch (cri_alg) { - case CRYPTO_SHA1: - case CRYPTO_SHA1_HMAC: - for (i = 0; i < SHA1_HASH_LEN / 4; i++) - u32[i] = htobe32(auth_ctx->sha1ctx.h.b32[i]); - break; - case CRYPTO_SHA2_224: - case CRYPTO_SHA2_224_HMAC: - for (i = 0; i < SHA2_256_HASH_LEN / 4; i++) - u32[i] = htobe32(auth_ctx->sha224ctx.state[i]); - break; - case CRYPTO_SHA2_256: - case CRYPTO_SHA2_256_HMAC: - for (i = 0; i < SHA2_256_HASH_LEN / 4; i++) - u32[i] = htobe32(auth_ctx->sha256ctx.state[i]); - break; - case CRYPTO_SHA2_384: - case CRYPTO_SHA2_384_HMAC: - for (i = 0; i < SHA2_512_HASH_LEN / 8; i++) - u64[i] = htobe64(auth_ctx->sha384ctx.state[i]); - break; - case CRYPTO_SHA2_512: - case CRYPTO_SHA2_512_HMAC: - for (i = 0; i < SHA2_512_HASH_LEN / 8; i++) - u64[i] = htobe64(auth_ctx->sha512ctx.state[i]); - break; - } -} - -static void ccr_init_hash_digest(struct ccr_session *s, int cri_alg) { union authctx auth_ctx; @@ -2257,66 +2214,9 @@ ccr_init_hash_digest(struct ccr_session *s, int cri_al axf = s->hmac.auth_hash; axf->Init(&auth_ctx); - ccr_copy_partial_hash(s->hmac.ipad, cri_alg, &auth_ctx); + t4_copy_partial_hash(cri_alg, &auth_ctx, s->hmac.pads); } -static void -ccr_init_hmac_digest(struct ccr_session *s, int cri_alg, char *key, - int klen) -{ - union authctx auth_ctx; - struct auth_hash *axf; - u_int i; - - /* - * If the key is larger than the block size, use the digest of - * the key as the key instead. - */ - axf = s->hmac.auth_hash; - klen /= 8; - if (klen > axf->blocksize) { - axf->Init(&auth_ctx); - axf->Update(&auth_ctx, key, klen); - axf->Final(s->hmac.ipad, &auth_ctx); - klen = axf->hashsize; - } else - memcpy(s->hmac.ipad, key, klen); - - memset(s->hmac.ipad + klen, 0, axf->blocksize - klen); - memcpy(s->hmac.opad, s->hmac.ipad, axf->blocksize); - - for (i = 0; i < axf->blocksize; i++) { - s->hmac.ipad[i] ^= HMAC_IPAD_VAL; - s->hmac.opad[i] ^= HMAC_OPAD_VAL; - } - - /* - * Hash the raw ipad and opad and store the partial result in - * the same buffer. - */ - axf->Init(&auth_ctx); - axf->Update(&auth_ctx, s->hmac.ipad, axf->blocksize); - ccr_copy_partial_hash(s->hmac.ipad, cri_alg, &auth_ctx); - - axf->Init(&auth_ctx); - axf->Update(&auth_ctx, s->hmac.opad, axf->blocksize); - ccr_copy_partial_hash(s->hmac.opad, cri_alg, &auth_ctx); -} - -/* - * Borrowed from AES_GMAC_Setkey(). - */ -static void -ccr_init_gmac_hash(struct ccr_session *s, char *key, int klen) -{ - static char zeroes[GMAC_BLOCK_LEN]; - uint32_t keysched[4 * (RIJNDAEL_MAXNR + 1)]; - int rounds; - - rounds = rijndaelKeySetupEnc(keysched, key, klen); - rijndaelEncrypt(keysched, rounds, zeroes, s->gmac.ghash_h); -} - static int ccr_aes_check_keylen(int alg, int klen) { @@ -2613,7 +2513,8 @@ ccr_newsession(device_t dev, crypto_session_t cses, st s->gmac.hash_len = AES_GMAC_HASH_LEN; else s->gmac.hash_len = hash->cri_mlen; - ccr_init_gmac_hash(s, hash->cri_key, hash->cri_klen); + t4_init_gmac_hash(hash->cri_key, hash->cri_klen, + s->gmac.ghash_h); } else if (auth_mode == SCMD_AUTH_MODE_CBCMAC) { if (hash->cri_mlen == 0) s->ccm_mac.hash_len = AES_CBC_MAC_HASH_LEN; @@ -2629,8 +2530,8 @@ ccr_newsession(device_t dev, crypto_session_t cses, st else s->hmac.hash_len = hash->cri_mlen; if (hmac) - ccr_init_hmac_digest(s, hash->cri_alg, hash->cri_key, - hash->cri_klen); + t4_init_hmac_digest(auth_hash, partial_digest_len, + hash->cri_key, hash->cri_klen, s->hmac.pads); else ccr_init_hash_digest(s, hash->cri_alg); } @@ -2694,8 +2595,9 @@ ccr_process(device_t dev, struct cryptop *crp, int hin break; case HMAC: if (crd->crd_flags & CRD_F_KEY_EXPLICIT) - ccr_init_hmac_digest(s, crd->crd_alg, crd->crd_key, - crd->crd_klen); + t4_init_hmac_digest(s->hmac.auth_hash, + s->hmac.partial_digest_len, crd->crd_key, + crd->crd_klen, s->hmac.pads); error = ccr_hash(sc, s, crp); if (error == 0) sc->stats_hmac++; @@ -2743,8 +2645,9 @@ ccr_process(device_t dev, struct cryptop *crp, int hin if (error) break; if (crda->crd_flags & CRD_F_KEY_EXPLICIT) - ccr_init_hmac_digest(s, crda->crd_alg, crda->crd_key, - crda->crd_klen); + t4_init_hmac_digest(s->hmac.auth_hash, + s->hmac.partial_digest_len, crda->crd_key, + crda->crd_klen, s->hmac.pads); if (crde->crd_flags & CRD_F_KEY_EXPLICIT) { error = ccr_aes_check_keylen(crde->crd_alg, crde->crd_klen); @@ -2771,7 +2674,8 @@ ccr_process(device_t dev, struct cryptop *crp, int hin crde = crd->crd_next; } if (crda->crd_flags & CRD_F_KEY_EXPLICIT) - ccr_init_gmac_hash(s, crda->crd_key, crda->crd_klen); + t4_init_gmac_hash(crda->crd_key, crda->crd_klen, + s->gmac.ghash_h); if (crde->crd_flags & CRD_F_KEY_EXPLICIT) { error = ccr_aes_check_keylen(crde->crd_alg, crde->crd_klen); Added: head/sys/dev/cxgbe/crypto/t4_keyctx.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/crypto/t4_keyctx.c Wed Nov 13 00:53:45 2019 (r354667) @@ -0,0 +1,198 @@ +/*- + * Copyright (c) 2017-2019 Chelsio Communications, Inc. + * All rights reserved. + * Written by: John Baldwin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include + +#include "common/common.h" +#include "crypto/t4_crypto.h" + +/* + * Crypto operations use a key context to store cipher keys and + * partial hash digests. They can either be passed inline as part of + * a work request using crypto or they can be stored in card RAM. For + * the latter case, work requests must replace the inline key context + * with a request to read the context from card RAM. + * + * The format of a key context: + * + * +-------------------------------+ + * | key context header | + * +-------------------------------+ + * | AES key | ----- For requests with AES + * +-------------------------------+ + * | Hash state | ----- For hash-only requests + * +-------------------------------+ - + * | IPAD (16-byte aligned) | \ + * +-------------------------------+ +---- For requests with HMAC + * | OPAD (16-byte aligned) | / + * +-------------------------------+ - + * | GMAC H | ----- For AES-GCM + * +-------------------------------+ - + */ + +/* + * Generate the initial GMAC hash state for a AES-GCM key. + * + * Borrowed from AES_GMAC_Setkey(). + */ +void +t4_init_gmac_hash(const char *key, int klen, char *ghash) +{ + static char zeroes[GMAC_BLOCK_LEN]; + uint32_t keysched[4 * (RIJNDAEL_MAXNR + 1)]; + int rounds; + + rounds = rijndaelKeySetupEnc(keysched, key, klen); + rijndaelEncrypt(keysched, rounds, zeroes, ghash); +} + +/* Copy out the partial hash state from a software hash implementation. */ +void +t4_copy_partial_hash(int alg, union authctx *auth_ctx, void *dst) +{ + uint32_t *u32; + uint64_t *u64; + u_int i; + + u32 = (uint32_t *)dst; + u64 = (uint64_t *)dst; + switch (alg) { + case CRYPTO_SHA1: + case CRYPTO_SHA1_HMAC: + for (i = 0; i < SHA1_HASH_LEN / 4; i++) + u32[i] = htobe32(auth_ctx->sha1ctx.h.b32[i]); + break; + case CRYPTO_SHA2_224: + case CRYPTO_SHA2_224_HMAC: + for (i = 0; i < SHA2_256_HASH_LEN / 4; i++) + u32[i] = htobe32(auth_ctx->sha224ctx.state[i]); + break; + case CRYPTO_SHA2_256: + case CRYPTO_SHA2_256_HMAC: + for (i = 0; i < SHA2_256_HASH_LEN / 4; i++) + u32[i] = htobe32(auth_ctx->sha256ctx.state[i]); + break; + case CRYPTO_SHA2_384: + case CRYPTO_SHA2_384_HMAC: + for (i = 0; i < SHA2_512_HASH_LEN / 8; i++) + u64[i] = htobe64(auth_ctx->sha384ctx.state[i]); + break; + case CRYPTO_SHA2_512: + case CRYPTO_SHA2_512_HMAC: + for (i = 0; i < SHA2_512_HASH_LEN / 8; i++) + u64[i] = htobe64(auth_ctx->sha512ctx.state[i]); + break; + } +} + +void +t4_init_hmac_digest(struct auth_hash *axf, u_int partial_digest_len, + char *key, int klen, char *dst) +{ + union authctx auth_ctx; + char ipad[SHA2_512_BLOCK_LEN], opad[SHA2_512_BLOCK_LEN]; + u_int i; + + /* + * If the key is larger than the block size, use the digest of + * the key as the key instead. + */ + klen /= 8; + if (klen > axf->blocksize) { + axf->Init(&auth_ctx); + axf->Update(&auth_ctx, key, klen); + axf->Final(ipad, &auth_ctx); + klen = axf->hashsize; + } else + memcpy(ipad, key, klen); + + memset(ipad + klen, 0, axf->blocksize - klen); + memcpy(opad, ipad, axf->blocksize); + + for (i = 0; i < axf->blocksize; i++) { + ipad[i] ^= HMAC_IPAD_VAL; + opad[i] ^= HMAC_OPAD_VAL; + } + + /* + * Hash the raw ipad and opad and store the partial results in + * the key context. + */ + axf->Init(&auth_ctx); + axf->Update(&auth_ctx, ipad, axf->blocksize); + t4_copy_partial_hash(axf->type, &auth_ctx, dst); + + dst += roundup2(partial_digest_len, 16); + axf->Init(&auth_ctx); + axf->Update(&auth_ctx, opad, axf->blocksize); + t4_copy_partial_hash(axf->type, &auth_ctx, dst); +} + +/* + * Borrowed from cesa_prep_aes_key(). + * + * NB: The crypto engine wants the words in the decryption key in reverse + * order. + */ +void +t4_aes_getdeckey(void *dec_key, const void *enc_key, unsigned int kbits) +{ + uint32_t ek[4 * (RIJNDAEL_MAXNR + 1)]; + uint32_t *dkey; + int i; + + rijndaelKeySetupEnc(ek, enc_key, kbits); + dkey = dec_key; + dkey += (kbits / 8) / 4; + + switch (kbits) { + case 128: + for (i = 0; i < 4; i++) + *--dkey = htobe32(ek[4 * 10 + i]); + break; + case 192: + for (i = 0; i < 2; i++) + *--dkey = htobe32(ek[4 * 11 + 2 + i]); + for (i = 0; i < 4; i++) + *--dkey = htobe32(ek[4 * 12 + i]); + break; + case 256: + for (i = 0; i < 4; i++) + *--dkey = htobe32(ek[4 * 13 + i]); + for (i = 0; i < 4; i++) + *--dkey = htobe32(ek[4 * 14 + i]); + break; + } + MPASS(dkey == dec_key); +} Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Nov 12 23:57:57 2019 (r354666) +++ head/sys/dev/cxgbe/t4_main.c Wed Nov 13 00:53:45 2019 (r354667) @@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$"); #include #include #endif -#include #ifdef DDB #include #include @@ -10850,44 +10849,6 @@ DB_FUNC(tcb, db_show_t4tcb, db_t4_table, CS_OWN, NULL) t4_dump_tcb(device_get_softc(dev), tid); } #endif - -/* - * Borrowed from cesa_prep_aes_key(). - * - * NB: The crypto engine wants the words in the decryption key in reverse - * order. - */ -void -t4_aes_getdeckey(void *dec_key, const void *enc_key, unsigned int kbits) -{ - uint32_t ek[4 * (RIJNDAEL_MAXNR + 1)]; - uint32_t *dkey; - int i; - - rijndaelKeySetupEnc(ek, enc_key, kbits); - dkey = dec_key; - dkey += (kbits / 8) / 4; - - switch (kbits) { - case 128: - for (i = 0; i < 4; i++) - *--dkey = htobe32(ek[4 * 10 + i]); - break; - case 192: - for (i = 0; i < 2; i++) - *--dkey = htobe32(ek[4 * 11 + 2 + i]); - for (i = 0; i < 4; i++) - *--dkey = htobe32(ek[4 * 12 + i]); - break; - case 256: - for (i = 0; i < 4; i++) - *--dkey = htobe32(ek[4 * 13 + i]); - for (i = 0; i < 4; i++) - *--dkey = htobe32(ek[4 * 14 + i]); - break; - } - MPASS(dkey == dec_key); -} static struct sx mlu; /* mod load unload */ SX_SYSINIT(cxgbe_mlu, &mlu, "cxgbe mod load/unload"); Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Tue Nov 12 23:57:57 2019 (r354666) +++ head/sys/dev/cxgbe/tom/t4_tls.c Wed Nov 13 00:53:45 2019 (r354667) @@ -865,88 +865,7 @@ t4_ctloutput_tls(struct socket *so, struct sockopt *so } #ifdef KERN_TLS -/* XXX: Should share this with ccr(4) eventually. */ static void -init_ktls_gmac_hash(const char *key, int klen, char *ghash) -{ - static char zeroes[GMAC_BLOCK_LEN]; - uint32_t keysched[4 * (RIJNDAEL_MAXNR + 1)]; - int rounds; - - rounds = rijndaelKeySetupEnc(keysched, key, klen); - rijndaelEncrypt(keysched, rounds, zeroes, ghash); -} - -/* XXX: Should share this with ccr(4) eventually. */ -static void -ktls_copy_partial_hash(void *dst, int cri_alg, union authctx *auth_ctx) -{ - uint32_t *u32; - uint64_t *u64; - u_int i; - - u32 = (uint32_t *)dst; - u64 = (uint64_t *)dst; - switch (cri_alg) { - case CRYPTO_SHA1_HMAC: - for (i = 0; i < SHA1_HASH_LEN / 4; i++) - u32[i] = htobe32(auth_ctx->sha1ctx.h.b32[i]); - break; - case CRYPTO_SHA2_256_HMAC: - for (i = 0; i < SHA2_256_HASH_LEN / 4; i++) - u32[i] = htobe32(auth_ctx->sha256ctx.state[i]); - break; - case CRYPTO_SHA2_384_HMAC: - for (i = 0; i < SHA2_512_HASH_LEN / 8; i++) - u64[i] = htobe64(auth_ctx->sha384ctx.state[i]); - break; - } -} - -static void -init_ktls_hmac_digest(struct auth_hash *axf, u_int partial_digest_len, - char *key, int klen, char *dst) -{ - union authctx auth_ctx; - char ipad[SHA2_512_BLOCK_LEN], opad[SHA2_512_BLOCK_LEN]; - u_int i; - - /* - * If the key is larger than the block size, use the digest of - * the key as the key instead. - */ - klen /= 8; - if (klen > axf->blocksize) { - axf->Init(&auth_ctx); - axf->Update(&auth_ctx, key, klen); - axf->Final(ipad, &auth_ctx); - klen = axf->hashsize; - } else - memcpy(ipad, key, klen); - - memset(ipad + klen, 0, axf->blocksize - klen); - memcpy(opad, ipad, axf->blocksize); - - for (i = 0; i < axf->blocksize; i++) { - ipad[i] ^= HMAC_IPAD_VAL; - opad[i] ^= HMAC_OPAD_VAL; - } - - /* - * Hash the raw ipad and opad and store the partial results in - * the key context. - */ - axf->Init(&auth_ctx); - axf->Update(&auth_ctx, ipad, axf->blocksize); - ktls_copy_partial_hash(dst, axf->type, &auth_ctx); - - dst += roundup2(partial_digest_len, 16); - axf->Init(&auth_ctx); - axf->Update(&auth_ctx, opad, axf->blocksize); - ktls_copy_partial_hash(dst, axf->type, &auth_ctx); -} - -static void init_ktls_key_context(struct ktls_session *tls, struct tls_key_context *k_ctx) { struct auth_hash *axf; @@ -972,7 +891,7 @@ init_ktls_key_context(struct ktls_session *tls, struct k_ctx->hmac_ctrl = SCMD_HMAC_CTRL_NOP; k_ctx->tx_key_info_size += GMAC_BLOCK_LEN; memcpy(k_ctx->tx.salt, tls->params.iv, SALT_SIZE); - init_ktls_gmac_hash(tls->params.cipher_key, + t4_init_gmac_hash(tls->params.cipher_key, tls->params.cipher_key_len * 8, hash); } else { switch (tls->params.auth_algorithm) { @@ -1000,7 +919,7 @@ init_ktls_key_context(struct ktls_session *tls, struct k_ctx->hmac_ctrl = SCMD_HMAC_CTRL_NO_TRUNC; k_ctx->tx_key_info_size += roundup2(mac_key_size, 16) * 2; k_ctx->mac_secret_size = mac_key_size; - init_ktls_hmac_digest(axf, mac_key_size, tls->params.auth_key, + t4_init_hmac_digest(axf, mac_key_size, tls->params.auth_key, tls->params.auth_key_len * 8, hash); } Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/if_cxgbe/Makefile Tue Nov 12 23:57:57 2019 (r354666) +++ head/sys/modules/cxgbe/if_cxgbe/Makefile Wed Nov 13 00:53:45 2019 (r354667) @@ -3,7 +3,7 @@ # CXGBE= ${SRCTOP}/sys/dev/cxgbe -.PATH: ${CXGBE} ${CXGBE}/common ${CXGBE}/cudbg +.PATH: ${CXGBE} ${CXGBE}/common ${CXGBE}/crypto ${CXGBE}/cudbg KMOD= if_cxgbe SRCS= bus_if.h @@ -20,6 +20,7 @@ SRCS+= t4_filter.c SRCS+= t4_hw.c SRCS+= t4_if.c t4_if.h SRCS+= t4_iov.c +SRCS+= t4_keyctx.c SRCS+= t4_l2t.c SRCS+= t4_main.c SRCS+= t4_mp_ring.c From owner-svn-src-head@freebsd.org Wed Nov 13 01:58:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE0BF179CC0; Wed, 13 Nov 2019 01:58:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CSSz53Gtz4NdH; Wed, 13 Nov 2019 01:58:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C5A88EFB; Wed, 13 Nov 2019 01:58:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAD1wh09064564; Wed, 13 Nov 2019 01:58:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAD1whMM064563; Wed, 13 Nov 2019 01:58:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911130158.xAD1whMM064563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 13 Nov 2019 01:58:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354668 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 354668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 01:58:43 -0000 Author: imp Date: Wed Nov 13 01:58:43 2019 New Revision: 354668 URL: https://svnweb.freebsd.org/changeset/base/354668 Log: Fix a race between daopen and damediapoll When we do a daopen, we call dareprobe and wait for the results. The repoll runs the da state machine up through the DA_STATE_RC* and then exits. For removable media, we poll the device every 3 seconds with a TUR to see if it has disappeared. This introduces a race. If the removable device has lots of partitions, and if it's a little slow (like say a USB2 connected USB stick), then we can have a fair amount of time that this reporbe is going on for. If, during that time, damediapoll fires, it calls daschedule which changes the scheduling priority from NONE to NORMAL. When that happens, the careful single stepping in the da state machine is disrupted and we wind up sceduling multiple read capacity calls. The first one succeeds and releases the reference. The second one succeeds and releases the reference (and panics if the right code is compiled into the da driver). To avoid the race, only do the TUR calls while in state normal, otherwise just reschedule damediapoll. This prevents the race from happening. Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Wed Nov 13 00:53:45 2019 (r354667) +++ head/sys/cam/scsi/scsi_da.c Wed Nov 13 01:58:43 2019 (r354668) @@ -5949,6 +5949,7 @@ damediapoll(void *arg) if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR) && (softc->flags & DA_FLAG_TUR_PENDING) == 0 && + softc->state == DA_STATE_NORMAL && LIST_EMPTY(&softc->pending_ccbs)) { if (da_periph_acquire(periph, DA_REF_TUR) == 0) { cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); From owner-svn-src-head@freebsd.org Wed Nov 13 02:14:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B29617A334; Wed, 13 Nov 2019 02:14:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CSpx6NhQz4Phb; Wed, 13 Nov 2019 02:14:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF3659292; Wed, 13 Nov 2019 02:14:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAD2EHH5076170; Wed, 13 Nov 2019 02:14:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAD2EHuJ076169; Wed, 13 Nov 2019 02:14:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911130214.xAD2EHuJ076169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 13 Nov 2019 02:14:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354669 - head/lib/libc/secure X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/secure X-SVN-Commit-Revision: 354669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 02:14:18 -0000 Author: kevans Date: Wed Nov 13 02:14:17 2019 New Revision: 354669 URL: https://svnweb.freebsd.org/changeset/base/354669 Log: ssp: add a priority to the __stack_chk_guard constructor First, this commit is a NOP on GCC <= 4.x; this decidedly doesn't work cleanly on GCC 4.2, and it will be gone soon anyways so I chose not to dump time into figuring out if there's a way to make it work. xtoolchain-gcc, clocking in as GCC6, can cope with it just fine and later versions are also generally ok with the syntax. I suspect very few users are running GCC4.2 built worlds and also experiencing potential fallout from the status quo. For dynamically linked applications, this change also means very little. rtld will run libc ctors before most others, so the situation is approximately a NOP for these as well. The real cause for this change is statically linked applications doing almost questionable things in their constructors. qemu-user-static, for instance, creates a thread in a global constructor for their async rcu callbacks. In general, this works in other places- - On OpenBSD, __stack_chk_guard is stored in an .openbsd.randomdata section that's initialized by the kernel in the static case, or ld.so in the dynamic case - On Linux, __stack_chk_guard is apparently stored in TLS and such a problem is circumvented there because the value is presumed stable in the new thread. On FreeBSD, the rcu thread creation ctor and __guard_setup are both unmarked priority. qemu-user-static spins up the rcu thread prior to __guard_setup which starts making function calls- some of these are sprinkled with the canary. In the middle of one of these functions, __guard_setup is invoked in the main thread and __stack_chk_guard changes- qemu-user-static is promptly terminated for an SSP violation that didn't actually happen. This is not an all-too-common problem. We circumvent it here by giving the __stack_chk_guard constructor a solid priority. 200 was chosen because that gives static applications ample range (down to 101) for working around it if they really need to. I suspect most applications will "just work" as expected- the default/non-prioritized flavor of __constructor__ functions run last, and the canary is generally not expected to change as of this point at the very least. This took approximately three weeks of spare time debugging to pin down. PR: 241905 Modified: head/lib/libc/secure/stack_protector.c Modified: head/lib/libc/secure/stack_protector.c ============================================================================== --- head/lib/libc/secure/stack_protector.c Wed Nov 13 01:58:43 2019 (r354668) +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 02:14:17 2019 (r354669) @@ -40,11 +40,27 @@ __FBSDID("$FreeBSD$"); #include #include "libc_private.h" +/* + * We give __guard_setup a defined priority early on so that statically linked + * applications have a defined priority at which __stack_chk_guard will be + * getting initialized. This will not matter to most applications, because + * they're either not usually statically linked or they simply don't do things + * in constructors that would be adversely affected by their positioning with + * respect to this initialization. + */ +#if defined(__GNUC__) && __GNUC__ <= 4 +#define _GUARD_SETUP_CTOR_ATTR \ + __attribute__((__constructor__, __used__)); +#else +#define _GUARD_SETUP_CTOR_ATTR \ + __attribute__((__constructor__ (200), __used__)); +#endif + extern int __sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen); long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static void __guard_setup(void) __attribute__((__constructor__, __used__)); +static void __guard_setup(void) _GUARD_SETUP_CTOR_ATTR; static void __fail(const char *); void __stack_chk_fail(void); void __chk_fail(void); From owner-svn-src-head@freebsd.org Wed Nov 13 02:16:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D881B17A445; Wed, 13 Nov 2019 02:16:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CSsN5SqRz4PtP; Wed, 13 Nov 2019 02:16:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E395929C; Wed, 13 Nov 2019 02:16:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAD2GOrb076323; Wed, 13 Nov 2019 02:16:24 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAD2GOcY076322; Wed, 13 Nov 2019 02:16:24 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911130216.xAD2GOcY076322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 13 Nov 2019 02:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354670 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 354670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 02:16:24 -0000 Author: jhibbits Date: Wed Nov 13 02:16:24 2019 New Revision: 354670 URL: https://svnweb.freebsd.org/changeset/base/354670 Log: powerpc: Don't savectx() twice in IPI_STOP handler We already save context in stoppcbs[] array, so there's no need to also save it in the PCB, it won't be used. Modified: head/sys/powerpc/powerpc/mp_machdep.c Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Wed Nov 13 02:14:17 2019 (r354669) +++ head/sys/powerpc/powerpc/mp_machdep.c Wed Nov 13 02:16:24 2019 (r354670) @@ -331,7 +331,6 @@ powerpc_ipi_handler(void *arg) __func__); cpuid = PCPU_GET(cpuid); savectx(&stoppcbs[cpuid]); - savectx(PCPU_GET(curpcb)); CPU_SET_ATOMIC(cpuid, &stopped_cpus); while (!CPU_ISSET(cpuid, &started_cpus)) cpu_spinwait(); From owner-svn-src-head@freebsd.org Wed Nov 13 02:22:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D131F17A82F; Wed, 13 Nov 2019 02:22:00 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CSzr5H0Yz4QPT; Wed, 13 Nov 2019 02:22:00 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 999FF942B; Wed, 13 Nov 2019 02:22:00 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAD2M0vw081754; Wed, 13 Nov 2019 02:22:00 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAD2M0f0081753; Wed, 13 Nov 2019 02:22:00 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911130222.xAD2M0f0081753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 13 Nov 2019 02:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354671 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 354671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 02:22:00 -0000 Author: jhibbits Date: Wed Nov 13 02:22:00 2019 New Revision: 354671 URL: https://svnweb.freebsd.org/changeset/base/354671 Log: powerpc64: Don't guard ISA 3.0 partition table setup with hw_direct_map PowerISA 3.0 eliminated the 64-bit bridge mode which allowed 32-bit kernels to run on 64-bit AIM/Book-S hardware. Since therefore only a 64-bit kernel can run on this hardware, and 64-bit native always has the direct map, there is no need to guard it. Modified: head/sys/powerpc/aim/moea64_native.c Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Wed Nov 13 02:16:24 2019 (r354670) +++ head/sys/powerpc/aim/moea64_native.c Wed Nov 13 02:22:00 2019 (r354671) @@ -545,9 +545,8 @@ moea64_bootstrap_native(mmu_t mmup, vm_offset_t kernel if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) { moea64_part_table = (struct pate *)moea64_bootstrap_alloc(PART_SIZE, PART_SIZE); - if (hw_direct_map) - moea64_part_table = - (struct pate *)PHYS_TO_DMAP((vm_offset_t)moea64_part_table); + moea64_part_table = + (struct pate *)PHYS_TO_DMAP((vm_offset_t)moea64_part_table); } DISABLE_TRANS(msr); bzero(__DEVOLATILE(void *, moea64_pteg_table), moea64_pteg_count * From owner-svn-src-head@freebsd.org Wed Nov 13 03:00:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE9BF17B404; Wed, 13 Nov 2019 03:00:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CTrJ5cD0z4RqT; Wed, 13 Nov 2019 03:00:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3B4299C4; Wed, 13 Nov 2019 03:00:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAD30Wkm099997; Wed, 13 Nov 2019 03:00:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAD30WUE099996; Wed, 13 Nov 2019 03:00:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911130300.xAD30WUE099996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 13 Nov 2019 03:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354672 - head/lib/libc/secure X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/secure X-SVN-Commit-Revision: 354672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 03:00:32 -0000 Author: kevans Date: Wed Nov 13 03:00:32 2019 New Revision: 354672 URL: https://svnweb.freebsd.org/changeset/base/354672 Log: ssp: rework the logic to use priority=200 on clang builds The preproc logic was added at the last minute to appease GCC 4.2, and kevans@ did clearly not go back and double-check that the logic worked out for clang builds to use the new variant. It turns out that clang defines __GNUC__ == 4. Flip it around and check __clang__ as well, leaving a note to remove it later. Reported by: cem Modified: head/lib/libc/secure/stack_protector.c Modified: head/lib/libc/secure/stack_protector.c ============================================================================== --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r354671) +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r354672) @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); * they're either not usually statically linked or they simply don't do things * in constructors that would be adversely affected by their positioning with * respect to this initialization. + * + * This conditional should be removed when GCC 4.2 is removed. */ -#if defined(__GNUC__) && __GNUC__ <= 4 -#define _GUARD_SETUP_CTOR_ATTR \ - __attribute__((__constructor__, __used__)); -#else +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) #define _GUARD_SETUP_CTOR_ATTR \ __attribute__((__constructor__ (200), __used__)); +#else +#define _GUARD_SETUP_CTOR_ATTR \ + __attribute__((__constructor__, __used__)); #endif extern int __sysctl(const int *name, u_int namelen, void *oldp, From owner-svn-src-head@freebsd.org Wed Nov 13 03:56:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 636E817C88E; Wed, 13 Nov 2019 03:56:52 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CW5J2058z4VWb; Wed, 13 Nov 2019 03:56:52 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27A99A53C; Wed, 13 Nov 2019 03:56:52 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAD3uqlH036434; Wed, 13 Nov 2019 03:56:52 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAD3uqUf036433; Wed, 13 Nov 2019 03:56:52 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201911130356.xAD3uqUf036433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Wed, 13 Nov 2019 03:56:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354673 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 354673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 03:56:52 -0000 Author: rpokala Date: Wed Nov 13 03:56:51 2019 New Revision: 354673 URL: https://svnweb.freebsd.org/changeset/base/354673 Log: Logging improvements to loader::nfs Include the server IP address when logging nfs_open(), add a few missing "\n"s, and correct a typo. Reviewed by: kevans MFC after: 2 weeks Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D22346 Modified: head/stand/libsa/nfs.c Modified: head/stand/libsa/nfs.c ============================================================================== --- head/stand/libsa/nfs.c Wed Nov 13 03:00:32 2019 (r354672) +++ head/stand/libsa/nfs.c Wed Nov 13 03:56:51 2019 (r354673) @@ -486,7 +486,8 @@ nfs_open(const char *upath, struct open_file *f) #ifdef NFS_DEBUG if (debug) - printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); + printf("nfs_open: %s (rootip=%s rootpath=%s)\n", upath, + inet_ntoa(rootip), rootpath); #endif if (!rootpath[0]) { printf("no rootpath, no nfs\n"); @@ -691,14 +692,14 @@ nfs_read(struct open_file *f, void *buf, size_t size, if (cc == -1) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: read: %s", strerror(errno)); + printf("nfs_read: read: %s\n", strerror(errno)); #endif return (errno); /* XXX - from nfs_readdata */ } if (cc == 0) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: hit EOF unexpectantly"); + printf("nfs_read: hit EOF unexpectedly\n"); #endif goto ret; } From owner-svn-src-head@freebsd.org Wed Nov 13 04:04:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9532717CB21; Wed, 13 Nov 2019 04:04:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CWFr3Phzz4Vxk; Wed, 13 Nov 2019 04:04:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.2] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id DA2B3F648; Wed, 13 Nov 2019 04:04:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r354672 - head/lib/libc/secure To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911130300.xAD30WUE099996@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> Date: Tue, 12 Nov 2019 23:04:14 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201911130300.xAD30WUE099996@repo.freebsd.org> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 04:04:16 -0000 On 12/11/2019 22:00, Kyle Evans wrote: > Author: kevans > Date: Wed Nov 13 03:00:32 2019 > New Revision: 354672 > URL: https://svnweb.freebsd.org/changeset/base/354672 > > Log: > ssp: rework the logic to use priority=200 on clang builds > > The preproc logic was added at the last minute to appease GCC 4.2, and > kevans@ did clearly not go back and double-check that the logic worked out > for clang builds to use the new variant. > > It turns out that clang defines __GNUC__ == 4. Flip it around and check > __clang__ as well, leaving a note to remove it later. > clang reports itself as GCC 4.2, the priority argument was introduced in GCC 4.3. > Reported by: cem > > Modified: > head/lib/libc/secure/stack_protector.c > > Modified: head/lib/libc/secure/stack_protector.c > ============================================================================== > --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r354671) > +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r354672) > @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); > * they're either not usually statically linked or they simply don't do things > * in constructors that would be adversely affected by their positioning with > * respect to this initialization. > + * > + * This conditional should be removed when GCC 4.2 is removed. > */ > -#if defined(__GNUC__) && __GNUC__ <= 4 > -#define _GUARD_SETUP_CTOR_ATTR \ > - __attribute__((__constructor__, __used__)); > -#else > +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) > #define _GUARD_SETUP_CTOR_ATTR \ > __attribute__((__constructor__ (200), __used__)); > +#else > +#define _GUARD_SETUP_CTOR_ATTR \ > + __attribute__((__constructor__, __used__)); > #endif > > extern int __sysctl(const int *name, u_int namelen, void *oldp, Please fix properly. Assuming clang always supported it, something like: #if __GNUC_PREREQ__(4, 3) || __has_attribute(__constructor__) should work Cheers, Pedro. From owner-svn-src-head@freebsd.org Wed Nov 13 04:20:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56CB917CFD3; Wed, 13 Nov 2019 04:20:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CWc31Vmhz4WPS; Wed, 13 Nov 2019 04:20:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 0A273F766; Wed, 13 Nov 2019 04:20:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f171.google.com with SMTP id e187so622871qkf.4; Tue, 12 Nov 2019 20:20:03 -0800 (PST) X-Gm-Message-State: APjAAAX80mY2II6BpJDGxfCqWwjhzcrpVGAuD2rjcOhp/IZ5HqBcva/u 4oIJHh+Ri7e+ztgeEicMBwMUuY3sGglgozCFLi4= X-Google-Smtp-Source: APXvYqxgsLe+n6wEd7bxthCxslbCmXSIqXFv/VCxdcByYvxyAWvxKcr5LFNW1M3m2ZvjMpfgMqi6jKQM0d3NcAxB30Q= X-Received: by 2002:a37:a00f:: with SMTP id j15mr869026qke.103.1573618802378; Tue, 12 Nov 2019 20:20:02 -0800 (PST) MIME-Version: 1.0 References: <201911130300.xAD30WUE099996@repo.freebsd.org> <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> In-Reply-To: <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> From: Kyle Evans Date: Tue, 12 Nov 2019 22:19:49 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354672 - head/lib/libc/secure To: Pedro Giffuni Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 04:20:03 -0000 On Tue, Nov 12, 2019, 22:04 Pedro Giffuni wrote: > > On 12/11/2019 22:00, Kyle Evans wrote: > > Author: kevans > Date: Wed Nov 13 03:00:32 2019 > New Revision: 354672 > URL: https://svnweb.freebsd.org/changeset/base/354672 > > Log: > ssp: rework the logic to use priority=200 on clang builds > > The preproc logic was added at the last minute to appease GCC 4.2, and > kevans@ did clearly not go back and double-check that the logic worked out > for clang builds to use the new variant. > > It turns out that clang defines __GNUC__ == 4. Flip it around and check > __clang__ as well, leaving a note to remove it later. > > > clang reports itself as GCC 4.2, the priority argument was introduced in > GCC 4.3. > > Reported by: cem > > Modified: > head/lib/libc/secure/stack_protector.c > > Modified: head/lib/libc/secure/stack_protector.c > ============================================================================== > --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r354671) > +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r354672) > @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); > * they're either not usually statically linked or they simply don't do things > * in constructors that would be adversely affected by their positioning with > * respect to this initialization. > + * > + * This conditional should be removed when GCC 4.2 is removed. > */ > -#if defined(__GNUC__) && __GNUC__ <= 4 > -#define _GUARD_SETUP_CTOR_ATTR \ > - __attribute__((__constructor__, __used__)); > -#else > +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) > #define _GUARD_SETUP_CTOR_ATTR \ > __attribute__((__constructor__ (200), __used__)); > +#else > +#define _GUARD_SETUP_CTOR_ATTR \ > + __attribute__((__constructor__, __used__)); > #endif > > extern int __sysctl(const int *name, u_int namelen, void *oldp, > > Please fix properly. Assuming clang always supported it, something like: > > #if __GNUC_PREREQ__(4, 3) || __has_attribute(__constructor__) > > should work > > Cheers, > I considered something of this sort, but searching for information on the priority argument in the first place was annoying enough that I had too much search-fatigue to figure out when GCC actually corrected this, thus assuming that GCC5 (which seemed to be an all-around good release if memory serves) and later (since I confirmed GCC6) was sufficient. I'll fix it in the morning (~8 hours) if I receive no further objections to address. Thanks! > From owner-svn-src-head@freebsd.org Wed Nov 13 04:44:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADEA017DC17 for ; Wed, 13 Nov 2019 04:44:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CX8c4KSdz4Xd8 for ; Wed, 13 Nov 2019 04:44:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf2f.google.com with SMTP id s18so306182qvr.4 for ; Tue, 12 Nov 2019 20:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BcFCRi0c9lezrJzbmwkIKvmq8p5WM2tejFH3tEg4rsE=; b=UtZiCnJMP5BznIts+tZ6ecuJPPPspYqjXyA0wTDFgir7CPASgISLwt3hg5jF0Q2rJU l5xniNisBj/rW80WGkiT26tuqgrrnkbhyfhEfmLsCon20qAbsVy2odlR4zdd7DDnEfVC Katb4vSLHSv/glvuEUq2J9Wr8tep9e2n0I7IQEVnhwSDF4r94mf1d549v99ZrH9UTg+h 9gSkBSWwe91JOx6cjNXGUiga9wNuK16dJ5+4p5ABrNyPJkwAQf1YRr336tSFhra7f4Wj Ln+7MnjHZkJpBBCJ2wiDxmkSnp/HNGducDjRObIpD4c9oMarnhv7N7hYtlgD8le8ehbb jnIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BcFCRi0c9lezrJzbmwkIKvmq8p5WM2tejFH3tEg4rsE=; b=G1EgMpvEjs2Z40hjtbmRsRMyPmeWdTEw9uOGtOt8N4TudOLWzbhGR+ZS7sm45xEFMe fGhVpsfwYEIOVHBUPc5+YaT75e+o11tLD3pKHM+wXDaIT/SGYQ2zTUD3S5+SziIyF2g8 p+rgvVqe5Idwb8DSldV7jAlEFIYlHLyRxkKkrCp/0mlribJmZHCItG2r6X/gg7eaDzE6 9iCmSla/cpOEK4IGrz0MY28UifGIy6cCgetydrzskvElb+PsbF/PneVGKhdxldMhwrlN gIvm1u8mdYI8V/kuOE1hBNNPUJDRSBYshHYNHy0tV2Hj6CWMRn2KVN7MxTHAn80z83vl b0vw== X-Gm-Message-State: APjAAAWOnMqYrS0sY571s90Bn5hPsLVipkDzHVF/7LQnlYWou7aY55+g QHjmxZOs7Xbhr1u50WD1ArNPSpa+eat8Dr8IUIw/TIj0KeY= X-Google-Smtp-Source: APXvYqy3W/6FLwRIYqGTDM9seE2j3XMSmz+j8Wz01avmaee6UpY0tmtNkmdQtf/hQH3nxwSNSRFycCcQAKO/36SOlO4= X-Received: by 2002:a0c:e74d:: with SMTP id g13mr1148325qvn.125.1573620281830; Tue, 12 Nov 2019 20:44:41 -0800 (PST) MIME-Version: 1.0 References: <201911130300.xAD30WUE099996@repo.freebsd.org> <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Tue, 12 Nov 2019 21:44:30 -0700 Message-ID: Subject: Re: svn commit: r354672 - head/lib/libc/secure To: Kyle Evans Cc: Pedro Giffuni , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47CX8c4KSdz4Xd8 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=UtZiCnJM; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f2f) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.88 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.88)[ipnet: 2607:f8b0::/32(-2.33), asn: 15169(-2.00), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 04:44:49 -0000 On Tue, Nov 12, 2019 at 9:20 PM Kyle Evans wrote: > > > On Tue, Nov 12, 2019, 22:04 Pedro Giffuni wrote: > >> >> On 12/11/2019 22:00, Kyle Evans wrote: >> >> Author: kevans >> Date: Wed Nov 13 03:00:32 2019 >> New Revision: 354672 >> URL: https://svnweb.freebsd.org/changeset/base/354672 >> >> Log: >> ssp: rework the logic to use priority=200 on clang builds >> >> The preproc logic was added at the last minute to appease GCC 4.2, and >> kevans@ did clearly not go back and double-check that the logic worked out >> for clang builds to use the new variant. >> >> It turns out that clang defines __GNUC__ == 4. Flip it around and check >> __clang__ as well, leaving a note to remove it later. >> >> >> clang reports itself as GCC 4.2, the priority argument was introduced in >> GCC 4.3. >> >> Reported by: cem >> >> Modified: >> head/lib/libc/secure/stack_protector.c >> >> Modified: head/lib/libc/secure/stack_protector.c >> ============================================================================== >> --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r354671) >> +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r354672) >> @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); >> * they're either not usually statically linked or they simply don't do things >> * in constructors that would be adversely affected by their positioning with >> * respect to this initialization. >> + * >> + * This conditional should be removed when GCC 4.2 is removed. >> */ >> -#if defined(__GNUC__) && __GNUC__ <= 4 >> -#define _GUARD_SETUP_CTOR_ATTR \ >> - __attribute__((__constructor__, __used__)); >> -#else >> +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) >> #define _GUARD_SETUP_CTOR_ATTR \ >> __attribute__((__constructor__ (200), __used__)); >> +#else >> +#define _GUARD_SETUP_CTOR_ATTR \ >> + __attribute__((__constructor__, __used__)); >> #endif >> >> extern int __sysctl(const int *name, u_int namelen, void *oldp, >> >> Please fix properly. Assuming clang always supported it, something like: >> >> #if __GNUC_PREREQ__(4, 3) || __has_attribute(__constructor__) >> >> should work >> >> Cheers, >> > > I considered something of this sort, but searching for information on the > priority argument in the first place was annoying enough that I had too > much search-fatigue to figure out when GCC actually corrected this, thus > assuming that GCC5 (which seemed to be an all-around good release if memory > serves) and later (since I confirmed GCC6) was sufficient. > > I'll fix it in the morning (~8 hours) if I receive no further objections > to address. > Soon enough this can be removed entirely... Getting it pedantically right in the mean time has little value. We don't really support gcc5 at the moment. gcc6 and later have good support, but anything new between 4.3 and 6.0 likely is poorly tagged... Warner From owner-svn-src-head@freebsd.org Wed Nov 13 11:21:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4709B1AE3C5; Wed, 13 Nov 2019 11:21:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Chxq1BN2z3Q9q; Wed, 13 Nov 2019 11:21:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D96EF555; Wed, 13 Nov 2019 11:21:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADBL2k9094942; Wed, 13 Nov 2019 11:21:02 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADBL22V094940; Wed, 13 Nov 2019 11:21:02 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911131121.xADBL22V094940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 13 Nov 2019 11:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354679 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 11:21:03 -0000 Author: bz Date: Wed Nov 13 11:21:02 2019 New Revision: 354679 URL: https://svnweb.freebsd.org/changeset/base/354679 Log: lltabl: remove dead code Remove the long (8? years ago) #if 0 marked function lltable_drain() and while here also remove the unused function llentry_alloc() which has call paths tools keep finding and are never used. Sponsored by: Netflix Modified: head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Wed Nov 13 10:08:45 2019 (r354678) +++ head/sys/net/if_llatbl.c Wed Nov 13 11:21:02 2019 (r354679) @@ -447,50 +447,6 @@ llentry_free(struct llentry *lle) } /* - * (al)locate an llentry for address dst (equivalent to rtalloc for new-arp). - * - * If found the llentry * is returned referenced and unlocked. - */ -struct llentry * -llentry_alloc(struct ifnet *ifp, struct lltable *lt, - struct sockaddr_storage *dst) -{ - struct epoch_tracker et; - struct llentry *la, *la_tmp; - - NET_EPOCH_ENTER(et); - la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); - NET_EPOCH_EXIT(et); - - if (la != NULL) { - LLE_ADDREF(la); - LLE_WUNLOCK(la); - return (la); - } - - if ((ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { - la = lltable_alloc_entry(lt, 0, (struct sockaddr *)dst); - if (la == NULL) - return (NULL); - IF_AFDATA_WLOCK(ifp); - LLE_WLOCK(la); - /* Prefer any existing LLE over newly-created one */ - la_tmp = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); - if (la_tmp == NULL) - lltable_link_entry(lt, la); - IF_AFDATA_WUNLOCK(ifp); - if (la_tmp != NULL) { - lltable_free_entry(lt, la); - la = la_tmp; - } - LLE_ADDREF(la); - LLE_WUNLOCK(la); - } - - return (la); -} - -/* * Free all entries from given table and free itself. */ @@ -533,34 +489,6 @@ lltable_free(struct lltable *llt) llt->llt_free_tbl(llt); } - -#if 0 -void -lltable_drain(int af) -{ - struct lltable *llt; - struct llentry *lle; - int i; - - LLTABLE_LIST_RLOCK(); - SLIST_FOREACH(llt, &V_lltables, llt_link) { - if (llt->llt_af != af) - continue; - - for (i=0; i < llt->llt_hsize; i++) { - CK_LIST_FOREACH(lle, &llt->lle_head[i], lle_next) { - LLE_WLOCK(lle); - if (lle->la_hold) { - m_freem(lle->la_hold); - lle->la_hold = NULL; - } - LLE_WUNLOCK(lle); - } - } - } - LLTABLE_LIST_RUNLOCK(); -} -#endif /* * Deletes an address from given lltable. Modified: head/sys/net/if_llatbl.h ============================================================================== --- head/sys/net/if_llatbl.h Wed Nov 13 10:08:45 2019 (r354678) +++ head/sys/net/if_llatbl.h Wed Nov 13 11:21:02 2019 (r354679) @@ -211,14 +211,9 @@ void lltable_free(struct lltable *); void lltable_link(struct lltable *llt); void lltable_prefix_free(int, struct sockaddr *, struct sockaddr *, u_int); -#if 0 -void lltable_drain(int); -#endif int lltable_sysctl_dumparp(int, struct sysctl_req *); size_t llentry_free(struct llentry *); -struct llentry *llentry_alloc(struct ifnet *, struct lltable *, - struct sockaddr_storage *); /* helper functions */ size_t lltable_drop_entry_queue(struct llentry *); From owner-svn-src-head@freebsd.org Wed Nov 13 12:05:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 238D81AFCC7; Wed, 13 Nov 2019 12:05:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CjxV0vWdz3xbJ; Wed, 13 Nov 2019 12:05:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D73C6FDF7; Wed, 13 Nov 2019 12:05:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADC5ncH023916; Wed, 13 Nov 2019 12:05:49 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADC5nUv023913; Wed, 13 Nov 2019 12:05:49 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911131205.xADC5nUv023913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 13 Nov 2019 12:05:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354680 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 12:05:50 -0000 Author: bz Date: Wed Nov 13 12:05:48 2019 New Revision: 354680 URL: https://svnweb.freebsd.org/changeset/base/354680 Log: nd6 defrouter: consolidate nd_defrouter manipulations in nd6_rtr.c Move the nd_defrouter along with the sysctl handler from nd6.c to nd6_rtr.c and make the variable file static. Provide (temporary) new accessor functions for code manipulating nd_defrouter from nd6.c, and stop exporting functions no longer needed outside nd6_rtr.c. This also shuffles a few functions around in nd6_rtr.c without functional changes. Given all nd_defrouter logic is now in one place we can tidy up the code, locking and, and other open items. MFC after: 3 weeks X-MFC: keep exporting the functions Sponsored by: Netflix Modified: head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Wed Nov 13 11:21:02 2019 (r354679) +++ head/sys/netinet6/nd6.c Wed Nov 13 12:05:48 2019 (r354680) @@ -116,7 +116,6 @@ VNET_DEFINE(int, nd6_debug) = 0; static eventhandler_tag lle_event_eh, iflladdr_event_eh, ifnet_link_event_eh; -VNET_DEFINE(struct nd_drhead, nd_defrouter); VNET_DEFINE(struct nd_prhead, nd_prefix); VNET_DEFINE(struct rwlock, nd6_lock); VNET_DEFINE(uint64_t, nd6_list_genid); @@ -218,7 +217,7 @@ nd6_init(void) rw_init(&V_nd6_lock, "nd6 list"); LIST_INIT(&V_nd_prefix); - TAILQ_INIT(&V_nd_defrouter); + nd6_defrouter_init(); /* Start timers. */ callout_init(&V_nd6_slowtimo_ch, 0); @@ -901,28 +900,16 @@ nd6_timer(void *arg) { CURVNET_SET((struct vnet *) arg); struct epoch_tracker et; - struct nd_drhead drq; struct nd_prhead prl; - struct nd_defrouter *dr, *ndr; struct nd_prefix *pr, *npr; struct ifnet *ifp; struct in6_ifaddr *ia6, *nia6; uint64_t genid; - TAILQ_INIT(&drq); LIST_INIT(&prl); - ND6_WLOCK(); - TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) - if (dr->expire && dr->expire < time_uptime) - defrouter_unlink(dr, &drq); - ND6_WUNLOCK(); - NET_EPOCH_ENTER(et); - while ((dr = TAILQ_FIRST(&drq)) != NULL) { - TAILQ_REMOVE(&drq, dr, dr_entry); - defrouter_del(dr); - } + nd6_defrouter_timer(); /* * expire interface addresses. @@ -1146,34 +1133,15 @@ regen_tmpaddr(struct in6_ifaddr *ia6) void nd6_purge(struct ifnet *ifp) { - struct nd_drhead drq; struct nd_prhead prl; - struct nd_defrouter *dr, *ndr; struct nd_prefix *pr, *npr; - TAILQ_INIT(&drq); LIST_INIT(&prl); - /* - * Nuke default router list entries toward ifp. - * We defer removal of default router list entries that is installed - * in the routing table, in order to keep additional side effects as - * small as possible. - */ - ND6_WLOCK(); - TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) { - if (dr->installed) - continue; - if (dr->ifp == ifp) - defrouter_unlink(dr, &drq); - } - TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) { - if (!dr->installed) - continue; - if (dr->ifp == ifp) - defrouter_unlink(dr, &drq); - } + /* Purge default router list entries toward ifp. */ + nd6_defrouter_purge(ifp); + ND6_WLOCK(); /* * Remove prefixes on ifp. We should have already removed addresses on * this interface, so no addresses should be referencing these prefixes. @@ -1184,11 +1152,7 @@ nd6_purge(struct ifnet *ifp) } ND6_WUNLOCK(); - /* Delete the unlinked router and prefix objects. */ - while ((dr = TAILQ_FIRST(&drq)) != NULL) { - TAILQ_REMOVE(&drq, dr, dr_entry); - defrouter_del(dr); - } + /* Delete the unlinked prefix objects. */ while ((pr = LIST_FIRST(&prl)) != NULL) { LIST_REMOVE(pr, ndpr_entry); nd6_prefix_del(pr); @@ -1376,7 +1340,7 @@ restart: * as on-link, and thus, as a neighbor. */ if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV && - TAILQ_EMPTY(&V_nd_defrouter) && + nd6_defrouter_list_empty() && V_nd6_defifindex == ifp->if_index) { return (1); } @@ -1819,22 +1783,9 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) case SIOCSRTRFLUSH_IN6: { /* flush all the default routers */ - struct nd_drhead drq; - struct nd_defrouter *dr; - TAILQ_INIT(&drq); - defrouter_reset(); - - ND6_WLOCK(); - while ((dr = TAILQ_FIRST(&V_nd_defrouter)) != NULL) - defrouter_unlink(dr, &drq); - ND6_WUNLOCK(); - while ((dr = TAILQ_FIRST(&drq)) != NULL) { - TAILQ_REMOVE(&drq, dr, dr_entry); - defrouter_del(dr); - } - + nd6_defrouter_flush_all(); defrouter_select(); break; } @@ -2626,14 +2577,9 @@ clear_llinfo_pqueue(struct llentry *ln) ln->la_hold = NULL; } -static int nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS); static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS); SYSCTL_DECL(_net_inet6_icmp6); -SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist, - CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, nd6_sysctl_drlist, "S,in6_defrouter", - "NDP default router list"); SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_PRLIST, nd6_prlist, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, nd6_sysctl_prlist, "S,in6_prefix", @@ -2642,42 +2588,6 @@ SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXQLEN, nd CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_maxqueuelen), 1, ""); SYSCTL_INT(_net_inet6_icmp6, OID_AUTO, nd6_gctimer, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_gctimer), (60 * 60 * 24), ""); - -static int -nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS) -{ - struct in6_defrouter d; - struct nd_defrouter *dr; - int error; - - if (req->newptr != NULL) - return (EPERM); - - error = sysctl_wire_old_buffer(req, 0); - if (error != 0) - return (error); - - bzero(&d, sizeof(d)); - d.rtaddr.sin6_family = AF_INET6; - d.rtaddr.sin6_len = sizeof(d.rtaddr); - - ND6_RLOCK(); - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { - d.rtaddr.sin6_addr = dr->rtaddr; - error = sa6_recoverscope(&d.rtaddr); - if (error != 0) - break; - d.flags = dr->raflags; - d.rtlifetime = dr->rtlifetime; - d.expire = dr->expire + (time_second - time_uptime); - d.if_index = dr->ifp->if_index; - error = SYSCTL_OUT(req, &d, sizeof(d)); - if (error != 0) - break; - } - ND6_RUNLOCK(); - return (error); -} static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Wed Nov 13 11:21:02 2019 (r354679) +++ head/sys/netinet6/nd6.h Wed Nov 13 12:05:48 2019 (r354680) @@ -335,7 +335,6 @@ VNET_DECLARE(int, nd6_mmaxtries); VNET_DECLARE(int, nd6_useloopback); VNET_DECLARE(int, nd6_maxnudhint); VNET_DECLARE(int, nd6_gctimer); -VNET_DECLARE(struct nd_drhead, nd_defrouter); VNET_DECLARE(struct nd_prhead, nd_prefix); VNET_DECLARE(int, nd6_debug); VNET_DECLARE(int, nd6_onlink_ns_rfc4861); @@ -346,7 +345,6 @@ VNET_DECLARE(int, nd6_onlink_ns_rfc4861); #define V_nd6_useloopback VNET(nd6_useloopback) #define V_nd6_maxnudhint VNET(nd6_maxnudhint) #define V_nd6_gctimer VNET(nd6_gctimer) -#define V_nd_defrouter VNET(nd_defrouter) #define V_nd_prefix VNET(nd_prefix) #define V_nd6_debug VNET(nd6_debug) #define V_nd6_onlink_ns_rfc4861 VNET(nd6_onlink_ns_rfc4861) @@ -477,14 +475,18 @@ void nd6_dad_stop(struct ifaddr *); void nd6_rs_input(struct mbuf *, int, int); void nd6_ra_input(struct mbuf *, int, int); void nd6_ifnet_link_event(void *, struct ifnet *, int); +struct nd_defrouter *defrouter_lookup(struct in6_addr *, struct ifnet *); +struct nd_defrouter *defrouter_lookup_locked(struct in6_addr *, struct ifnet *); void defrouter_reset(void); void defrouter_select_fib(int fibnum); void defrouter_select(void); -void defrouter_ref(struct nd_defrouter *); void defrouter_rele(struct nd_defrouter *); bool defrouter_remove(struct in6_addr *, struct ifnet *); -void defrouter_unlink(struct nd_defrouter *, struct nd_drhead *); -void defrouter_del(struct nd_defrouter *); +bool nd6_defrouter_list_empty(void); +void nd6_defrouter_flush_all(void); +void nd6_defrouter_purge(struct ifnet *); +void nd6_defrouter_timer(void); +void nd6_defrouter_init(void); int nd6_prelist_add(struct nd_prefixctl *, struct nd_defrouter *, struct nd_prefix **); void nd6_prefix_unlink(struct nd_prefix *, struct nd_prhead *); @@ -494,8 +496,6 @@ void nd6_prefix_rele(struct nd_prefix *); int nd6_prefix_onlink(struct nd_prefix *); int nd6_prefix_offlink(struct nd_prefix *); void pfxlist_onlink_check(void); -struct nd_defrouter *defrouter_lookup(struct in6_addr *, struct ifnet *); -struct nd_defrouter *defrouter_lookup_locked(struct in6_addr *, struct ifnet *); struct nd_prefix *nd6_prefix_lookup(struct nd_prefixctl *); void rt6_flush(struct in6_addr *, struct ifnet *); int nd6_setdefaultiface(int); Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Wed Nov 13 11:21:02 2019 (r354679) +++ head/sys/netinet6/nd6_rtr.c Wed Nov 13 12:05:48 2019 (r354680) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -91,6 +92,9 @@ static void in6_init_address_ltimes(struct nd_prefix * static int rt6_deleteroute(const struct rtentry *, void *); +VNET_DEFINE_STATIC(struct nd_drhead, nd_defrouter); +#define V_nd_defrouter VNET(nd_defrouter) + VNET_DECLARE(int, nd6_recalc_reachtm_interval); #define V_nd6_recalc_reachtm_interval VNET(nd6_recalc_reachtm_interval) @@ -117,7 +121,38 @@ VNET_DEFINE(int, nd6_ignore_ipv6_only_ra) = 1; #define RTPREF_RESERVED (-2) #define RTPREF_INVALID (-3) /* internal */ +static void +defrouter_ref(struct nd_defrouter *dr) +{ + + refcount_acquire(&dr->refcnt); +} + +void +defrouter_rele(struct nd_defrouter *dr) +{ + + if (refcount_release(&dr->refcnt)) + free(dr, M_IP6NDP); +} + /* + * Remove a router from the global list and optionally stash it in a + * caller-supplied queue. + */ +static void +defrouter_unlink(struct nd_defrouter *dr, struct nd_drhead *drq) +{ + + ND6_WLOCK_ASSERT(); + + TAILQ_REMOVE(&V_nd_defrouter, dr, dr_entry); + V_nd6_list_genid++; + if (drq != NULL) + TAILQ_INSERT_TAIL(drq, dr, dr_entry); +} + +/* * Receive Router Solicitation Message - just for routers. * Router solicitation/advertisement is mostly managed by userland program * (rtadvd) so here we have no function like nd6_ra_output(). @@ -670,21 +705,6 @@ defrouter_lookup(struct in6_addr *addr, struct ifnet * return (dr); } -void -defrouter_ref(struct nd_defrouter *dr) -{ - - refcount_acquire(&dr->refcnt); -} - -void -defrouter_rele(struct nd_defrouter *dr) -{ - - if (refcount_release(&dr->refcnt)) - free(dr, M_IP6NDP); -} - /* * Remove the default route for a given router. * This is just a subroutine function for defrouter_select_fib(), and @@ -759,47 +779,7 @@ defrouter_reset(void) */ } -/* - * Look up a matching default router list entry and remove it. Returns true if a - * matching entry was found, false otherwise. - */ -bool -defrouter_remove(struct in6_addr *addr, struct ifnet *ifp) -{ - struct nd_defrouter *dr; - - ND6_WLOCK(); - dr = defrouter_lookup_locked(addr, ifp); - if (dr == NULL) { - ND6_WUNLOCK(); - return (false); - } - - defrouter_unlink(dr, NULL); - ND6_WUNLOCK(); - defrouter_del(dr); - defrouter_rele(dr); - return (true); -} - -/* - * Remove a router from the global list and optionally stash it in a - * caller-supplied queue. - * - * The ND lock must be held. - */ -void -defrouter_unlink(struct nd_defrouter *dr, struct nd_drhead *drq) -{ - - ND6_WLOCK_ASSERT(); - TAILQ_REMOVE(&V_nd_defrouter, dr, dr_entry); - V_nd6_list_genid++; - if (drq != NULL) - TAILQ_INSERT_TAIL(drq, dr, dr_entry); -} - -void +static void defrouter_del(struct nd_defrouter *dr) { struct nd_defrouter *deldr = NULL; @@ -850,7 +830,31 @@ defrouter_del(struct nd_defrouter *dr) defrouter_rele(dr); } + /* + * Look up a matching default router list entry and remove it. Returns true if a + * matching entry was found, false otherwise. + */ +bool +defrouter_remove(struct in6_addr *addr, struct ifnet *ifp) +{ + struct nd_defrouter *dr; + + ND6_WLOCK(); + dr = defrouter_lookup_locked(addr, ifp); + if (dr == NULL) { + ND6_WUNLOCK(); + return (false); + } + + defrouter_unlink(dr, NULL); + ND6_WUNLOCK(); + defrouter_del(dr); + defrouter_rele(dr); + return (true); +} + +/* * Default Router Selection according to Section 6.3.6 of RFC 2461 and * draft-ietf-ipngwg-router-selection: * 1) Routers that are reachable or probably reachable should be preferred. @@ -2531,4 +2535,133 @@ nd6_setdefaultiface(int ifindex) } return (error); +} + +static int +nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS) +{ + struct in6_defrouter d; + struct nd_defrouter *dr; + int error; + + if (req->newptr != NULL) + return (EPERM); + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + bzero(&d, sizeof(d)); + d.rtaddr.sin6_family = AF_INET6; + d.rtaddr.sin6_len = sizeof(d.rtaddr); + + ND6_RLOCK(); + TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { + d.rtaddr.sin6_addr = dr->rtaddr; + error = sa6_recoverscope(&d.rtaddr); + if (error != 0) + break; + d.flags = dr->raflags; + d.rtlifetime = dr->rtlifetime; + d.expire = dr->expire + (time_second - time_uptime); + d.if_index = dr->ifp->if_index; + error = SYSCTL_OUT(req, &d, sizeof(d)); + if (error != 0) + break; + } + ND6_RUNLOCK(); + return (error); +} +SYSCTL_DECL(_net_inet6_icmp6); +SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist, + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, 0, nd6_sysctl_drlist, "S,in6_defrouter", + "NDP default router list"); + +bool +nd6_defrouter_list_empty(void) +{ + + return (TAILQ_EMPTY(&V_nd_defrouter)); +} + +void +nd6_defrouter_timer(void) +{ + struct nd_defrouter *dr, *ndr; + struct nd_drhead drq; + + TAILQ_INIT(&drq); + + ND6_WLOCK(); + TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) + if (dr->expire && dr->expire < time_uptime) + defrouter_unlink(dr, &drq); + ND6_WUNLOCK(); + + while ((dr = TAILQ_FIRST(&drq)) != NULL) { + TAILQ_REMOVE(&drq, dr, dr_entry); + defrouter_del(dr); + } +} + +/* + * Nuke default router list entries toward ifp. + * We defer removal of default router list entries that is installed in the + * routing table, in order to keep additional side effects as small as possible. + */ +void +nd6_defrouter_purge(struct ifnet *ifp) +{ + struct nd_defrouter *dr, *ndr; + struct nd_drhead drq; + + TAILQ_INIT(&drq); + + ND6_WLOCK(); + TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) { + if (dr->installed) + continue; + if (dr->ifp == ifp) + defrouter_unlink(dr, &drq); + } + TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) { + if (!dr->installed) + continue; + if (dr->ifp == ifp) + defrouter_unlink(dr, &drq); + } + ND6_WUNLOCK(); + + /* Delete the unlinked router objects. */ + while ((dr = TAILQ_FIRST(&drq)) != NULL) { + TAILQ_REMOVE(&drq, dr, dr_entry); + defrouter_del(dr); + } +} + +void +nd6_defrouter_flush_all(void) +{ + struct nd_defrouter *dr; + struct nd_drhead drq; + + TAILQ_INIT(&drq); + + ND6_WLOCK(); + while ((dr = TAILQ_FIRST(&V_nd_defrouter)) != NULL) + defrouter_unlink(dr, &drq); + ND6_WUNLOCK(); + + while ((dr = TAILQ_FIRST(&drq)) != NULL) { + TAILQ_REMOVE(&drq, dr, dr_entry); + defrouter_del(dr); + } +} + +void +nd6_defrouter_init(void) +{ + + TAILQ_INIT(&V_nd_defrouter); } From owner-svn-src-head@freebsd.org Wed Nov 13 13:20:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF0DF1B0FD8; Wed, 13 Nov 2019 13:20:07 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ClbC5pxnz41Cd; Wed, 13 Nov 2019 13:20:07 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 9F2631351B; Wed, 13 Nov 2019 13:20:07 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f48.google.com with SMTP id n12so783086qvt.1; Wed, 13 Nov 2019 05:20:07 -0800 (PST) X-Gm-Message-State: APjAAAVhKYuP1iN+G4cKP2YW1M7VggZiU9xfmtKANbcCk+HFXFKRG+jU d0aOsz9YBEn6IriCf3Ebx6C/qMzZs3S9UGvr+Ak= X-Google-Smtp-Source: APXvYqzjV75zFpc9q0Ok7VM92L6s5P99LQ7tzS1fcj55FBP7JpaVDV2OqwUprdmd/D+38AHOT5/h8EcpFECc2tOgPKE= X-Received: by 2002:a05:6214:22c:: with SMTP id j12mr2631472qvt.150.1573651206920; Wed, 13 Nov 2019 05:20:06 -0800 (PST) MIME-Version: 1.0 References: <201911122129.xACLTril005968@repo.freebsd.org> In-Reply-To: <201911122129.xACLTril005968@repo.freebsd.org> From: Kyle Evans Date: Wed, 13 Nov 2019 07:19:55 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354661 - head To: John Baldwin Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 13:20:08 -0000 On Tue, Nov 12, 2019 at 3:29 PM John Baldwin wrote: > > Author: jhb > Date: Tue Nov 12 21:29:52 2019 > New Revision: 354661 > URL: https://svnweb.freebsd.org/changeset/base/354661 > > Log: > Force MK_CLANG_IS_CC on in XMAKE. > > This ensures that a bootstrap clang compiler is always installed as cc > in WORLDTMP. If it is only installed as 'clang' then /usr/bin/cc is > used during the build instead of the bootstrap compiler. > > Reviewed by: imp > MFC after: 1 month > Sponsored by: DARPA > Differential Revision: https://reviews.freebsd.org/D22332 > > Modified: > head/Makefile.inc1 > > Modified: head/Makefile.inc1 > ============================================================================== > --- head/Makefile.inc1 Tue Nov 12 21:26:50 2019 (r354660) > +++ head/Makefile.inc1 Tue Nov 12 21:29:52 2019 (r354661) > @@ -734,6 +734,7 @@ TMAKE= \ > # TOOLS_PREFIX set in BMAKE > XMAKE= ${BMAKE} \ > TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ > + MK_CLANG_IS_CC=yes \ > MK_GDB=no MK_TESTS=no > > # kernel-tools stage This sounds wrong for any arch not currently supported by in-tree clang, and CI for those archs have been failing about since here: https://ci.freebsd.org/tinderbox/ Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Wed Nov 13 13:53:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 991211B1A8E; Wed, 13 Nov 2019 13:53:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CmKV3XGSz4301; Wed, 13 Nov 2019 13:53:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DB4A19155; Wed, 13 Nov 2019 13:53:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADDrIF6087828; Wed, 13 Nov 2019 13:53:18 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADDrI7b087826; Wed, 13 Nov 2019 13:53:18 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911131353.xADDrI7b087826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 13 Nov 2019 13:53:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354681 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 13:53:18 -0000 Author: bz Date: Wed Nov 13 13:53:17 2019 New Revision: 354681 URL: https://svnweb.freebsd.org/changeset/base/354681 Log: nd6: make nd6_alloc() file static nd6_alloc() is a function used only locally. Make it static and no longer export it. Keeps the KPI smaller. Sponsored by: Netflix Modified: head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Wed Nov 13 12:05:48 2019 (r354680) +++ head/sys/netinet6/nd6.c Wed Nov 13 13:53:17 2019 (r354681) @@ -1190,7 +1190,7 @@ nd6_lookup(const struct in6_addr *addr6, int flags, st return (ln); } -struct llentry * +static struct llentry * nd6_alloc(const struct in6_addr *addr6, int flags, struct ifnet *ifp) { struct sockaddr_in6 sin6; Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Wed Nov 13 12:05:48 2019 (r354680) +++ head/sys/netinet6/nd6.h Wed Nov 13 13:53:17 2019 (r354681) @@ -438,7 +438,6 @@ void nd6_option_init(void *, int, union nd_opts *); struct nd_opt_hdr *nd6_option(union nd_opts *); int nd6_options(union nd_opts *); struct llentry *nd6_lookup(const struct in6_addr *, int, struct ifnet *); -struct llentry *nd6_alloc(const struct in6_addr *, int, struct ifnet *); void nd6_setmtu(struct ifnet *); void nd6_llinfo_setstate(struct llentry *lle, int newstate); void nd6_timer(void *); From owner-svn-src-head@freebsd.org Wed Nov 13 14:28:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20A771B21AE; Wed, 13 Nov 2019 14:28:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Cn5h03z5z45R7; Wed, 13 Nov 2019 14:28:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0AA019695; Wed, 13 Nov 2019 14:28:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADES7eU005814; Wed, 13 Nov 2019 14:28:07 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADES7x4005813; Wed, 13 Nov 2019 14:28:07 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911131428.xADES7x4005813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 13 Nov 2019 14:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354682 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 14:28:08 -0000 Author: bz Date: Wed Nov 13 14:28:07 2019 New Revision: 354682 URL: https://svnweb.freebsd.org/changeset/base/354682 Log: nd6: remove unused structs and defines Remove a collections of unused structs and #defines to make it easier to understand what is actually in use. Sponsored by: Netflix Modified: head/sys/netinet6/nd6.h Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Wed Nov 13 13:53:17 2019 (r354681) +++ head/sys/netinet6/nd6.h Wed Nov 13 14:28:07 2019 (r354682) @@ -116,19 +116,7 @@ struct in6_nbrinfo { int expire; /* lifetime for NDP state transition */ }; -#define DRLSTSIZ 10 -#define PRLSTSIZ 10 -struct in6_drlist { - char ifname[IFNAMSIZ]; - struct { - struct in6_addr rtaddr; - u_char flags; - u_short rtlifetime; - u_long expire; - u_short if_index; - } defrouter[DRLSTSIZ]; -}; - +/* Sysctls, shared with user space. */ struct in6_defrouter { struct sockaddr_in6 rtaddr; u_char flags; @@ -137,40 +125,6 @@ struct in6_defrouter { u_short if_index; }; -#ifdef _KERNEL -struct in6_oprlist { - char ifname[IFNAMSIZ]; - struct { - struct in6_addr prefix; - struct prf_ra raflags; - u_char prefixlen; - u_char origin; - u_long vltime; - u_long pltime; - u_long expire; - u_short if_index; - u_short advrtrs; /* number of advertisement routers */ - struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ - } prefix[PRLSTSIZ]; -}; -#endif - -struct in6_prlist { - char ifname[IFNAMSIZ]; - struct { - struct in6_addr prefix; - struct prf_ra raflags; - u_char prefixlen; - u_char origin; - u_int32_t vltime; - u_int32_t pltime; - time_t expire; - u_short if_index; - u_short advrtrs; /* number of advertisement routers */ - struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ - } prefix[PRLSTSIZ]; -}; - struct in6_prefix { struct sockaddr_in6 prefix; struct prf_ra raflags; @@ -291,32 +245,6 @@ struct nd_prefix { #define ndpr_raf_onlink ndpr_flags.onlink #define ndpr_raf_auto ndpr_flags.autonomous #define ndpr_raf_router ndpr_flags.router - -/* - * Message format for use in obtaining information about prefixes - * from inet6 sysctl function - */ -struct inet6_ndpr_msghdr { - u_short inpm_msglen; /* to skip over non-understood messages */ - u_char inpm_version; /* future binary compatibility */ - u_char inpm_type; /* message type */ - struct in6_addr inpm_prefix; - u_long prm_vltim; - u_long prm_pltime; - u_long prm_expire; - u_long prm_preferred; - struct in6_prflags prm_flags; - u_short prm_index; /* index for associated ifp */ - u_char prm_plen; /* length of prefix in bits */ -}; - -#define prm_raf_onlink prm_flags.prf_ra.onlink -#define prm_raf_auto prm_flags.prf_ra.autonomous - -#define prm_statef_onlink prm_flags.prf_state.onlink - -#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid -#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd struct nd_pfxrouter { LIST_ENTRY(nd_pfxrouter) pfr_entry; From owner-svn-src-head@freebsd.org Wed Nov 13 15:31:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3470D1B3E8A; Wed, 13 Nov 2019 15:31:32 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CpVr0fckz49L6; Wed, 13 Nov 2019 15:31:32 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDE2C1A1A9; Wed, 13 Nov 2019 15:31:31 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADFVV17041528; Wed, 13 Nov 2019 15:31:31 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADFVVMV041527; Wed, 13 Nov 2019 15:31:31 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911131531.xADFVVMV041527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Wed, 13 Nov 2019 15:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354683 - head/sys/dev/fb X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/dev/fb X-SVN-Commit-Revision: 354683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 15:31:32 -0000 Author: scottl Date: Wed Nov 13 15:31:31 2019 New Revision: 354683 URL: https://svnweb.freebsd.org/changeset/base/354683 Log: Stop the VESA driver from whining loudly in the dmesg during boot on systems that use EFI instead of BIOS. Modified: head/sys/dev/fb/vesa.c Modified: head/sys/dev/fb/vesa.c ============================================================================== --- head/sys/dev/fb/vesa.c Wed Nov 13 14:28:07 2019 (r354682) +++ head/sys/dev/fb/vesa.c Wed Nov 13 15:31:31 2019 (r354683) @@ -1935,6 +1935,12 @@ vesa_load(void) if (error == 0) vesa_bios_info(bootverbose); + /* Don't return ENODEV, the upper layers will whine. */ + if (error == ENODEV) { + error = 0; + vesa_adp = NULL; + } + return (error); } @@ -1943,8 +1949,12 @@ vesa_unload(void) { int error; + /* The driver never initialized, so make it easy to unload. */ + if (vesa_adp == NULL) + return (0); + /* if the adapter is currently in a VESA mode, don't unload */ - if ((vesa_adp != NULL) && VESA_MODE(vesa_adp->va_mode)) + if (VESA_MODE(vesa_adp->va_mode)) return (EBUSY); /* * FIXME: if there is at least one vty which is in a VESA mode, From owner-svn-src-head@freebsd.org Wed Nov 13 15:52:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A13FE1B4445; Wed, 13 Nov 2019 15:52:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CpyT3c5Gz4BNq; Wed, 13 Nov 2019 15:52:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.2] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id F1FC61462F; Wed, 13 Nov 2019 15:51:58 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r354672 - head/lib/libc/secure To: Warner Losh , Kyle Evans Cc: src-committers , svn-src-all , svn-src-head References: <201911130300.xAD30WUE099996@repo.freebsd.org> <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: Date: Wed, 13 Nov 2019 10:51:58 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 15:52:01 -0000 Hi; On 12/11/2019 23:44, Warner Losh wrote: > > > On Tue, Nov 12, 2019 at 9:20 PM Kyle Evans > wrote: > > > > On Tue, Nov 12, 2019, 22:04 Pedro Giffuni > wrote: > > > On 12/11/2019 22:00, Kyle Evans wrote: >> Author: kevans >> Date: Wed Nov 13 03:00:32 2019 >> New Revision: 354672 >> URL:https://svnweb.freebsd.org/changeset/base/354672 >> >> Log: >> ssp: rework the logic to use priority=200 on clang builds >> >> The preproc logic was added at the last minute to appease GCC 4.2, and >> kevans@ did clearly not go back and double-check that the logic worked out >> for clang builds to use the new variant. >> >> It turns out that clang defines __GNUC__ == 4. Flip it around and check >> __clang__ as well, leaving a note to remove it later. >> > clang reports itself as GCC 4.2, the priority argument was > introduced in GCC 4.3. >> Reported by: cem >> >> Modified: >> head/lib/libc/secure/stack_protector.c >> >> Modified: head/lib/libc/secure/stack_protector.c >> ============================================================================== >> --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r354671) >> +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r354672) >> @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); >> * they're either not usually statically linked or they simply don't do things >> * in constructors that would be adversely affected by their positioning with >> * respect to this initialization. >> + * >> + * This conditional should be removed when GCC 4.2 is removed. >> */ >> -#if defined(__GNUC__) && __GNUC__ <= 4 >> -#define _GUARD_SETUP_CTOR_ATTR \ >> - __attribute__((__constructor__, __used__)); >> -#else >> +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) >> #define _GUARD_SETUP_CTOR_ATTR \ >> __attribute__((__constructor__ (200), __used__)); >> +#else >> +#define _GUARD_SETUP_CTOR_ATTR \ >> + __attribute__((__constructor__, __used__)); >> #endif >> >> extern int __sysctl(const int *name, u_int namelen, void *oldp, > > Please fix properly. Assuming clang always supported it, > something like: > > #if __GNUC_PREREQ__(4, 3) || __has_attribute(__constructor__) > > should work > > Cheers, > > > I considered something of this sort, but searching for information > on the priority argument in the first place was annoying enough > that I had too much search-fatigue to figure out when GCC actually > corrected this, thus assuming that GCC5 (which seemed to be an > all-around good release if memory serves) and later (since I > confirmed GCC6) was sufficient. > > I'll fix it in the morning (~8 hours) if I receive no further > objections to address. > > > Soon enough this can be removed entirely... Getting it pedantically > right in the mean time has little value. We don't really support gcc5 > at the moment. gcc6 and later have good support, but anything new > between 4.3 and 6.0 likely is poorly tagged... > Well, tracking attributes on GCC versions is not easy but I did spend a good amount of time getting the attributes right on cdefs.h and while I lost the battle to get support for older GCC versions deprecated, getting the attributes properly defined in the GCC 4.2 vs clang vicinity is particularly important. I particularly dislike the idea of leaving notes of stuff that can be removed when an existing compiler is gone. In this case, we can fix this without adding more lines of code, and that also helps in case the code is MFCd. Now ... if you want to be pedantic: this code doesn't handle the case for non-GCC based compilers, and it probably could be done more generic and clean in cdefs.h where it can be reused. But I am not asking for that ;). Pedro. From owner-svn-src-head@freebsd.org Wed Nov 13 15:56:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D56871B46C4; Wed, 13 Nov 2019 15:56:08 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Cq3D64PRz4BnL; Wed, 13 Nov 2019 15:56:08 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEFB61A6C9; Wed, 13 Nov 2019 15:56:08 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADFu8Mt058740; Wed, 13 Nov 2019 15:56:08 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADFu8tQ058737; Wed, 13 Nov 2019 15:56:08 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201911131556.xADFu8tQ058737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Wed, 13 Nov 2019 15:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354684 - in head/sys: security/mac vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: in head/sys: security/mac vm X-SVN-Commit-Revision: 354684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 15:56:08 -0000 Author: dougm Date: Wed Nov 13 15:56:07 2019 New Revision: 354684 URL: https://svnweb.freebsd.org/changeset/base/354684 Log: Define wrapper functions vm_map_entry_{succ,pred} to act as wrappers around entry->{next,prev} when those are used for ordered list traversal, and use those wrapper functions everywhere. Where the next field is used for maintaining a stack of deferred operations, #define defer_next to make that different usage clearer, and then use the 'right' pointer instead of 'next' for that purpose. Approved by: markj Tested by: pho (as part of a larger patch) Differential Revision: https://reviews.freebsd.org/D22347 Modified: head/sys/security/mac/mac_process.c head/sys/vm/vm_map.c head/sys/vm/vm_map.h head/sys/vm/vm_mmap.c Modified: head/sys/security/mac/mac_process.c ============================================================================== --- head/sys/security/mac/mac_process.c Wed Nov 13 15:31:31 2019 (r354683) +++ head/sys/security/mac/mac_process.c Wed Nov 13 15:56:07 2019 (r354684) @@ -363,7 +363,8 @@ mac_proc_vm_revoke_recurse(struct thread *td, struct u } pmap_protect(map->pmap, vme->start, vme->end, vme->protection & ~revokeperms); - vm_map_try_merge_entries(map, vme->prev, vme); + vm_map_try_merge_entries(map, vm_map_entry_pred(vme), + vme); } } vm_map_unlock(map); Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Wed Nov 13 15:31:31 2019 (r354683) +++ head/sys/vm/vm_map.c Wed Nov 13 15:56:07 2019 (r354684) @@ -563,6 +563,12 @@ vm_map_entry_set_vnode_text(vm_map_entry_t entry, bool } } +/* + * Use a different name for this vm_map_entry field when it's use + * is not consistent with its use as part of an ordered search tree. + */ +#define defer_next right + static void vm_map_process_deferred(void) { @@ -574,7 +580,7 @@ vm_map_process_deferred(void) entry = td->td_map_def_user; td->td_map_def_user = NULL; while (entry != NULL) { - next = entry->next; + next = entry->defer_next; MPASS((entry->eflags & (MAP_ENTRY_WRITECNT | MAP_ENTRY_VN_EXEC)) != (MAP_ENTRY_WRITECNT | MAP_ENTRY_VN_EXEC)); @@ -1436,7 +1442,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof /* * Assert that the next entry doesn't overlap the end point. */ - if (prev_entry->next->start < end) + if (vm_map_entry_succ(prev_entry)->start < end) return (KERN_NO_SPACE); if ((cow & MAP_CREATE_GUARD) != 0 && (object != NULL || @@ -1529,7 +1535,8 @@ charged: map->size += end - prev_entry->end; vm_map_entry_resize(map, prev_entry, end - prev_entry->end); - vm_map_try_merge_entries(map, prev_entry, prev_entry->next); + vm_map_try_merge_entries(map, prev_entry, + vm_map_entry_succ(prev_entry)); return (KERN_SUCCESS); } @@ -1590,7 +1597,7 @@ charged: * other cases, which are less common. */ vm_map_try_merge_entries(map, prev_entry, new_entry); - vm_map_try_merge_entries(map, new_entry, new_entry->next); + vm_map_try_merge_entries(map, new_entry, vm_map_entry_succ(new_entry)); if ((cow & (MAP_PREFAULT | MAP_PREFAULT_PARTIAL)) != 0) { vm_map_pmap_enter(map, start, prot, object, OFF_TO_IDX(offset), @@ -2288,7 +2295,7 @@ vm_map_submap( if (vm_map_lookup_entry(map, start, &entry)) { vm_map_clip_start(map, entry, start); } else - entry = entry->next; + entry = vm_map_entry_succ(entry); vm_map_clip_end(map, entry, end); @@ -2445,12 +2452,13 @@ again: VM_MAP_RANGE_CHECK(map, start, end); if (!vm_map_lookup_entry(map, start, &entry)) - entry = entry->next; + entry = vm_map_entry_succ(entry); /* * Make a first pass to check for protection violations. */ - for (current = entry; current->start < end; current = current->next) { + for (current = entry; current->start < end; + current = vm_map_entry_succ(current)) { if ((current->eflags & MAP_ENTRY_GUARD) != 0) continue; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) { @@ -2488,7 +2496,8 @@ again: */ rv = KERN_SUCCESS; vm_map_clip_start(map, entry, start); - for (current = entry; current->start < end; current = current->next) { + for (current = entry; current->start < end; + current = vm_map_entry_succ(current)) { vm_map_clip_end(map, current, end); @@ -2546,8 +2555,8 @@ again: * [Note that clipping is not necessary the second time.] */ for (current = entry; current->start < end; - vm_map_try_merge_entries(map, current->prev, current), - current = current->next) { + vm_map_try_merge_entries(map, vm_map_entry_pred(current), current), + current = vm_map_entry_succ(current)) { if (rv != KERN_SUCCESS || (current->eflags & MAP_ENTRY_GUARD) != 0) continue; @@ -2585,7 +2594,7 @@ again: #undef MASK } } - vm_map_try_merge_entries(map, current->prev, current); + vm_map_try_merge_entries(map, vm_map_entry_pred(current), current); vm_map_unlock(map); return (rv); } @@ -2648,7 +2657,7 @@ vm_map_madvise( if (modify_map) vm_map_clip_start(map, entry, start); } else { - entry = entry->next; + entry = vm_map_entry_succ(entry); } if (modify_map) { @@ -2659,7 +2668,7 @@ vm_map_madvise( * limited to the specified address range. */ for (current = entry; current->start < end; - current = current->next) { + current = vm_map_entry_succ(current)) { if (current->eflags & MAP_ENTRY_IS_SUB_MAP) continue; @@ -2690,9 +2699,11 @@ vm_map_madvise( default: break; } - vm_map_try_merge_entries(map, current->prev, current); + vm_map_try_merge_entries(map, + vm_map_entry_pred(current), current); } - vm_map_try_merge_entries(map, current->prev, current); + vm_map_try_merge_entries(map, vm_map_entry_pred(current), + current); vm_map_unlock(map); } else { vm_pindex_t pstart, pend; @@ -2705,7 +2716,7 @@ vm_map_madvise( * the vm_object pindex and count. */ for (current = entry; current->start < end; - current = current->next) { + current = vm_map_entry_succ(current)) { vm_offset_t useEnd, useStart; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) @@ -2812,16 +2823,16 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off entry = temp_entry; vm_map_clip_start(map, entry, start); } else - entry = temp_entry->next; + entry = vm_map_entry_succ(temp_entry); while (entry->start < end) { vm_map_clip_end(map, entry, end); if ((entry->eflags & MAP_ENTRY_GUARD) == 0 || new_inheritance != VM_INHERIT_ZERO) entry->inheritance = new_inheritance; - vm_map_try_merge_entries(map, entry->prev, entry); - entry = entry->next; + vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); + entry = vm_map_entry_succ(entry); } - vm_map_try_merge_entries(map, entry->prev, entry); + vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); vm_map_unlock(map); return (KERN_SUCCESS); } @@ -2870,7 +2881,7 @@ vm_map_entry_in_transition(vm_map_t map, vm_offset_t i *io_end = start; return (NULL); } - entry = entry->next; + entry = vm_map_entry_succ(entry); } return (entry); } @@ -2896,7 +2907,7 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs VM_MAP_RANGE_CHECK(map, start, end); if (!vm_map_lookup_entry(map, start, &first_entry)) { if (holes_ok) - first_entry = first_entry->next; + first_entry = vm_map_entry_succ(first_entry); else { vm_map_unlock(map); return (KERN_INVALID_ADDRESS); @@ -2940,7 +2951,8 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs * If holes_ok, skip this check. */ if (!holes_ok && - (entry->end < end && entry->next->start > entry->end)) { + (entry->end < end && + vm_map_entry_succ(entry)->start > entry->end)) { end = entry->end; rv = KERN_INVALID_ADDRESS; break; @@ -2954,15 +2966,16 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs rv = KERN_INVALID_ARGUMENT; break; } - entry = entry->next; + entry = vm_map_entry_succ(entry); } need_wakeup = false; if (first_entry == NULL && !vm_map_lookup_entry(map, start, &first_entry)) { KASSERT(holes_ok, ("vm_map_unwire: lookup failed")); - first_entry = first_entry->next; + first_entry = vm_map_entry_succ(first_entry); } - for (entry = first_entry; entry->start < end; entry = entry->next) { + for (entry = first_entry; entry->start < end; + entry = vm_map_entry_succ(entry)) { /* * If holes_ok was specified, an empty * space in the unwired region could have been mapped @@ -2998,9 +3011,9 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; need_wakeup = true; } - vm_map_try_merge_entries(map, entry->prev, entry); + vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); } - vm_map_try_merge_entries(map, entry->prev, entry); + vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); vm_map_unlock(map); if (need_wakeup) vm_map_wakeup(map); @@ -3106,7 +3119,7 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm VM_MAP_RANGE_CHECK(map, start, end); if (!vm_map_lookup_entry(map, start, &first_entry)) { if (holes_ok) - first_entry = first_entry->next; + first_entry = vm_map_entry_succ(first_entry); else return (KERN_INVALID_ADDRESS); } @@ -3210,7 +3223,7 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm faddr < entry->end) vm_map_wire_entry_failure(map, entry, faddr); - entry = entry->next; + entry = vm_map_entry_succ(entry); } } if (rv != KERN_SUCCESS) { @@ -3229,12 +3242,13 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm * If holes_ok was specified, skip this check. */ if (!holes_ok && - entry->end < end && entry->next->start > entry->end) { + entry->end < end && + vm_map_entry_succ(entry)->start > entry->end) { end = entry->end; rv = KERN_INVALID_ADDRESS; goto done; } - entry = entry->next; + entry = vm_map_entry_succ(entry); } rv = KERN_SUCCESS; done: @@ -3242,9 +3256,10 @@ done: if (first_entry == NULL && !vm_map_lookup_entry(map, start, &first_entry)) { KASSERT(holes_ok, ("vm_map_wire: lookup failed")); - first_entry = first_entry->next; + first_entry = vm_map_entry_succ(first_entry); } - for (entry = first_entry; entry->start < end; entry = entry->next) { + for (entry = first_entry; entry->start < end; + entry = vm_map_entry_succ(entry)) { /* * If holes_ok was specified, an empty * space in the unwired region could have been mapped @@ -3297,9 +3312,9 @@ done: entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; need_wakeup = true; } - vm_map_try_merge_entries(map, entry->prev, entry); + vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); } - vm_map_try_merge_entries(map, entry->prev, entry); + vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); if (need_wakeup) vm_map_wakeup(map); return (rv); @@ -3349,13 +3364,14 @@ vm_map_sync( /* * Make a first pass to check for user-wired memory and holes. */ - for (current = entry; current->start < end; current = current->next) { + for (current = entry; current->start < end; + current = vm_map_entry_succ(current)) { if (invalidate && (current->eflags & MAP_ENTRY_USER_WIRED)) { vm_map_unlock_read(map); return (KERN_INVALID_ARGUMENT); } if (end > current->end && - current->end != current->next->start) { + current->end != vm_map_entry_succ(current)->start) { vm_map_unlock_read(map); return (KERN_INVALID_ADDRESS); } @@ -3399,7 +3415,7 @@ vm_map_sync( vm_map_lock_read(map); if (last_timestamp == map->timestamp || !vm_map_lookup_entry(map, start, ¤t)) - current = current->next; + current = vm_map_entry_succ(current); } vm_map_unlock_read(map); @@ -3517,7 +3533,7 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry if (map->system_map) vm_map_entry_deallocate(entry, TRUE); else { - entry->next = curthread->td_map_def_user; + entry->defer_next = curthread->td_map_def_user; curthread->td_map_def_user = entry; } } @@ -3542,7 +3558,7 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs * Find the start of the region, and clip it */ if (!vm_map_lookup_entry(map, start, &first_entry)) - entry = first_entry->next; + entry = vm_map_entry_succ(first_entry); else { entry = first_entry; vm_map_clip_start(map, entry, start); @@ -3580,7 +3596,7 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs */ if (!vm_map_lookup_entry(map, saved_start, &tmp_entry)) - entry = tmp_entry->next; + entry = vm_map_entry_succ(tmp_entry); else { entry = tmp_entry; vm_map_clip_start(map, entry, @@ -3591,7 +3607,7 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs } vm_map_clip_end(map, entry, end); - next = entry->next; + next = vm_map_entry_succ(entry); /* * Unwire before removing addresses from the pmap; otherwise, @@ -3680,7 +3696,7 @@ vm_map_check_protection(vm_map_t map, vm_offset_t star return (FALSE); /* go to next entry */ start = entry->end; - entry = entry->next; + entry = vm_map_entry_succ(entry); } return (TRUE); } @@ -3789,7 +3805,8 @@ vm_map_copy_entry( fake_entry->object.vm_object = src_object; fake_entry->start = src_entry->start; fake_entry->end = src_entry->end; - fake_entry->next = curthread->td_map_def_user; + fake_entry->defer_next = + curthread->td_map_def_user; curthread->td_map_def_user = fake_entry; } @@ -4049,7 +4066,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c break; } - old_entry = old_entry->next; + old_entry = vm_map_entry_succ(old_entry); } /* * Use inlined vm_map_unlock() to postpone handling the deferred @@ -4136,7 +4153,7 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, /* * If we can't accommodate max_ssize in the current mapping, no go. */ - if (prev_entry->next->start < addrbos + max_ssize) + if (vm_map_entry_succ(prev_entry)->start < addrbos + max_ssize) return (KERN_NO_SPACE); /* @@ -4163,7 +4180,7 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, rv = vm_map_insert(map, NULL, 0, bot, top, prot, max, cow); if (rv != KERN_SUCCESS) return (rv); - new_entry = prev_entry->next; + new_entry = vm_map_entry_succ(prev_entry); KASSERT(new_entry->end == top || new_entry->start == bot, ("Bad entry start/end for new stack entry")); KASSERT((orient & MAP_STACK_GROWS_DOWN) == 0 || @@ -4185,9 +4202,9 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, * stack_guard_page for vm_map_growstack(). */ if (orient == MAP_STACK_GROWS_DOWN) - new_entry->prev->next_read = sgp; + vm_map_entry_pred(new_entry)->next_read = sgp; else - new_entry->next->next_read = sgp; + vm_map_entry_succ(new_entry)->next_read = sgp; } else { (void)vm_map_delete(map, bot, top); } @@ -4241,14 +4258,14 @@ retry: if ((gap_entry->eflags & MAP_ENTRY_GUARD) == 0) return (KERN_SUCCESS); if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_DN) != 0) { - stack_entry = gap_entry->next; + stack_entry = vm_map_entry_succ(gap_entry); if ((stack_entry->eflags & MAP_ENTRY_GROWS_DOWN) == 0 || stack_entry->start != gap_entry->end) return (KERN_FAILURE); grow_amount = round_page(stack_entry->start - addr); grow_down = true; } else if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_UP) != 0) { - stack_entry = gap_entry->prev; + stack_entry = vm_map_entry_pred(gap_entry); if ((stack_entry->eflags & MAP_ENTRY_GROWS_UP) == 0 || stack_entry->end != gap_entry->start) return (KERN_FAILURE); @@ -4826,9 +4843,10 @@ _vm_map_assert_consistent(vm_map_t map, int check) KASSERT(entry->start < entry->end, ("map %p start = %jx, end = %jx", map, (uintmax_t)entry->start, (uintmax_t)entry->end)); - KASSERT(entry->end <= entry->next->start, + KASSERT(entry->end <= vm_map_entry_succ(entry)->start, ("map %p end = %jx, next->start = %jx", map, - (uintmax_t)entry->end, (uintmax_t)entry->next->start)); + (uintmax_t)entry->end, + (uintmax_t)vm_map_entry_succ(entry)->start)); KASSERT(entry->left == NULL || entry->left->start < entry->start, ("map %p left->start = %jx, start = %jx", map, @@ -4837,14 +4855,16 @@ _vm_map_assert_consistent(vm_map_t map, int check) entry->start < entry->right->start, ("map %p start = %jx, right->start = %jx", map, (uintmax_t)entry->start, (uintmax_t)entry->right->start)); - max_left = vm_map_entry_max_free_left(entry, entry->prev); - max_right = vm_map_entry_max_free_right(entry, entry->next); + max_left = vm_map_entry_max_free_left(entry, + vm_map_entry_pred(entry)); + max_right = vm_map_entry_max_free_right(entry, + vm_map_entry_succ(entry)); KASSERT(entry->max_free == MAX(max_left, max_right), ("map %p max = %jx, max_left = %jx, max_right = %jx", map, (uintmax_t)entry->max_free, (uintmax_t)max_left, (uintmax_t)max_right)); prev = entry; - } + } KASSERT(prev->end <= entry->start, ("map %p prev->end = %jx, start = %jx", map, (uintmax_t)prev->end, (uintmax_t)entry->start)); Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Wed Nov 13 15:31:31 2019 (r354683) +++ head/sys/vm/vm_map.h Wed Nov 13 15:56:07 2019 (r354684) @@ -419,10 +419,25 @@ int vm_map_lookup_locked(vm_map_t *, vm_offset_t, vm_p vm_pindex_t *, vm_prot_t *, boolean_t *); void vm_map_lookup_done (vm_map_t, vm_map_entry_t); boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *); + +static inline vm_map_entry_t +vm_map_entry_succ(vm_map_entry_t entry) +{ + + return (entry->next); +} + +static inline vm_map_entry_t +vm_map_entry_pred(vm_map_entry_t entry) +{ + + return (entry->prev); +} + #define VM_MAP_ENTRY_FOREACH(it, map) \ for ((it) = (map)->header.next; \ (it) != &(map)->header; \ - (it) = (it)->next) + (it) = vm_map_entry_succ(it)) int vm_map_protect (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t); int vm_map_remove (vm_map_t, vm_offset_t, vm_offset_t); void vm_map_try_merge_entries(vm_map_t map, vm_map_entry_t prev, Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Wed Nov 13 15:31:31 2019 (r354683) +++ head/sys/vm/vm_mmap.c Wed Nov 13 15:56:07 2019 (r354684) @@ -581,7 +581,7 @@ kern_munmap(struct thread *td, uintptr_t addr0, size_t pkm.pm_address = (uintptr_t) NULL; if (vm_map_lookup_entry(map, addr, &entry)) { for (; entry->start < addr + size; - entry = entry->next) { + entry = vm_map_entry_succ(entry)) { if (vm_map_check_protection(map, entry->start, entry->end, VM_PROT_EXECUTE) == TRUE) { pkm.pm_address = (uintptr_t) addr; @@ -817,12 +817,15 @@ RestartScan: * up the pages elsewhere. */ lastvecindex = -1; - for (current = entry; current->start < end; current = current->next) { + while (entry->start < end) { /* * check for contiguity */ - if (current->end < end && current->next->start > current->end) { + current = entry; + entry = vm_map_entry_succ(current); + if (current->end < end && + entry->start > current->end) { vm_map_unlock_read(map); return (ENOMEM); } From owner-svn-src-head@freebsd.org Wed Nov 13 16:28:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F38C71B53BB; Wed, 13 Nov 2019 16:28:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Cqn16G1Nz4Dbp; Wed, 13 Nov 2019 16:28:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BADBD1AC02; Wed, 13 Nov 2019 16:28:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADGSrq2076838; Wed, 13 Nov 2019 16:28:53 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADGSrdf076836; Wed, 13 Nov 2019 16:28:53 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911131628.xADGSrdf076836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 13 Nov 2019 16:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354685 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 16:28:54 -0000 Author: glebius Date: Wed Nov 13 16:28:53 2019 New Revision: 354685 URL: https://svnweb.freebsd.org/changeset/base/354685 Log: In if_siocaddmulti() enter VNET. Reported & tested by: garga Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Nov 13 15:56:07 2019 (r354684) +++ head/sys/net/if.c Wed Nov 13 16:28:53 2019 (r354685) @@ -3571,7 +3571,9 @@ if_siocaddmulti(void *arg, int pending) if (pending > 1) if_printf(ifp, "%d SIOCADDMULTI coalesced\n", pending); #endif + CURVNET_SET(ifp->if_vnet); (void )(*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0); + CURVNET_RESTORE(); } /* From owner-svn-src-head@freebsd.org Wed Nov 13 16:46:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5A3B1B59BB; Wed, 13 Nov 2019 16:46:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Cr8w5pGFz4FYb; Wed, 13 Nov 2019 16:46:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 1AB3414CF0; Wed, 13 Nov 2019 16:46:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354661 - head To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head References: <201911122129.xACLTril005968@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <06e18957-6df8-ebe3-49e1-d7ff2d86338a@FreeBSD.org> Date: Wed, 13 Nov 2019 08:46:03 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 16:46:09 -0000 On 11/13/19 5:19 AM, Kyle Evans wrote: > On Tue, Nov 12, 2019 at 3:29 PM John Baldwin wrote: >> >> Author: jhb >> Date: Tue Nov 12 21:29:52 2019 >> New Revision: 354661 >> URL: https://svnweb.freebsd.org/changeset/base/354661 >> >> Log: >> Force MK_CLANG_IS_CC on in XMAKE. >> >> This ensures that a bootstrap clang compiler is always installed as cc >> in WORLDTMP. If it is only installed as 'clang' then /usr/bin/cc is >> used during the build instead of the bootstrap compiler. >> >> Reviewed by: imp >> MFC after: 1 month >> Sponsored by: DARPA >> Differential Revision: https://reviews.freebsd.org/D22332 >> >> Modified: >> head/Makefile.inc1 >> >> Modified: head/Makefile.inc1 >> ============================================================================== >> --- head/Makefile.inc1 Tue Nov 12 21:26:50 2019 (r354660) >> +++ head/Makefile.inc1 Tue Nov 12 21:29:52 2019 (r354661) >> @@ -734,6 +734,7 @@ TMAKE= \ >> # TOOLS_PREFIX set in BMAKE >> XMAKE= ${BMAKE} \ >> TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ >> + MK_CLANG_IS_CC=yes \ >> MK_GDB=no MK_TESTS=no >> >> # kernel-tools stage > > This sounds wrong for any arch not currently supported by in-tree > clang, and CI for those archs have been failing about since here: > https://ci.freebsd.org/tinderbox/ It shouldn't be wrong because during XMAKE, MK_CLANG is only set to yes if MK_CLANG_BOOTSTRAP is set to yes, and MK_CLANG_IS_CC only does anything in the clang Makefile which is only recursed into if MK_CLANG is yes. Sigh, I see it now. It's because we _don't_ have MK_GCC_IS_CC but instead check MK_CLANG_IS_CC for "no" in gnu/usr.bin/cc/*/Makefile. I'll come up with a fix. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Nov 13 17:06:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64C7E1B5EED; Wed, 13 Nov 2019 17:06:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Crc324Tcz4GRj; Wed, 13 Nov 2019 17:06:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 266301B31E; Wed, 13 Nov 2019 17:06:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADH6BYK000440; Wed, 13 Nov 2019 17:06:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADH6BZa000439; Wed, 13 Nov 2019 17:06:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911131706.xADH6BZa000439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 13 Nov 2019 17:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354686 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 17:06:11 -0000 Author: jhb Date: Wed Nov 13 17:06:10 2019 New Revision: 354686 URL: https://svnweb.freebsd.org/changeset/base/354686 Log: Add t4_keyctx.c to sys/conf/files for the non-module build. Missed in r354667. Pointy hat to: jhb MFC after: 1 month Sponsored by: Chelsio Communications Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Nov 13 16:28:53 2019 (r354685) +++ head/sys/conf/files Wed Nov 13 17:06:10 2019 (r354686) @@ -1422,6 +1422,8 @@ dev/cxgbe/common/t4_hw.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/common/t4vf_hw.c optional cxgbev pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" +dev/cxgbe/crypto/t4_keyctx.c optional cxgbe pci \ + compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/cudbg/cudbg_common.c optional cxgbe \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/cudbg/cudbg_flash_utils.c optional cxgbe \ From owner-svn-src-head@freebsd.org Wed Nov 13 18:10:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E24AB1B738C; Wed, 13 Nov 2019 18:10:42 +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 47Ct2V5kr3z4KH2; Wed, 13 Nov 2019 18:10:42 +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 A846F1BDF2; Wed, 13 Nov 2019 18:10:42 +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 xADIAgAi035554; Wed, 13 Nov 2019 18:10:42 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADIAgwB035553; Wed, 13 Nov 2019 18:10:42 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911131810.xADIAgwB035553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 13 Nov 2019 18:10:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354688 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 354688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 18:10:42 -0000 Author: brooks Date: Wed Nov 13 18:10:42 2019 New Revision: 354688 URL: https://svnweb.freebsd.org/changeset/base/354688 Log: Fix a typo in the PMAP_PTE_SET_CACHE_BITS macro. The second argument should have been "pa" not "ps". It worked by accident because the argument was always "pa" which was an in-scope local variable. Submitted by: sson Reviewed by: jhb, kevans Obtained from: CheriBSD MFC after: 3 days Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22338 Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Wed Nov 13 17:10:46 2019 (r354687) +++ head/sys/mips/mips/pmap.c Wed Nov 13 18:10:42 2019 (r354688) @@ -319,7 +319,7 @@ pmap_pte_cache_bits(vm_paddr_t pa, vm_page_t m) ma = VM_MEMATTR_UNCACHEABLE; return PTE_C(ma); } -#define PMAP_PTE_SET_CACHE_BITS(pte, ps, m) { \ +#define PMAP_PTE_SET_CACHE_BITS(pte, pa, m) { \ pte &= ~PTE_C_MASK; \ pte |= pmap_pte_cache_bits(pa, m); \ } From owner-svn-src-head@freebsd.org Wed Nov 13 18:21:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB0AA1B760E; Wed, 13 Nov 2019 18:21:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CtGV60Xfz4Klk; Wed, 13 Nov 2019 18:21:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B11991C0F5; Wed, 13 Nov 2019 18:21:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADIL61N044327; Wed, 13 Nov 2019 18:21:06 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADIL66D044326; Wed, 13 Nov 2019 18:21:06 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911131821.xADIL66D044326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 13 Nov 2019 18:21:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354689 - head/lib/libc/secure X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/secure X-SVN-Commit-Revision: 354689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 18:21:07 -0000 Author: kevans Date: Wed Nov 13 18:21:06 2019 New Revision: 354689 URL: https://svnweb.freebsd.org/changeset/base/354689 Log: ssp: further refine the conditional used for constructor priority __has_attribute(__constructor__) is a better test for clang than defined(__clang__). Switch to it instead. While we're already here and touching it, pfg@ nailed down when GCC actually introduced the priority argument -- 4.3. Use that instead of our hammer-guess of GCC >= 5 for the sake of correctness. Modified: head/lib/libc/secure/stack_protector.c Modified: head/lib/libc/secure/stack_protector.c ============================================================================== --- head/lib/libc/secure/stack_protector.c Wed Nov 13 18:10:42 2019 (r354688) +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 18:21:06 2019 (r354689) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); * * This conditional should be removed when GCC 4.2 is removed. */ -#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) +#if __has_attribute(__constructor__) || __GNUC_PREREQ__(4, 3) #define _GUARD_SETUP_CTOR_ATTR \ __attribute__((__constructor__ (200), __used__)); #else From owner-svn-src-head@freebsd.org Wed Nov 13 18:23:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B79BD1B781D for ; Wed, 13 Nov 2019 18:23:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CtKX1kfCz4LBC for ; Wed, 13 Nov 2019 18:23:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72e.google.com with SMTP id 71so2638626qkl.0 for ; Wed, 13 Nov 2019 10:23:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dm8kL+H5vl0y2b5tQO9chVNHCLs5qUgK5cXtPoyqW58=; b=EXQofeTMDXmUbsPknkwipu+NEPJhqn7ngQ0lteB/dTgzaA9HgVckNtEvBtAtVC8Qds 0tn02uhwAfM4ewP19wiTCnYfOyR0OYlI0G4J+TRsVVL20gyLim4ZL4zVu2BSPxaEC+Ka cmYumMB0QPTRfruhVIkkuywRIpuI/bLUM+DZBSIe9S9/9h6y8qFgRKTE3RuVRNOVOafX Z7m9rvBTZ3qVgh15f+MRAehhVw/okiZJJwXqti5jUNz6ZIuwgn6rVWrp1+5S6T+plGVP KOUpdQO5UWybWa9AQNLrDyvz5Pv+8vDdRGBE3gHM3y+fiHanwmVKSrgRmfh28h363fN0 eO0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dm8kL+H5vl0y2b5tQO9chVNHCLs5qUgK5cXtPoyqW58=; b=nih7fhYZ+Pp2iONM82w6ZMvXOP0ZuF5O8e1eXiBdDlXVOEIIUYdBfRjMwT+g6xwXUl psa5WXdGuTXhroItN2YN+VjLpfq1E9NCprVQQ2imZ5qmgknqnMenWps/Y8PHjMvqX0gz GR6LtdCtFZRDHB+DQnavWdB+qTGX9P4Pm8ScIcOZz5ByEFX/6g9BuOsbjerW4POHf7dd xsAmp8MY3eoJHvK+PdpIFF+BD0tMXCGBH/5CAl+bxfNf9LFxb93GCwVXoF/X3jCaROfh iW6ToZ0mbS99TW1JLtj052Scm9KsQQGeMbhlDSHJGsUWzI6SeTzSd1r8bmu9zppOJ5Cq Mu8A== X-Gm-Message-State: APjAAAXl97KnktFBagJ8SmZDSG8QwfT58H4GSgvLnt+fN+jaM9ov+qXX /sxFctxkefitF7qju5Taxz+uI5Is/vNwe4n1G2UCgQ== X-Google-Smtp-Source: APXvYqycK4sfYow0nwiaMjjGICTdQ63szDb7HqsvyyzfHN0sPWbbLNPCKOsLlOPuTA/4mh5ow6SpvpK4GNYcIkH4LnM= X-Received: by 2002:a05:620a:200e:: with SMTP id c14mr1677901qka.380.1573669422594; Wed, 13 Nov 2019 10:23:42 -0800 (PST) MIME-Version: 1.0 References: <201911130300.xAD30WUE099996@repo.freebsd.org> <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Wed, 13 Nov 2019 11:23:31 -0700 Message-ID: Subject: Re: svn commit: r354672 - head/lib/libc/secure To: Pedro Giffuni Cc: Kyle Evans , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47CtKX1kfCz4LBC X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=EXQofeTM; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72e) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.73 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[e.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.73)[ip: (-9.29), ipnet: 2607:f8b0::/32(-2.33), asn: 15169(-1.99), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 18:23:45 -0000 On Wed, Nov 13, 2019 at 8:52 AM Pedro Giffuni wrote: > Hi; > On 12/11/2019 23:44, Warner Losh wrote: > > > > On Tue, Nov 12, 2019 at 9:20 PM Kyle Evans wrote: > >> >> >> On Tue, Nov 12, 2019, 22:04 Pedro Giffuni wrote: >> >>> >>> On 12/11/2019 22:00, Kyle Evans wrote: >>> >>> Author: kevans >>> Date: Wed Nov 13 03:00:32 2019 >>> New Revision: 354672 >>> URL: https://svnweb.freebsd.org/changeset/base/354672 >>> >>> Log: >>> ssp: rework the logic to use priority=200 on clang builds >>> >>> The preproc logic was added at the last minute to appease GCC 4.2, and >>> kevans@ did clearly not go back and double-check that the logic worked out >>> for clang builds to use the new variant. >>> >>> It turns out that clang defines __GNUC__ == 4. Flip it around and check >>> __clang__ as well, leaving a note to remove it later. >>> >>> >>> clang reports itself as GCC 4.2, the priority argument was introduced in >>> GCC 4.3. >>> >>> Reported by: cem >>> >>> Modified: >>> head/lib/libc/secure/stack_protector.c >>> >>> Modified: head/lib/libc/secure/stack_protector.c >>> ============================================================================== >>> --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r354671) >>> +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r354672) >>> @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); >>> * they're either not usually statically linked or they simply don't do things >>> * in constructors that would be adversely affected by their positioning with >>> * respect to this initialization. >>> + * >>> + * This conditional should be removed when GCC 4.2 is removed. >>> */ >>> -#if defined(__GNUC__) && __GNUC__ <= 4 >>> -#define _GUARD_SETUP_CTOR_ATTR \ >>> - __attribute__((__constructor__, __used__)); >>> -#else >>> +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) >>> #define _GUARD_SETUP_CTOR_ATTR \ >>> __attribute__((__constructor__ (200), __used__)); >>> +#else >>> +#define _GUARD_SETUP_CTOR_ATTR \ >>> + __attribute__((__constructor__, __used__)); >>> #endif >>> >>> extern int __sysctl(const int *name, u_int namelen, void *oldp, >>> >>> Please fix properly. Assuming clang always supported it, something like: >>> >>> #if __GNUC_PREREQ__(4, 3) || __has_attribute(__constructor__) >>> >>> should work >>> >>> Cheers, >>> >> >> I considered something of this sort, but searching for information on the >> priority argument in the first place was annoying enough that I had too >> much search-fatigue to figure out when GCC actually corrected this, thus >> assuming that GCC5 (which seemed to be an all-around good release if memory >> serves) and later (since I confirmed GCC6) was sufficient. >> >> I'll fix it in the morning (~8 hours) if I receive no further objections >> to address. >> > > Soon enough this can be removed entirely... Getting it pedantically right > in the mean time has little value. We don't really support gcc5 at the > moment. gcc6 and later have good support, but anything new between 4.3 and > 6.0 likely is poorly tagged... > > > Well, tracking attributes on GCC versions is not easy but I did spend a > good amount of time getting the attributes right on cdefs.h and while I > lost the battle to get support for older GCC versions deprecated, getting > the attributes properly defined in the GCC 4.2 vs clang vicinity is > particularly important. > Not really. We only support 4.2.1 + freebsd hacks and then 6.. Further refining stuff is useless. Refining 4.3 vs 6.0 buys us nothing and distracts our limited resources getting correct something we are definitely removing from the tree in a couple of months. Going back and refining it gives us no practical benefit. While I don't object to the change, per se, I don't view it as required given our future plans. We should scrub cdefs.h. We've needed to for a while... > I particularly dislike the idea of leaving notes of stuff that can be > removed when an existing compiler is gone. In this case, we can fix this > without adding more lines of code, and that also helps in case the code is > MFCd. > > Now ... if you want to be pedantic: this code doesn't handle the case for > non-GCC based compilers, and it probably could be done more generic and > clean in cdefs.h where it can be reused. But I am not asking for that ;). > I guess I disagree here. The current code is adequate and can be MFC'd. It's not as perfect as it could be, but it's not wrong enough to fuss with.... If Kyle wants to, great, I'm not standing in the way, but I want to send the clear message that we don't need to get gcc 4.2 era stuff perfect because such distinctions are currently muddy at best. We won't work with a stock 4.2 compiler, and we already use 4.2 as a proxy for our current gcc compiler, not a perfect thing today anyway. Spending time on it doesn't give good value for the time spent on it, especially if we spend that time on other things that give better ROI. Warner Warner From owner-svn-src-head@freebsd.org Wed Nov 13 18:35:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25A501B7EBA; Wed, 13 Nov 2019 18:35:16 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CtZr0BDPz4Mjj; Wed, 13 Nov 2019 18:35:16 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id CFB211596F; Wed, 13 Nov 2019 18:35:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f179.google.com with SMTP id t8so3679153qtc.6; Wed, 13 Nov 2019 10:35:15 -0800 (PST) X-Gm-Message-State: APjAAAVgkByIewFUy5lhvnNA8YXnN6Z9U5Uf42rlXHmcSyW5XTygMcf5 KlB59BXMcIR9lWXoWrhUQW+MeQOe9OVUXkh7eSA= X-Google-Smtp-Source: APXvYqy4U/UuiWLb2msaDZCWtJrPtDtyDrXd1i/u70ttB9U8dUThfsD17rTSmiEL6SecajWo40MlnTzu6ue13NGvHlg= X-Received: by 2002:ac8:41cc:: with SMTP id o12mr4117232qtm.310.1573670115099; Wed, 13 Nov 2019 10:35:15 -0800 (PST) MIME-Version: 1.0 References: <201911130300.xAD30WUE099996@repo.freebsd.org> <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> In-Reply-To: From: Kyle Evans Date: Wed, 13 Nov 2019 12:35:03 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354672 - head/lib/libc/secure To: Warner Losh Cc: Pedro Giffuni , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 18:35:16 -0000 On Wed, Nov 13, 2019 at 12:23 PM Warner Losh wrote: > > > > On Wed, Nov 13, 2019 at 8:52 AM Pedro Giffuni wrote: >> >> Hi; >> >> On 12/11/2019 23:44, Warner Losh wrote: >> >> >> >> On Tue, Nov 12, 2019 at 9:20 PM Kyle Evans wrote: >>> >>> >>> >>> On Tue, Nov 12, 2019, 22:04 Pedro Giffuni wrote: >>>> >>>> >>>> On 12/11/2019 22:00, Kyle Evans wrote: >>>> >>>> Author: kevans >>>> Date: Wed Nov 13 03:00:32 2019 >>>> New Revision: 354672 >>>> URL: https://svnweb.freebsd.org/changeset/base/354672 >>>> >>>> Log: >>>> ssp: rework the logic to use priority=3D200 on clang builds >>>> >>>> The preproc logic was added at the last minute to appease GCC 4.2, a= nd >>>> kevans@ did clearly not go back and double-check that the logic work= ed out >>>> for clang builds to use the new variant. >>>> >>>> It turns out that clang defines __GNUC__ =3D=3D 4. Flip it around an= d check >>>> __clang__ as well, leaving a note to remove it later. >>>> >>>> >>>> clang reports itself as GCC 4.2, the priority argument was introduced = in GCC 4.3. >>>> >>>> Reported by: cem >>>> >>>> Modified: >>>> head/lib/libc/secure/stack_protector.c >>>> >>>> Modified: head/lib/libc/secure/stack_protector.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r= 354671) >>>> +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r= 354672) >>>> @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); >>>> * they're either not usually statically linked or they simply don't = do things >>>> * in constructors that would be adversely affected by their position= ing with >>>> * respect to this initialization. >>>> + * >>>> + * This conditional should be removed when GCC 4.2 is removed. >>>> */ >>>> -#if defined(__GNUC__) && __GNUC__ <=3D 4 >>>> -#define _GUARD_SETUP_CTOR_ATTR \ >>>> - __attribute__((__constructor__, __used__)); >>>> -#else >>>> +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) >>>> #define _GUARD_SETUP_CTOR_ATTR \ >>>> __attribute__((__constructor__ (200), __used__)); >>>> +#else >>>> +#define _GUARD_SETUP_CTOR_ATTR \ >>>> + __attribute__((__constructor__, __used__)); >>>> #endif >>>> >>>> extern int __sysctl(const int *name, u_int namelen, void *oldp, >>>> >>>> Please fix properly. Assuming clang always supported it, something lik= e: >>>> >>>> #if __GNUC_PREREQ__(4, 3) || __has_attribute(__constructor__) >>>> >>>> should work >>>> >>>> Cheers, >>> >>> >>> I considered something of this sort, but searching for information on t= he priority argument in the first place was annoying enough that I had too = much search-fatigue to figure out when GCC actually corrected this, thus as= suming that GCC5 (which seemed to be an all-around good release if memory s= erves) and later (since I confirmed GCC6) was sufficient. >>> >>> I'll fix it in the morning (~8 hours) if I receive no further objection= s to address. >> >> >> Soon enough this can be removed entirely... Getting it pedantically righ= t in the mean time has little value. We don't really support gcc5 at the mo= ment. gcc6 and later have good support, but anything new between 4.3 and 6.= 0 likely is poorly tagged... >> >> >> Well, tracking attributes on GCC versions is not easy but I did spend a = good amount of time getting the attributes right on cdefs.h and while I los= t the battle to get support for older GCC versions deprecated, getting the = attributes properly defined in the GCC 4.2 vs clang vicinity is particularl= y important. > > Not really. We only support 4.2.1 + freebsd hacks and then 6..= Further refining stuff is useless. Refining 4.3 vs 6.0 buys us nothing and= distracts our limited resources getting correct something we are definitel= y removing from the tree in a couple of months. Going back and refining it = gives us no practical benefit. While I don't object to the change, per se, = I don't view it as required given our future plans. > > We should scrub cdefs.h. We've needed to for a while... >> >> I particularly dislike the idea of leaving notes of stuff that can be re= moved when an existing compiler is gone. In this case, we can fix this with= out adding more lines of code, and that also helps in case the code is MFCd= . >> >> Now ... if you want to be pedantic: this code doesn't handle the case fo= r non-GCC based compilers, and it probably could be done more generic and c= lean in cdefs.h where it can be reused. But I am not asking for that ;). > > I guess I disagree here. The current code is adequate and can be MFC'd. = It's not as perfect as it could be, but it's not wrong enough to fuss with.= ... If Kyle wants to, great, I'm not standing in the way, but I want to sen= d the clear message that we don't need to get gcc 4.2 era stuff perfect bec= ause such distinctions are currently muddy at best. We won't work with a st= ock 4.2 compiler, and we already use 4.2 as a proxy for our current gcc com= piler, not a perfect thing today anyway. Spending time on it doesn't give g= ood value for the time spent on it, especially if we spend that time on oth= er things that give better ROI. > I went ahead and fixed it because it was already agreed that __has_attribute is a better test for clang than defined(__clang__), so I might as well get the version correct since I'm already touching the line and writing a commit message for it. I do still think it should unifdef'd when GCC 4.2 goes away, so the note still reflects my wishes. Given that this is a libc/*.c file, we can handle any of the edge cases for non-clang/newer GCC compilers as they crop up, if they crop up. We don't seem to put much effort (that I've noticed) into making sure that libc can be compiled with other compilers than those noted, but we can always make exception if someone comes forward with a need for it. From owner-svn-src-head@freebsd.org Wed Nov 13 19:23:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06B1E1B915C; Wed, 13 Nov 2019 19:23:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Cvdy042Mz4Xwr; Wed, 13 Nov 2019 19:23:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.2] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id 022EB15F2E; Wed, 13 Nov 2019 19:23:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r354672 - head/lib/libc/secure To: Warner Losh Cc: Kyle Evans , src-committers , svn-src-all , svn-src-head References: <201911130300.xAD30WUE099996@repo.freebsd.org> <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: <25c3bb4a-971f-be14-4192-409ec6dc019b@FreeBSD.org> Date: Wed, 13 Nov 2019 14:22:59 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 19:23:02 -0000 On 13/11/2019 13:23, Warner Losh wrote: > > > On Wed, Nov 13, 2019 at 8:52 AM Pedro Giffuni > wrote: > > Hi; > > On 12/11/2019 23:44, Warner Losh wrote: >> >> >> On Tue, Nov 12, 2019 at 9:20 PM Kyle Evans > > wrote: >> >> >> >> On Tue, Nov 12, 2019, 22:04 Pedro Giffuni > > wrote: >> >> >> On 12/11/2019 22:00, Kyle Evans wrote: >>> Author: kevans >>> Date: Wed Nov 13 03:00:32 2019 >>> New Revision: 354672 >>> URL:https://svnweb.freebsd.org/changeset/base/354672 >>> >>> Log: >>> ssp: rework the logic to use priority=200 on clang builds >>> >>> The preproc logic was added at the last minute to appease GCC 4.2, and >>> kevans@ did clearly not go back and double-check that the logic worked out >>> for clang builds to use the new variant. >>> >>> It turns out that clang defines __GNUC__ == 4. Flip it around and check >>> __clang__ as well, leaving a note to remove it later. >>> >> clang reports itself as GCC 4.2, the priority argument >> was introduced in GCC 4.3. >>> Reported by: cem >>> >>> Modified: >>> head/lib/libc/secure/stack_protector.c >>> >>> Modified: head/lib/libc/secure/stack_protector.c >>> ============================================================================== >>> --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r354671) >>> +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r354672) >>> @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); >>> * they're either not usually statically linked or they simply don't do things >>> * in constructors that would be adversely affected by their positioning with >>> * respect to this initialization. >>> + * >>> + * This conditional should be removed when GCC 4.2 is removed. >>> */ >>> -#if defined(__GNUC__) && __GNUC__ <= 4 >>> -#define _GUARD_SETUP_CTOR_ATTR \ >>> - __attribute__((__constructor__, __used__)); >>> -#else >>> +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) >>> #define _GUARD_SETUP_CTOR_ATTR \ >>> __attribute__((__constructor__ (200), __used__)); >>> +#else >>> +#define _GUARD_SETUP_CTOR_ATTR \ >>> + __attribute__((__constructor__, __used__)); >>> #endif >>> >>> extern int __sysctl(const int *name, u_int namelen, void *oldp, >> >> Please fix properly. Assuming clang always supported it, >> something like: >> >> #if __GNUC_PREREQ__(4, 3) || __has_attribute(__constructor__) >> >> should work >> >> Cheers, >> >> >> I considered something of this sort, but searching for >> information on the priority argument in the first place was >> annoying enough that I had too much search-fatigue to figure >> out when GCC actually corrected this, thus assuming that GCC5 >> (which seemed to be an all-around good release if memory >> serves) and later (since I confirmed GCC6) was sufficient. >> >> I'll fix it in the morning (~8 hours) if I receive no further >> objections to address. >> >> >> Soon enough this can be removed entirely... Getting it >> pedantically right in the mean time has little value. We don't >> really support gcc5 at the moment. gcc6 and later have good >> support, but anything new between 4.3 and 6.0 likely is poorly >> tagged... >> > > Well, tracking attributes on GCC versions is not easy but I did > spend a good amount of time getting the attributes right on > cdefs.h and while I lost the battle to get support for older GCC > versions deprecated, getting the attributes properly defined in > the GCC 4.2 vs clang vicinity is particularly important. > > Not really. We only support 4.2.1 + freebsd hacks and then > 6.. Further refining stuff is useless. Some people (Panzura I recall) were actually building FreeBSD with external compilers including GCC 4.2.1 without FreeBSD hacks. I suspect we could build fine with GCC 4.3 and 5.x, although I admit I wouldn't see much sense in it. > Refining 4.3 vs 6.0 buys us nothing and distracts our limited > resources getting correct something we are definitely removing from > the tree in a couple of months. Going back and refining it gives us no > practical benefit. While I don't object to the change, per se, I don't > view it as required given our future plans. > It is not terribly difficult: it is just a matter of getting one number right. > We should scrub cdefs.h. We've needed to for a while... cdefs.h is handy to sort things out in the inprobable case a new compiler arrives to the scene. I fully agree  that it can be cleaned though: feel free to start with the linux intel C compiler support and follow with lint. > I particularly dislike the idea of leaving notes of stuff that can > be removed when an existing compiler is gone. In this case, we can > fix this without adding more lines of code, and that also helps in > case the code is MFCd. > > Now ... if you want to be pedantic: this code doesn't handle the > case for non-GCC based compilers, and it probably could be done > more generic and clean in cdefs.h where it can be reused. But I am > not asking for that ;). > > I guess I disagree here. (...) No problem with disagreeing :). Cheers, Pedro. > The current code is adequate and can be MFC'd.  It's not as perfect as > it could be, but it's not wrong enough to fuss with.... If Kyle wants > to, great, I'm not standing in the way, but I want to send the clear > message that we don't need to get gcc 4.2 era stuff perfect because > such distinctions are currently muddy at best. We won't work with a > stock 4.2 compiler, and we already use 4.2 as a proxy for our current > gcc compiler, not a perfect thing today anyway. Spending time on it > doesn't give good value for the time spent on it, especially if we > spend that time on other things that give better ROI. > > Warner > > Warner From owner-svn-src-head@freebsd.org Wed Nov 13 20:27:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FE401BAC1B; Wed, 13 Nov 2019 20:27:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Cx4V6Jvbz4qv9; Wed, 13 Nov 2019 20:27:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC2C61D6C5; Wed, 13 Nov 2019 20:27:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADKRcRH017305; Wed, 13 Nov 2019 20:27:38 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADKRcnl017303; Wed, 13 Nov 2019 20:27:38 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201911132027.xADKRcnl017303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 13 Nov 2019 20:27:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354690 - in head/libexec/rc: . rc.d X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/libexec/rc: . rc.d X-SVN-Commit-Revision: 354690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 20:27:39 -0000 Author: trasz Date: Wed Nov 13 20:27:38 2019 New Revision: 354690 URL: https://svnweb.freebsd.org/changeset/base/354690 Log: Add 'linux_mounts_enable' rc.conf(5) variable, to make it possible to disable mounting Linux-specific filesystems under /compat/linux when 'linux_enable' is set to YES. Reviewed by: netchild, ian (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22320 Modified: head/libexec/rc/rc.conf head/libexec/rc/rc.d/linux Modified: head/libexec/rc/rc.conf ============================================================================== --- head/libexec/rc/rc.conf Wed Nov 13 18:21:06 2019 (r354689) +++ head/libexec/rc/rc.conf Wed Nov 13 20:27:38 2019 (r354690) @@ -640,6 +640,8 @@ firstboot_sentinel="/firstboot" # Scripts with "firstb # the file can be deleted after the boot completes. sysvipc_enable="NO" # Load System V IPC primitives at startup (or NO). linux_enable="NO" # Linux binary compatibility loaded at startup (or NO). +linux_mounts_enable="YES" # If linux_enable is set to YES, mount Linux-specific + # filesystems at startup. clear_tmp_enable="NO" # Clear /tmp at startup. clear_tmp_X="YES" # Clear and recreate X11-related directories in /tmp ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks Modified: head/libexec/rc/rc.d/linux ============================================================================== --- head/libexec/rc/rc.d/linux Wed Nov 13 18:21:06 2019 (r354689) +++ head/libexec/rc/rc.d/linux Wed Nov 13 20:27:38 2019 (r354690) @@ -46,12 +46,14 @@ linux_start() sysctl kern.elf32.fallback_brand=3 > /dev/null fi - _emul_path="/compat/linux" - mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" - mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" - mount -o nocover -t devfs devfs "${_emul_path}/dev" - mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" - mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" + if checkyesno linux_mounts_enable; then + _emul_path="/compat/linux" + mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" + mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" + mount -o nocover -t devfs devfs "${_emul_path}/dev" + mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" + mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" + fi } load_rc_config $name From owner-svn-src-head@freebsd.org Wed Nov 13 20:32:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF3B71BAE50; Wed, 13 Nov 2019 20:32:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CxB052QXz4sMs; Wed, 13 Nov 2019 20:32:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FE4D1D87F; Wed, 13 Nov 2019 20:32:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADKWOtn023228; Wed, 13 Nov 2019 20:32:24 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADKWO2I023226; Wed, 13 Nov 2019 20:32:24 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201911132032.xADKWO2I023226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 13 Nov 2019 20:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354691 - in head/share/man: man4 man5 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/share/man: man4 man5 X-SVN-Commit-Revision: 354691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 20:32:24 -0000 Author: trasz Date: Wed Nov 13 20:32:23 2019 New Revision: 354691 URL: https://svnweb.freebsd.org/changeset/base/354691 Log: Improve Linuxulator man pages to better reflect the current state, and add some missing Xrs. Reviewed by: brueffer, emaste (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22277 Modified: head/share/man/man4/linux.4 head/share/man/man5/linprocfs.5 head/share/man/man5/linsysfs.5 Modified: head/share/man/man4/linux.4 ============================================================================== --- head/share/man/man4/linux.4 Wed Nov 13 20:27:38 2019 (r354690) +++ head/share/man/man4/linux.4 Wed Nov 13 20:32:23 2019 (r354691) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 1, 2017 +.Dd November 13, 2019 .Dt LINUX 4 .Os .Sh NAME @@ -52,10 +52,10 @@ linux_load="YES" .Sh DESCRIPTION The .Nm -module provides limited -Linux ABI (application binary interface) compatibility -for userland applications. -The module provides the following significant facilities: +module provides limited Linux ABI (application binary interface) compatibility, +making it possible to run many unmodified Linux applications and libraries +without the need for virtualization or emulation. +Some of the facilities provided are: .Bl -bullet .It An image activator @@ -66,76 +66,61 @@ executable images Special signal handling for activated images .It Linux to native system call translation +.It +Linux-specific system calls .El .Pp -It is important to note that the Linux ABI support -it not provided through an emulator. -Rather, a true (albeit limited) ABI implementation is provided. +Note that dynamically linked Linux executables +will require a suitable environment in +.Pa /compat/linux . +This includes native Linux shared libraries, and Linux-specific virtual +filesystems. +To set it up, install the +.Pa emulators/linux_base-c7 +port or the linux_base-c7 +package, and add the following line to the +.Xr rc.conf 5 +file: .Pp -The following +.Dl linux_enable="YES" +.Pp +To avoid mounting Linux-specific filesystems at startup, also add the following +line: +.Pp +.Dl linux_mounts_enable="NO" +.Sh SYSCTL VARIABLES +The following variables are available as both .Xr sysctl 8 -tunable variables are available: -.Bl -tag -width compat.linux.oss_version -.It compat.linux.osname +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va compat.linux.osname Linux kernel operating system name. -.It compat.linux.osrelease +.It Va compat.linux.osrelease Linux kernel operating system release. Changing this to something else is discouraged on non-development systems, because it may change the way Linux programs work. Recent versions of GNU libc are known to use different syscalls depending on the value of this sysctl. -.It compat.linux.oss_version +.It Va compat.linux.oss_version Linux Open Sound System version. -.El -.Pp -The -.Nm -module can be linked into the kernel statically with the -.Dv COMPAT_LINUX -kernel configuration option -or loaded as required. -The following command will load the module -if it is neither linked into the kernel -nor already loaded as a module: -.Bd -literal -offset indent -if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then - kldload linux > /dev/null 2>&1 -fi -.Ed -.Pp -Note that dynamically linked Linux executables -will require a suitable environment in -.Pa /compat/linux . -Specifically, the Linux run-time linker's hints files -should be correctly initialized. -For this reason, it is common to execute the following commands -to prepare the system to correctly run Linux executables: -.Bd -literal -offset indent -if [ -x /compat/linux/sbin/ldconfig ]; then - /compat/linux/sbin/ldconfig -r /compat/linux -fi -.Ed -.Pp -For information on loading the -.Nm -kernel loadable module automatically on system startup, -see -.Xr rc.conf 5 . -This information applies -regardless of whether the -.Nm -module is statically linked into the kernel -or loaded as a module. .Sh FILES -.Bl -tag -width /compat/linux/dev/fd -compact +.Bl -tag -width /compat/linux/dev/shm -compact .It Pa /compat/linux minimal Linux run-time environment .It Pa /compat/linux/dev/fd -limited Linux file-descriptor file system +file-descriptor file system, see +.Xr fdescfs 5 +.It Pa /compat/linux/dev/shm +in-memory file system, see +.Xr tmpfs 5 .It Pa /compat/linux/proc -limited Linux process file system +Linux process file system, see +.Xr linprocfs 5 .It Pa /compat/linux/sys -limited Linux system file system +Linux kernel objects file system, see +.Xr linsysfs 5 .El .Sh SEE ALSO .Xr brandelf 1 , @@ -143,7 +128,11 @@ limited Linux system file system .Xr elf 5 , .Xr fdescfs 5 , .Xr linprocfs 5 , -.Xr linsysfs 5 +.Xr linsysfs 5 , +.Xr tmpfs 5 .Sh HISTORY Linux ABI support first appeared in .Fx 2.1 . +.Sh BUGS +Support for some of the Linux-specific system calls and system call arguments +is missing. Modified: head/share/man/man5/linprocfs.5 ============================================================================== --- head/share/man/man5/linprocfs.5 Wed Nov 13 20:27:38 2019 (r354690) +++ head/share/man/man5/linprocfs.5 Wed Nov 13 20:32:23 2019 (r354691) @@ -2,7 +2,7 @@ .\" Written by Garrett Wollman .\" This file is in the public domain. .\" -.Dd August 10, 1994 +.Dd November 13, 2019 .Dt LINPROCFS 5 .Os .Sh NAME @@ -75,6 +75,7 @@ file system on .Sh SEE ALSO .Xr mount 2 , .Xr unmount 2 , +.Xr linux 4 , .Xr procfs 5 , .Xr pseudofs 9 .Sh HISTORY Modified: head/share/man/man5/linsysfs.5 ============================================================================== --- head/share/man/man5/linsysfs.5 Wed Nov 13 20:27:38 2019 (r354690) +++ head/share/man/man5/linsysfs.5 Wed Nov 13 20:32:23 2019 (r354691) @@ -3,12 +3,12 @@ .\" .\" $FreeBSD$ .\" -.Dd February 5, 2007 +.Dd November 13, 2019 .Dt LINSYSFS 5 .Os .Sh NAME .Nm linsysfs -.Nd Linux system file system +.Nd Linux kernel objects file system .Sh SYNOPSIS .Bd -literal linsys /compat/linux/sys linsysfs rw 0 0 @@ -76,6 +76,7 @@ is a mount point. .Sh SEE ALSO .Xr nmount 2 , .Xr unmount 2 , +.Xr linux 4 , .Xr linprocfs 5 , .Xr pseudofs 9 .Sh HISTORY From owner-svn-src-head@freebsd.org Wed Nov 13 21:02:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3ACE01BBC37; Wed, 13 Nov 2019 21:02:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CxrW0VTpz3L2K; Wed, 13 Nov 2019 21:02:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E36051DDEF; Wed, 13 Nov 2019 21:02:18 +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 xADL2Itl044750; Wed, 13 Nov 2019 21:02:18 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADL2I2w044749; Wed, 13 Nov 2019 21:02:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911132102.xADL2I2w044749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 13 Nov 2019 21:02:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354692 - head/contrib/llvm/lib/Support/Unix X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/lib/Support/Unix X-SVN-Commit-Revision: 354692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 21:02:19 -0000 Author: emaste Date: Wed Nov 13 21:02:18 2019 New Revision: 354692 URL: https://svnweb.freebsd.org/changeset/base/354692 Log: llvm: use AT_EXECPATH from ELF auxiliary vectors for getExecutablePath /proc/curproc/file and the KERN_PROC_PATHNAME sysctl may not return the desired path if there are multiple hardlinks to the file. PR: 241932 Tested by: ler Sponsored by: The FreeBSD Foundation Modified: head/contrib/llvm/lib/Support/Unix/Path.inc Modified: head/contrib/llvm/lib/Support/Unix/Path.inc ============================================================================== --- head/contrib/llvm/lib/Support/Unix/Path.inc Wed Nov 13 20:32:23 2019 (r354691) +++ head/contrib/llvm/lib/Support/Unix/Path.inc Wed Nov 13 21:02:18 2019 (r354692) @@ -38,6 +38,9 @@ #include #include #include +#elif defined(__FreeBSD__) +#include +extern char **environ; #elif defined(__DragonFly__) #include #endif @@ -183,13 +186,32 @@ std::string getMainExecutable(const char *argv0, void if (realpath(exe_path, link_path)) return link_path; } -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ - defined(__minix) || defined(__DragonFly__) || \ - defined(__FreeBSD_kernel__) || defined(_AIX) +#elif defined(__FreeBSD__) + // On FreeBSD if the exec path specified in ELF auxiliary vectors is + // preferred, if available. /proc/curproc/file and the KERN_PROC_PATHNAME + // sysctl may not return the desired path if there are multiple hardlinks + // to the file. + char exe_path[PATH_MAX]; + char **p = ::environ; + while (*p++ != 0) + ; + // ELF auxiliary vectors immediately follow the process's environment. + for (;;) { + switch (*(uintptr_t *)p++) { + case AT_EXECPATH: + return *p; + case AT_NULL: + break; + } + p++; + } + // Fall back to argv[0] if auxiliary vectors are not available. + if (getprogpath(exe_path, argv0) != NULL) + return exe_path; +#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__minix) || \ + defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(_AIX) StringRef curproc("/proc/curproc/file"); char exe_path[PATH_MAX]; - // /proc is not mounted by default under FreeBSD, but gives more accurate - // information than argv[0] when it is. if (sys::fs::exists(curproc)) { ssize_t len = readlink(curproc.str().c_str(), exe_path, sizeof(exe_path)); if (len > 0) { From owner-svn-src-head@freebsd.org Wed Nov 13 21:49:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F7061BCC53; Wed, 13 Nov 2019 21:49:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CyvH2QMJz4C4c; Wed, 13 Nov 2019 21:49:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37D711E541; Wed, 13 Nov 2019 21:49:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADLnlQQ071859; Wed, 13 Nov 2019 21:49:47 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADLnlnk071858; Wed, 13 Nov 2019 21:49:47 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911132149.xADLnlnk071858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 13 Nov 2019 21:49:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354693 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 21:49:47 -0000 Author: jhb Date: Wed Nov 13 21:49:46 2019 New Revision: 354693 URL: https://svnweb.freebsd.org/changeset/base/354693 Log: Refine r354661 to unbreak the GCC_BOOTSTRAP case. MK_CLANG_IS_CC controls installing links for GCC, not just clang. Set MK_CLANG_IS_CC to the value of MK_CLANG_BOOTSTRAP. This will leave it as "no" if no bootstrap compiler is being built or GCC 4.2.1 is being used as the bootstrap compiler, and "yes" if clang is being used as the bootstrap compiler. Submitted by: bdrewery (kind of, he suggested this on IRC while I was testing the original patch) Reviewed by: kevans, imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22350 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Nov 13 21:02:18 2019 (r354692) +++ head/Makefile.inc1 Wed Nov 13 21:49:46 2019 (r354693) @@ -734,7 +734,7 @@ TMAKE= \ # TOOLS_PREFIX set in BMAKE XMAKE= ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - MK_CLANG_IS_CC=yes \ + MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \ MK_GDB=no MK_TESTS=no # kernel-tools stage From owner-svn-src-head@freebsd.org Wed Nov 13 21:51:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 919F51BCE43; Wed, 13 Nov 2019 21:51:56 +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 47Cyxm3Kf5z4D6y; Wed, 13 Nov 2019 21:51:56 +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 3E3D41E6C4; Wed, 13 Nov 2019 21:51:56 +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 xADLpu98074886; Wed, 13 Nov 2019 21:51:56 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADLptvc074883; Wed, 13 Nov 2019 21:51:55 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911132151.xADLptvc074883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 13 Nov 2019 21:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354694 - in head: lib/libc/gen sys/sys X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: lib/libc/gen sys/sys X-SVN-Commit-Revision: 354694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 21:51:56 -0000 Author: brooks Date: Wed Nov 13 21:51:55 2019 New Revision: 354694 URL: https://svnweb.freebsd.org/changeset/base/354694 Log: elf_aux_info: Add support for AT_EXECPATH. Reviewed by: emaste, sef MFC after: 3 days Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22353 Modified: head/lib/libc/gen/auxv.3 head/lib/libc/gen/auxv.c head/sys/sys/param.h Modified: head/lib/libc/gen/auxv.3 ============================================================================== --- head/lib/libc/gen/auxv.3 Wed Nov 13 21:49:46 2019 (r354693) +++ head/lib/libc/gen/auxv.3 Wed Nov 13 21:51:55 2019 (r354694) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 25, 2019 +.Dd November 13, 2019 .Dt ELF_AUX_INFO 3 .Os .Sh NAME @@ -48,6 +48,10 @@ can be requested: .Bl -tag -width AT_OSRELDATE .It AT_CANARY The canary value for SSP. +.It AT_EXECPATH +The path of executed program. +This will not be present if the process was initialized by +.Xr fexecve 2 . .It AT_HWCAP CPU / hardware feature flags. .It AT_HWCAP2 Modified: head/lib/libc/gen/auxv.c ============================================================================== --- head/lib/libc/gen/auxv.c Wed Nov 13 21:49:46 2019 (r354693) +++ head/lib/libc/gen/auxv.c Wed Nov 13 21:51:55 2019 (r354694) @@ -69,7 +69,7 @@ __init_elf_aux_vector(void) static pthread_once_t aux_once = PTHREAD_ONCE_INIT; static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; static int hwcap_present, hwcap2_present; -static char *canary, *pagesizes; +static char *canary, *pagesizes, *execpath; static void *timekeep; static u_long hwcap, hwcap2; @@ -88,6 +88,10 @@ init_aux(void) canary_len = aux->a_un.a_val; break; + case AT_EXECPATH: + execpath = (char *)(aux->a_un.a_ptr); + break; + case AT_HWCAP: hwcap_present = 1; hwcap = (u_long)(aux->a_un.a_val); @@ -146,6 +150,18 @@ _elf_aux_info(int aux, void *buf, int buflen) res = 0; } else res = ENOENT; + break; + case AT_EXECPATH: + if (execpath == NULL) + res = ENOENT; + else if (buf == NULL) + res = EINVAL; + else { + if (strlcpy(buf, execpath, buflen) >= buflen) + res = EINVAL; + else + res = 0; + } break; case AT_HWCAP: if (hwcap_present && buflen == sizeof(u_long)) { Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Nov 13 21:49:46 2019 (r354693) +++ head/sys/sys/param.h Wed Nov 13 21:51:55 2019 (r354694) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300056 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300057 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Wed Nov 13 22:39:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1884B1BE312; Wed, 13 Nov 2019 22:39:47 +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 47D00y70Vjz4f42; Wed, 13 Nov 2019 22:39:46 +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 D3EA01EE68; Wed, 13 Nov 2019 22:39:46 +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 xADMdk6Q001867; Wed, 13 Nov 2019 22:39:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADMdkXu001866; Wed, 13 Nov 2019 22:39:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911132239.xADMdkXu001866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Nov 2019 22:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354696 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 22:39:47 -0000 Author: kib Date: Wed Nov 13 22:39:46 2019 New Revision: 354696 URL: https://svnweb.freebsd.org/changeset/base/354696 Log: amd64: only set PCB_FULL_IRET pcb flag when #gp or similar exception comes from usermode. If CPU supports RDFSBASE, the flag also means that userspace fsbase and gsbase are already written into pcb, which might be not true when we handle #gp from kernel. The offender is rdmsr_safe(), and the visible result is corrupted userspace TLS base. Reported by: pstef Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/amd64/amd64/exception.S Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Wed Nov 13 22:25:53 2019 (r354695) +++ head/sys/amd64/amd64/exception.S Wed Nov 13 22:39:46 2019 (r354696) @@ -497,8 +497,8 @@ prot_addrf: 3: cmpw $KUG32SEL,TF_GS(%rsp) jne 4f movq %rdx,PCB_GSBASE(%rdi) + orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* full iret from user #gp */ 4: call handle_ibrs_entry - orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) From owner-svn-src-head@freebsd.org Wed Nov 13 22:43:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC7681BE5F0; Wed, 13 Nov 2019 22:43:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47D04v55G3z3CmQ; Wed, 13 Nov 2019 22:43:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 934011F021; Wed, 13 Nov 2019 22:43:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xADMhBMj007441; Wed, 13 Nov 2019 22:43:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADMhBu4007440; Wed, 13 Nov 2019 22:43:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911132243.xADMhBu4007440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Nov 2019 22:43:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354697 - head/usr.sbin/cpucontrol X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.sbin/cpucontrol X-SVN-Commit-Revision: 354697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 22:43:11 -0000 Author: kib Date: Wed Nov 13 22:43:11 2019 New Revision: 354697 URL: https://svnweb.freebsd.org/changeset/base/354697 Log: cpucontrol: print more useful information when MSR access fails. Instead of providing ioctl cmd value, which has no meaning to user, print MSR number. The later is what the user expects in this place even. Reported by: pstef Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/usr.sbin/cpucontrol/cpucontrol.c Modified: head/usr.sbin/cpucontrol/cpucontrol.c ============================================================================== --- head/usr.sbin/cpucontrol/cpucontrol.c Wed Nov 13 22:39:46 2019 (r354696) +++ head/usr.sbin/cpucontrol/cpucontrol.c Wed Nov 13 22:43:11 2019 (r354697) @@ -307,7 +307,7 @@ do_msr(const char *cmdarg, const char *dev) } error = ioctl(fd, command, &args); if (error < 0) { - WARN(0, "ioctl(%s, CPUCTL_%s (%lu))", dev, command_name, command); + WARN(0, "ioctl(%s, CPUCTL_%s (%#x))", dev, command_name, msr); close(fd); return (1); } From owner-svn-src-head@freebsd.org Wed Nov 13 22:46:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E70B91BE706; Wed, 13 Nov 2019 22:46:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47D0945094z3G76; Wed, 13 Nov 2019 22:46:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xADMkfEC089046 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 14 Nov 2019 00:46:44 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xADMkfEC089046 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xADMkegN089045; Thu, 14 Nov 2019 00:46:40 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 14 Nov 2019 00:46:40 +0200 From: Konstantin Belousov To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354694 - in head: lib/libc/gen sys/sys Message-ID: <20191113224640.GX2707@kib.kiev.ua> References: <201911132151.xADLptvc074883@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201911132151.xADLptvc074883@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47D0945094z3G76 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 22:46:49 -0000 On Wed, Nov 13, 2019 at 09:51:55PM +0000, Brooks Davis wrote: > Author: brooks > Date: Wed Nov 13 21:51:55 2019 > New Revision: 354694 > URL: https://svnweb.freebsd.org/changeset/base/354694 > > Log: > elf_aux_info: Add support for AT_EXECPATH. > > Reviewed by: emaste, sef > MFC after: 3 days > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D22353 > > Modified: > head/lib/libc/gen/auxv.3 > head/lib/libc/gen/auxv.c > head/sys/sys/param.h > > Modified: head/lib/libc/gen/auxv.3 > ============================================================================== > --- head/lib/libc/gen/auxv.3 Wed Nov 13 21:49:46 2019 (r354693) > +++ head/lib/libc/gen/auxv.3 Wed Nov 13 21:51:55 2019 (r354694) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd April 25, 2019 > +.Dd November 13, 2019 > .Dt ELF_AUX_INFO 3 > .Os > .Sh NAME > @@ -48,6 +48,10 @@ can be requested: > .Bl -tag -width AT_OSRELDATE > .It AT_CANARY > The canary value for SSP. > +.It AT_EXECPATH > +The path of executed program. > +This will not be present if the process was initialized by This is too strong statement. The auxv element might be not present if vn_fullpath(9) failed, otherwise we do provide the path. > +.Xr fexecve 2 . From owner-svn-src-head@freebsd.org Wed Nov 13 22:55:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E4AF1BE969; Wed, 13 Nov 2019 22:55:44 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47D0ML5KWJz3Mhm; Wed, 13 Nov 2019 22:55:42 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 022063C0199; Wed, 13 Nov 2019 22:55:36 +0000 (UTC) Date: Wed, 13 Nov 2019 22:55:35 +0000 From: Brooks Davis To: Konstantin Belousov Cc: Brooks Davis , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354694 - in head: lib/libc/gen sys/sys Message-ID: <20191113225535.GA17978@spindle.one-eyed-alien.net> References: <201911132151.xADLptvc074883@repo.freebsd.org> <20191113224640.GX2707@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <20191113224640.GX2707@kib.kiev.ua> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 47D0ML5KWJz3Mhm X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-6.51 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(-3.61)[ip: (-9.44), ipnet: 199.48.128.0/22(-4.71), asn: 36236(-3.85), country: US(-0.05)]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; SIGNED_PGP(-2.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 22:55:44 -0000 --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 14, 2019 at 12:46:40AM +0200, Konstantin Belousov wrote: > On Wed, Nov 13, 2019 at 09:51:55PM +0000, Brooks Davis wrote: > > Author: brooks > > Date: Wed Nov 13 21:51:55 2019 > > New Revision: 354694 > > URL: https://svnweb.freebsd.org/changeset/base/354694 > >=20 > > Log: > > elf_aux_info: Add support for AT_EXECPATH. > > =20 > > Reviewed by: emaste, sef > > MFC after: 3 days > > Sponsored by: DARPA, AFRL > > Differential Revision: https://reviews.freebsd.org/D22353 > >=20 > > Modified: > > head/lib/libc/gen/auxv.3 > > head/lib/libc/gen/auxv.c > > head/sys/sys/param.h > >=20 > > Modified: head/lib/libc/gen/auxv.3 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/lib/libc/gen/auxv.3 Wed Nov 13 21:49:46 2019 (r354693) > > +++ head/lib/libc/gen/auxv.3 Wed Nov 13 21:51:55 2019 (r354694) > > @@ -24,7 +24,7 @@ > > .\" > > .\" $FreeBSD$ > > .\" > > -.Dd April 25, 2019 > > +.Dd November 13, 2019 > > .Dt ELF_AUX_INFO 3 > > .Os > > .Sh NAME > > @@ -48,6 +48,10 @@ can be requested: > > .Bl -tag -width AT_OSRELDATE > > .It AT_CANARY > > The canary value for SSP. > > +.It AT_EXECPATH > > +The path of executed program. > > +This will not be present if the process was initialized by > This is too strong statement. The auxv element might be not present > if vn_fullpath(9) failed, otherwise we do provide the path. >=20 > > +.Xr fexecve 2 . Would it be more accurate to change it from "will" to "may"? Referencing vn_fullpath(9) seems unhelpful in userspace programmer documentation. -- Brooks --C7zPtVaVf+AK4Oqc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJdzInnAAoJEKzQXbSebgfAjVAH/jFv9jpaVtqOvHJc4+XDPeVJ 4dbHxff5z8VgSRgGqkSbVuRf4s3DySQWd5553941Toc/EqzYEZfwAZGSomwDk/Ct sr5Oybye2GyvwItruiztZNDikeJB71g8sRO8QRcRIt3R9B+HKgC8dTaR9EgZ9pfL LE1E87hCGQoSg/kIPLqBi+TCqDqFn1b96GWKjTOs+fyuU5E6QMv9O6ZMuqbOWYSV y7qS8HMjg4fRF5r/o2rlLnwXXd4buNVd8nvwudmnS1zfSNCMIXrtA2zh6i+cFpyz iDedn3rom9yNTwMtmUWd1qA2TBDvYNUKVWfcXoMD9Gv8cJrNYVzQgy+i4Q3/JMY= =Q4/Z -----END PGP SIGNATURE----- --C7zPtVaVf+AK4Oqc-- From owner-svn-src-head@freebsd.org Wed Nov 13 23:17:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 140061BEF1B; Wed, 13 Nov 2019 23:17:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47D0rF4jd5z44XH; Wed, 13 Nov 2019 23:17:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xADNH91v096189 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 14 Nov 2019 01:17:12 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xADNH91v096189 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xADNH90B096188; Thu, 14 Nov 2019 01:17:09 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 14 Nov 2019 01:17:09 +0200 From: Konstantin Belousov To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354694 - in head: lib/libc/gen sys/sys Message-ID: <20191113231709.GY2707@kib.kiev.ua> References: <201911132151.xADLptvc074883@repo.freebsd.org> <20191113224640.GX2707@kib.kiev.ua> <20191113225535.GA17978@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191113225535.GA17978@spindle.one-eyed-alien.net> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47D0rF4jd5z44XH X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 23:17:18 -0000 On Wed, Nov 13, 2019 at 10:55:35PM +0000, Brooks Davis wrote: > On Thu, Nov 14, 2019 at 12:46:40AM +0200, Konstantin Belousov wrote: > > On Wed, Nov 13, 2019 at 09:51:55PM +0000, Brooks Davis wrote: > > > Author: brooks > > > Date: Wed Nov 13 21:51:55 2019 > > > New Revision: 354694 > > > URL: https://svnweb.freebsd.org/changeset/base/354694 > > > > > > Log: > > > elf_aux_info: Add support for AT_EXECPATH. > > > > > > Reviewed by: emaste, sef > > > MFC after: 3 days > > > Sponsored by: DARPA, AFRL > > > Differential Revision: https://reviews.freebsd.org/D22353 > > > > > > Modified: > > > head/lib/libc/gen/auxv.3 > > > head/lib/libc/gen/auxv.c > > > head/sys/sys/param.h > > > > > > Modified: head/lib/libc/gen/auxv.3 > > > ============================================================================== > > > --- head/lib/libc/gen/auxv.3 Wed Nov 13 21:49:46 2019 (r354693) > > > +++ head/lib/libc/gen/auxv.3 Wed Nov 13 21:51:55 2019 (r354694) > > > @@ -24,7 +24,7 @@ > > > .\" > > > .\" $FreeBSD$ > > > .\" > > > -.Dd April 25, 2019 > > > +.Dd November 13, 2019 > > > .Dt ELF_AUX_INFO 3 > > > .Os > > > .Sh NAME > > > @@ -48,6 +48,10 @@ can be requested: > > > .Bl -tag -width AT_OSRELDATE > > > .It AT_CANARY > > > The canary value for SSP. > > > +.It AT_EXECPATH > > > +The path of executed program. > > > +This will not be present if the process was initialized by > > This is too strong statement. The auxv element might be not present > > if vn_fullpath(9) failed, otherwise we do provide the path. > > > > > +.Xr fexecve 2 . > > Would it be more accurate to change it from "will" to "may"? > Referencing vn_fullpath(9) seems unhelpful in userspace programmer > documentation. I do not suggest to reference vn_fullpath(9). 'May' is enough, you might also mention namecache. From owner-svn-src-head@freebsd.org Wed Nov 13 23:31:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AABC1BF82F; Wed, 13 Nov 2019 23:31:24 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47D18X2VTYz4FGG; Wed, 13 Nov 2019 23:31:24 +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 33AE21F7B3; Wed, 13 Nov 2019 23:31:24 +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 xADNVOKf036439; Wed, 13 Nov 2019 23:31:24 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xADNVOlW036438; Wed, 13 Nov 2019 23:31:24 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911132331.xADNVOlW036438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 13 Nov 2019 23:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354699 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 354699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 23:31:24 -0000 Author: brooks Date: Wed Nov 13 23:31:23 2019 New Revision: 354699 URL: https://svnweb.freebsd.org/changeset/base/354699 Log: Improve the description of AT_EXECPATH availability. Reported by: kib Sponsored by: DARPA, AFRL Modified: head/lib/libc/gen/auxv.3 Modified: head/lib/libc/gen/auxv.3 ============================================================================== --- head/lib/libc/gen/auxv.3 Wed Nov 13 23:26:12 2019 (r354698) +++ head/lib/libc/gen/auxv.3 Wed Nov 13 23:31:23 2019 (r354699) @@ -50,8 +50,9 @@ can be requested: The canary value for SSP. .It AT_EXECPATH The path of executed program. -This will not be present if the process was initialized by -.Xr fexecve 2 . +This may not be present if the process was initialized by +.Xr fexecve 2 +and the namecache no longer contains the file's name. .It AT_HWCAP CPU / hardware feature flags. .It AT_HWCAP2 From owner-svn-src-head@freebsd.org Wed Nov 13 23:46:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7E531C121C; Wed, 13 Nov 2019 23:46:49 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47D1VJ4jbMz4Z0D; Wed, 13 Nov 2019 23:46:48 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f67.google.com with SMTP id 1so4702270iou.4; Wed, 13 Nov 2019 15:46:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gjv6aGCly/sR1N5sOLiUsfEub0DAOxsFDAZmxJ4TrpI=; b=slcK9imlrSVk8Rld8LKoH+YmMk3s72XqV5v0QZ9zdvm7ZE9SSm6bIDDOXV2C05JUR6 oAAS47Lw5RO2697fHj9Vubjht4eh7gQ7HqG7teXDRHr3h43o6ME5kQSFEACgLODL+zrL 26MfmJ5JvjDJALbm49rcpehN2+KNQEFv9XX6baQCBcdOwDef336eERi820Z4d4nxquQ3 vZk/SVcppHAT/5SsCVHs/JzAs/p2koWHqL+padpcSsofBrh7xeJciD6tY2MeVVp/4SLz KIQX8GlGcuyTbqP4jXSPoYMyCb+OF9Fxr03hfyR82k6wiGWjzFU2I22gRRHFygRmk18G VWxA== X-Gm-Message-State: APjAAAWXw4/+gD4dqvHNwmlfbfQYmEJ/v57lIEu4tJxDqeUscMSGeZ7l nyiTY97VHcR/tx5B5rl4+k2Y/dopNr6Pk03kutQBcw== X-Google-Smtp-Source: APXvYqyppN1LSyBcL0SQkzYiSVf96irmTlrPGIgL0krY/YeOVNBmAEjjj/G+RMGrTfGtyIkOOkmzdFtsHHl8v7yzR8A= X-Received: by 2002:a6b:7e0a:: with SMTP id i10mr1122794iom.120.1573688807098; Wed, 13 Nov 2019 15:46:47 -0800 (PST) MIME-Version: 1.0 References: <201911132151.xADLptvc074883@repo.freebsd.org> <20191113224640.GX2707@kib.kiev.ua> <20191113225535.GA17978@spindle.one-eyed-alien.net> <20191113231709.GY2707@kib.kiev.ua> In-Reply-To: <20191113231709.GY2707@kib.kiev.ua> From: Ed Maste Date: Wed, 13 Nov 2019 15:00:04 -0500 Message-ID: Subject: Re: svn commit: r354694 - in head: lib/libc/gen sys/sys To: Konstantin Belousov Cc: Brooks Davis , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47D1VJ4jbMz4Z0D X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.67 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-3.31 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[67.166.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.31)[ip: (-1.30), ipnet: 209.85.128.0/17(-3.18), asn: 15169(-1.99), country: US(-0.05)]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[67.166.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 23:46:49 -0000 On Wed, 13 Nov 2019 at 18:17, Konstantin Belousov wrote: > > On Wed, Nov 13, 2019 at 10:55:35PM +0000, Brooks Davis wrote: > > On Thu, Nov 14, 2019 at 12:46:40AM +0200, Konstantin Belousov wrote: > > > On Wed, Nov 13, 2019 at 09:51:55PM +0000, Brooks Davis wrote: > > > > Author: brooks > > > > Date: Wed Nov 13 21:51:55 2019 > > > > New Revision: 354694 > > > > URL: https://svnweb.freebsd.org/changeset/base/354694 > > > > > > > > Log: > > > > elf_aux_info: Add support for AT_EXECPATH. > > > > > > > > Reviewed by: emaste, sef > > > > MFC after: 3 days > > > > Sponsored by: DARPA, AFRL > > > > Differential Revision: https://reviews.freebsd.org/D22353 > > > > > > > > Modified: > > > > head/lib/libc/gen/auxv.3 > > > > head/lib/libc/gen/auxv.c > > > > head/sys/sys/param.h > > > > > > > > Modified: head/lib/libc/gen/auxv.3 > > > > ============================================================================== > > > > --- head/lib/libc/gen/auxv.3 Wed Nov 13 21:49:46 2019 (r354693) > > > > +++ head/lib/libc/gen/auxv.3 Wed Nov 13 21:51:55 2019 (r354694) > > > > @@ -24,7 +24,7 @@ > > > > .\" > > > > .\" $FreeBSD$ > > > > .\" > > > > -.Dd April 25, 2019 > > > > +.Dd November 13, 2019 > > > > .Dt ELF_AUX_INFO 3 > > > > .Os > > > > .Sh NAME > > > > @@ -48,6 +48,10 @@ can be requested: > > > > .Bl -tag -width AT_OSRELDATE > > > > .It AT_CANARY > > > > The canary value for SSP. > > > > +.It AT_EXECPATH > > > > +The path of executed program. > > > > +This will not be present if the process was initialized by > > > This is too strong statement. The auxv element might be not present > > > if vn_fullpath(9) failed, otherwise we do provide the path. > > > > > > > +.Xr fexecve 2 . > > > > Would it be more accurate to change it from "will" to "may"? > > Referencing vn_fullpath(9) seems unhelpful in userspace programmer > > documentation. > > I do not suggest to reference vn_fullpath(9). 'May' is enough, you might > also mention namecache. Perhaps also mention that in that case it's not guaranteed to be the pathname that was actually used, if there are multiple links. From owner-svn-src-head@freebsd.org Wed Nov 13 23:54:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A8B21C16FB; Wed, 13 Nov 2019 23:54:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47D1gC73HLz3DLt; Wed, 13 Nov 2019 23:54:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xADNsOLO005434 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 14 Nov 2019 01:54:27 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xADNsOLO005434 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xADNsOCb005433; Thu, 14 Nov 2019 01:54:24 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 14 Nov 2019 01:54:24 +0200 From: Konstantin Belousov To: Ed Maste Cc: Brooks Davis , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r354694 - in head: lib/libc/gen sys/sys Message-ID: <20191113235424.GZ2707@kib.kiev.ua> References: <201911132151.xADLptvc074883@repo.freebsd.org> <20191113224640.GX2707@kib.kiev.ua> <20191113225535.GA17978@spindle.one-eyed-alien.net> <20191113231709.GY2707@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47D1gC73HLz3DLt X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 23:54:32 -0000 On Wed, Nov 13, 2019 at 03:00:04PM -0500, Ed Maste wrote: > On Wed, 13 Nov 2019 at 18:17, Konstantin Belousov wrote: > > > > On Wed, Nov 13, 2019 at 10:55:35PM +0000, Brooks Davis wrote: > > > On Thu, Nov 14, 2019 at 12:46:40AM +0200, Konstantin Belousov wrote: > > > > On Wed, Nov 13, 2019 at 09:51:55PM +0000, Brooks Davis wrote: > > > > > Author: brooks > > > > > Date: Wed Nov 13 21:51:55 2019 > > > > > New Revision: 354694 > > > > > URL: https://svnweb.freebsd.org/changeset/base/354694 > > > > > > > > > > Log: > > > > > elf_aux_info: Add support for AT_EXECPATH. > > > > > > > > > > Reviewed by: emaste, sef > > > > > MFC after: 3 days > > > > > Sponsored by: DARPA, AFRL > > > > > Differential Revision: https://reviews.freebsd.org/D22353 > > > > > > > > > > Modified: > > > > > head/lib/libc/gen/auxv.3 > > > > > head/lib/libc/gen/auxv.c > > > > > head/sys/sys/param.h > > > > > > > > > > Modified: head/lib/libc/gen/auxv.3 > > > > > ============================================================================== > > > > > --- head/lib/libc/gen/auxv.3 Wed Nov 13 21:49:46 2019 (r354693) > > > > > +++ head/lib/libc/gen/auxv.3 Wed Nov 13 21:51:55 2019 (r354694) > > > > > @@ -24,7 +24,7 @@ > > > > > .\" > > > > > .\" $FreeBSD$ > > > > > .\" > > > > > -.Dd April 25, 2019 > > > > > +.Dd November 13, 2019 > > > > > .Dt ELF_AUX_INFO 3 > > > > > .Os > > > > > .Sh NAME > > > > > @@ -48,6 +48,10 @@ can be requested: > > > > > .Bl -tag -width AT_OSRELDATE > > > > > .It AT_CANARY > > > > > The canary value for SSP. > > > > > +.It AT_EXECPATH > > > > > +The path of executed program. > > > > > +This will not be present if the process was initialized by > > > > This is too strong statement. The auxv element might be not present > > > > if vn_fullpath(9) failed, otherwise we do provide the path. > > > > > > > > > +.Xr fexecve 2 . > > > > > > Would it be more accurate to change it from "will" to "may"? > > > Referencing vn_fullpath(9) seems unhelpful in userspace programmer > > > documentation. > > > > I do not suggest to reference vn_fullpath(9). 'May' is enough, you might > > also mention namecache. > > Perhaps also mention that in that case it's not guaranteed to be the > pathname that was actually used, if there are multiple links. Yes, but then should we mention renames ? From owner-svn-src-head@freebsd.org Thu Nov 14 01:38:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23CE01C3655; Thu, 14 Nov 2019 01:38:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47D3zY6hp7z4Q74; Thu, 14 Nov 2019 01:38:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1E6E20F13; Thu, 14 Nov 2019 01:38:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAE1cncn026351; Thu, 14 Nov 2019 01:38:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAE1cnuT026348; Thu, 14 Nov 2019 01:38:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911140138.xAE1cnuT026348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 14 Nov 2019 01:38:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354700 - in head/lib/libc/arm: aeabi gen X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/lib/libc/arm: aeabi gen X-SVN-Commit-Revision: 354700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 01:38:50 -0000 Author: imp Date: Thu Nov 14 01:38:48 2019 New Revision: 354700 URL: https://svnweb.freebsd.org/changeset/base/354700 Log: armv6 soft float build fixed Add ifdefs in the assembler for soft-float compile case. Submitted by: Hiroki Mori Reviewed by: ray@ Differential Review: https://reviews.freebsd.org/D22352 Modified: head/lib/libc/arm/aeabi/aeabi_vfp.h head/lib/libc/arm/gen/_setjmp.S head/lib/libc/arm/gen/setjmp.S Modified: head/lib/libc/arm/aeabi/aeabi_vfp.h ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_vfp.h Wed Nov 13 23:31:23 2019 (r354699) +++ head/lib/libc/arm/aeabi/aeabi_vfp.h Thu Nov 14 01:38:48 2019 (r354700) @@ -67,7 +67,7 @@ * C Helper macros */ -#if __ARM_ARCH >= 6 +#if __ARM_ARCH >= 6 && !defined(SOFTFLOAT_FOR_GCC) /* * Generate a function that will either call into the VFP implementation, * or the soft float version for a given __aeabi_* helper. The function Modified: head/lib/libc/arm/gen/_setjmp.S ============================================================================== --- head/lib/libc/arm/gen/_setjmp.S Wed Nov 13 23:31:23 2019 (r354699) +++ head/lib/libc/arm/gen/_setjmp.S Thu Nov 14 01:38:48 2019 (r354700) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); ENTRY(_setjmp) ldr r1, .L_setjmp_magic -#if !defined(_STANDALONE) && __ARM_ARCH >= 6 +#if !defined(_STANDALONE) && __ARM_ARCH >= 6 && !defined(SOFTFLOAT_FOR_GCC) add r2, r0, #(_JB_REG_D8 * 4) vstmia r2, {d8-d15} vmrs r2, fpscr @@ -94,7 +94,7 @@ ENTRY(_longjmp) teq ip, r2 /* magic correct? */ bne botch /* no, botch */ -#if !defined(_STANDALONE) && __ARM_ARCH >= 6 +#if !defined(_STANDALONE) && __ARM_ARCH >= 6 && !defined(SOFTFLOAT_FOR_GCC) add ip, r0, #(_JB_REG_D8 * 4) vldmia ip, {d8-d15} ldr ip, [r0, #(_JB_REG_FPSCR * 4)] Modified: head/lib/libc/arm/gen/setjmp.S ============================================================================== --- head/lib/libc/arm/gen/setjmp.S Wed Nov 13 23:31:23 2019 (r354699) +++ head/lib/libc/arm/gen/setjmp.S Thu Nov 14 01:38:48 2019 (r354700) @@ -64,7 +64,7 @@ ENTRY(setjmp) ldr r1, .Lsetjmp_magic -#if __ARM_ARCH >= 6 +#if __ARM_ARCH >= 6 && !defined(SOFTFLOAT_FOR_GCC) add r2, r0, #(_JB_REG_D8 * 4) vstmia r2, {d8-d15} vmrs r2, fpscr @@ -105,7 +105,7 @@ ENTRY(__longjmp) bl PIC_SYM(_C_LABEL(sigprocmask), PLT) ldmfd sp!, {r0-r2, r14} -#if __ARM_ARCH >= 6 +#if __ARM_ARCH >= 6 && !defined(SOFTFLOAT_FOR_GCC) add ip, r0, #(_JB_REG_D8 * 4) vldmia ip, {d8-d15} ldr ip, [r0, #(_JB_REG_FPSCR * 4)] From owner-svn-src-head@freebsd.org Thu Nov 14 04:34:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E5841C5B4C; Thu, 14 Nov 2019 04:34:19 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47D7t30pkHz48vG; Thu, 14 Nov 2019 04:34:19 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E204522FDD; Thu, 14 Nov 2019 04:34:18 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAE4YIFg031912; Thu, 14 Nov 2019 04:34:18 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAE4YI0N031910; Thu, 14 Nov 2019 04:34:18 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201911140434.xAE4YI0N031910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Thu, 14 Nov 2019 04:34:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354701 - in head/sys: conf powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/sys: conf powerpc/aim X-SVN-Commit-Revision: 354701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 04:34:19 -0000 Author: bdragon Date: Thu Nov 14 04:34:17 2019 New Revision: 354701 URL: https://svnweb.freebsd.org/changeset/base/354701 Log: powerpc: Kernel fixes for ppc32 and powerpcspe w/ lld Fix wrong section ordering that was causing a ".got is not contiguous with other relro sections" lld error. This also brings ldscript.powerpc and ldscript.powerpcspe closer to ldscript.powerpc64. Also, remove unnecessary text relocs from the ppc32 AIM trap code. Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D22349 Modified: head/sys/conf/ldscript.powerpc head/sys/conf/ldscript.powerpcspe head/sys/powerpc/aim/trap_subr32.S Modified: head/sys/conf/ldscript.powerpc ============================================================================== --- head/sys/conf/ldscript.powerpc Thu Nov 14 01:38:48 2019 (r354700) +++ head/sys/conf/ldscript.powerpc Thu Nov 14 04:34:17 2019 (r354701) @@ -15,6 +15,7 @@ SECTIONS .text : { + *(.glink) *(.text) *(.stub) /* .gnu.warning sections are handled specially by elf32.em. */ @@ -71,6 +72,11 @@ SECTIONS } .data1 : { *(.data1) } .got1 : { *(.got1) } + . = ALIGN(4096); + .got : { *(.got) } + .got.plt : { *(.got.plt) } + + .dynamic : { *(.dynamic) } /* Put .ctors and .dtors next to the .got2 section, so that the pointers get relocated with -mrelocatable. Also put in the .fixup pointers. @@ -87,10 +93,6 @@ SECTIONS .fixup : { *(.fixup) } PROVIDE (_FIXUP_END_ = .); PROVIDE (_GOT2_END_ = .); - PROVIDE (_GOT_START_ = .); - .got : { *(.got) } - .got.plt : { *(.got.plt) } - PROVIDE (_GOT_END_ = .); /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ Modified: head/sys/conf/ldscript.powerpcspe ============================================================================== --- head/sys/conf/ldscript.powerpcspe Thu Nov 14 01:38:48 2019 (r354700) +++ head/sys/conf/ldscript.powerpcspe Thu Nov 14 04:34:17 2019 (r354701) @@ -15,6 +15,7 @@ SECTIONS .text : { + *(.glink) *(.text) *(.stub) /* .gnu.warning sections are handled specially by elf32.em. */ @@ -72,6 +73,11 @@ SECTIONS } .data1 : { *(.data1) } .got1 : { *(.got1) } + . = ALIGN(4096); + .got : { *(.got) } + .got.plt : { *(.got.plt) } + + .dynamic : { *(.dynamic) } /* Put .ctors and .dtors next to the .got2 section, so that the pointers get relocated with -mrelocatable. Also put in the .fixup pointers. @@ -88,10 +94,6 @@ SECTIONS .fixup : { *(.fixup) } PROVIDE (_FIXUP_END_ = .); PROVIDE (_GOT2_END_ = .); - PROVIDE (_GOT_START_ = .); - .got : { *(.got) } - .got.plt : { *(.got.plt) } - PROVIDE (_GOT_END_ = .); /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ Modified: head/sys/powerpc/aim/trap_subr32.S ============================================================================== --- head/sys/powerpc/aim/trap_subr32.S Thu Nov 14 01:38:48 2019 (r354700) +++ head/sys/powerpc/aim/trap_subr32.S Thu Nov 14 04:34:17 2019 (r354701) @@ -302,10 +302,8 @@ CNAME(restorebridgesize) = .-CNAME(restorebridge) */ .globl CNAME(rstcode), CNAME(rstcodeend) CNAME(rstcode): - bl 1f - .long cpu_reset -1: mflr %r31 - lwz %r31,0(%r31) + lwz %r31, TRAP_GENTRAP(0) + addi %r31, %r31, (cpu_reset - generictrap) mtlr %r31 blrl CNAME(rstcodeend): @@ -384,10 +382,8 @@ CNAME(alitrap): mtcr %r31 /* Jump to s_trap */ - bl 1f - .long s_trap -1: mflr %r31 - lwz %r31,0(%r31) + lwz %r31, TRAP_GENTRAP(0) + addi %r31, %r31, (s_trap - generictrap) mtlr %r31 blrl CNAME(aliend): @@ -652,10 +648,8 @@ CNAME(dsitrap): mflr %r28 /* save LR (SP already saved) */ /* Jump to disitrap */ - bl 4f - .long disitrap -4: mflr %r1 - lwz %r1,0(%r1) + lwz %r1, TRAP_GENTRAP(0) + addi %r1, %r1, (disitrap - generictrap) mtlr %r1 blrl CNAME(dsiend): @@ -929,10 +923,8 @@ CNAME(dblow): mflr %r28 /* save LR */ /* Jump to dbtrap */ - bl 2f - .long dbtrap -2: mflr %r1 - lwz %r1,0(%r1) + lwz %r1, TRAP_GENTRAP(0) + addi %r1, %r1, (dbtrap - generictrap) mtlr %r1 blrl CNAME(dbend): From owner-svn-src-head@freebsd.org Thu Nov 14 04:35:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46C0C1C5BBF; Thu, 14 Nov 2019 04:35:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47D7tr1B3jz49bS; Thu, 14 Nov 2019 04:35:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07EC022FE2; Thu, 14 Nov 2019 04:35:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAE4YxLZ031984; Thu, 14 Nov 2019 04:34:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAE4YxNh031979; Thu, 14 Nov 2019 04:34:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911140434.xAE4YxNh031979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 14 Nov 2019 04:34:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354702 - in head/sys/dev/ntb: . ntb_hw X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/dev/ntb: . ntb_hw X-SVN-Commit-Revision: 354702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 04:35:00 -0000 Author: mav Date: Thu Nov 14 04:34:58 2019 New Revision: 354702 URL: https://svnweb.freebsd.org/changeset/base/354702 Log: Make ntb(4) send bus_get_dma_tag() requests to parent buses passing real bus' child pointers instead of grandchilds. DMAR does not like requests from devices not parented directly by PCI. MFC after: 2 weeks Modified: head/sys/dev/ntb/ntb.c head/sys/dev/ntb/ntb.h head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Modified: head/sys/dev/ntb/ntb.c ============================================================================== --- head/sys/dev/ntb/ntb.c Thu Nov 14 04:34:17 2019 (r354701) +++ head/sys/dev/ntb/ntb.c Thu Nov 14 04:34:58 2019 (r354702) @@ -205,6 +205,13 @@ ntb_print_child(device_t dev, device_t child) return (retval); } +bus_dma_tag_t +ntb_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + void ntb_link_event(device_t dev) { Modified: head/sys/dev/ntb/ntb.h ============================================================================== --- head/sys/dev/ntb/ntb.h Thu Nov 14 04:34:17 2019 (r354701) +++ head/sys/dev/ntb/ntb.h Thu Nov 14 04:34:58 2019 (r354702) @@ -39,6 +39,7 @@ int ntb_unregister_device(device_t ntb); int ntb_child_location_str(device_t dev, device_t child, char *buf, size_t buflen); int ntb_print_child(device_t dev, device_t child); +bus_dma_tag_t ntb_get_dma_tag(device_t bus, device_t child); /* * ntb_link_event() - notify driver context of a change in link status Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c Thu Nov 14 04:34:17 2019 (r354701) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c Thu Nov 14 04:34:58 2019 (r354702) @@ -1266,6 +1266,7 @@ static device_method_t ntb_amd_methods[] = { /* Bus interface */ DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), + DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag), /* NTB interface */ DEVMETHOD(ntb_port_number, amd_ntb_port_number), Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 14 04:34:17 2019 (r354701) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 14 04:34:58 2019 (r354702) @@ -3124,6 +3124,7 @@ static device_method_t ntb_intel_methods[] = { /* Bus interface */ DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), + DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag), /* NTB interface */ DEVMETHOD(ntb_port_number, intel_ntb_port_number), DEVMETHOD(ntb_peer_port_count, intel_ntb_peer_port_count), Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Nov 14 04:34:17 2019 (r354701) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Nov 14 04:34:58 2019 (r354702) @@ -1046,6 +1046,7 @@ static device_method_t ntb_plx_methods[] = { /* Bus interface */ DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), + DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag), /* NTB interface */ DEVMETHOD(ntb_port_number, ntb_plx_port_number), DEVMETHOD(ntb_peer_port_count, ntb_plx_peer_port_count), From owner-svn-src-head@freebsd.org Thu Nov 14 04:39:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4A231C5C4C; Thu, 14 Nov 2019 04:39:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47D80P4BDlz4G26; Thu, 14 Nov 2019 04:39:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69D5722FE7; Thu, 14 Nov 2019 04:39:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAE4dnQv032225; Thu, 14 Nov 2019 04:39:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAE4dngZ032224; Thu, 14 Nov 2019 04:39:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911140439.xAE4dngZ032224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 14 Nov 2019 04:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354703 - head/sys/dev/ioat X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ioat X-SVN-Commit-Revision: 354703 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 04:39:49 -0000 Author: mav Date: Thu Nov 14 04:39:48 2019 New Revision: 354703 URL: https://svnweb.freebsd.org/changeset/base/354703 Log: Pass more reasonable WAIT flags to bus_dma(9) calls. MFC after: 2 weeks Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Thu Nov 14 04:34:58 2019 (r354702) +++ head/sys/dev/ioat/ioat.c Thu Nov 14 04:39:48 2019 (r354703) @@ -555,13 +555,14 @@ ioat3_attach(device_t device) &ioat->comp_update_tag); error = bus_dmamem_alloc(ioat->comp_update_tag, - (void **)&ioat->comp_update, BUS_DMA_ZERO, &ioat->comp_update_map); + (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, + &ioat->comp_update_map); if (ioat->comp_update == NULL) return (ENOMEM); error = bus_dmamap_load(ioat->comp_update_tag, ioat->comp_update_map, ioat->comp_update, sizeof(uint64_t), ioat_comp_update_map, ioat, - 0); + BUS_DMA_NOWAIT); if (error != 0) return (error); @@ -582,7 +583,7 @@ ioat3_attach(device_t device) return (error); error = bus_dmamap_load(ioat->hw_desc_tag, ioat->hw_desc_map, hw_desc, - ringsz, ioat_dmamap_cb, &ioat->hw_desc_bus_addr, BUS_DMA_WAITOK); + ringsz, ioat_dmamap_cb, &ioat->hw_desc_bus_addr, BUS_DMA_NOWAIT); if (error) return (error); From owner-svn-src-head@freebsd.org Thu Nov 14 10:12:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07EFF17B7E6; Thu, 14 Nov 2019 10:12:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47DHMg1zlbz3Lb5; Thu, 14 Nov 2019 10:11:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAEABnDh048504 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 14 Nov 2019 12:11:52 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAEABnDh048504 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAEABnLq048503; Thu, 14 Nov 2019 12:11:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 14 Nov 2019 12:11:49 +0200 From: Konstantin Belousov To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354703 - head/sys/dev/ioat Message-ID: <20191114101149.GA2707@kib.kiev.ua> References: <201911140439.xAE4dngZ032224@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201911140439.xAE4dngZ032224@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47DHMg1zlbz3Lb5 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 10:12:00 -0000 On Thu, Nov 14, 2019 at 04:39:49AM +0000, Alexander Motin wrote: > Author: mav > Date: Thu Nov 14 04:39:48 2019 > New Revision: 354703 > URL: https://svnweb.freebsd.org/changeset/base/354703 > > Log: > Pass more reasonable WAIT flags to bus_dma(9) calls. > > MFC after: 2 weeks > > Modified: > head/sys/dev/ioat/ioat.c > > Modified: head/sys/dev/ioat/ioat.c > ============================================================================== > --- head/sys/dev/ioat/ioat.c Thu Nov 14 04:34:58 2019 (r354702) > +++ head/sys/dev/ioat/ioat.c Thu Nov 14 04:39:48 2019 (r354703) > @@ -555,13 +555,14 @@ ioat3_attach(device_t device) > &ioat->comp_update_tag); > > error = bus_dmamem_alloc(ioat->comp_update_tag, > - (void **)&ioat->comp_update, BUS_DMA_ZERO, &ioat->comp_update_map); > + (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, > + &ioat->comp_update_map); For waitok, you need to provide locking function in the tag. > if (ioat->comp_update == NULL) > return (ENOMEM); > > error = bus_dmamap_load(ioat->comp_update_tag, ioat->comp_update_map, > ioat->comp_update, sizeof(uint64_t), ioat_comp_update_map, ioat, > - 0); > + BUS_DMA_NOWAIT); > if (error != 0) > return (error); > > @@ -582,7 +583,7 @@ ioat3_attach(device_t device) > return (error); > > error = bus_dmamap_load(ioat->hw_desc_tag, ioat->hw_desc_map, hw_desc, > - ringsz, ioat_dmamap_cb, &ioat->hw_desc_bus_addr, BUS_DMA_WAITOK); > + ringsz, ioat_dmamap_cb, &ioat->hw_desc_bus_addr, BUS_DMA_NOWAIT); > if (error) > return (error); > From owner-svn-src-head@freebsd.org Thu Nov 14 14:41:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50BCC1A9A36; Thu, 14 Nov 2019 14:41:41 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yw1-xc35.google.com (mail-yw1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DPLr3QZ1z41YW; Thu, 14 Nov 2019 14:41:40 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yw1-xc35.google.com with SMTP id m196so1915691ywd.5; Thu, 14 Nov 2019 06:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qj9UJmkByLNe2czT448zxiMUb+FVtF4Icd4cGzpemEo=; b=cvDVoVrmR3tSYasWcJshSSf/FblTcIuppQIdI9ZsLRp/xbtib2enAYBYQssbJ89oaO wa/rQegU74QdfcGpAMps+Y061XNg64U41ulyI65S6BXOqNhYtPT9O0pGuFQOAVx2JB+5 A8qk6z1rLmgqhrx8eiHuWL8fn86AzK60hDtH9mFzs4nUzekpNlyRmL0vOcl8eVvftfJo Va4V5BiYdCVQ893/iF4CG7XBEf3hC8U4y76KUkUV+B52RIpJWcNBCpf+u2Ry67/O+YKv EUO/VOKT3FQ52PjfC4ot0RivaK940y+l6oa9tV+Dp+kDHL6Fu/GDGIlFuISMvb5hzSh6 Dg9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=qj9UJmkByLNe2czT448zxiMUb+FVtF4Icd4cGzpemEo=; b=HCD0GAPY9K7XfD4H8HImZX3IoA3kenGfXCyH2nD30EO5thFt1GvP24/nglcU2wcUTC SnIZpuNce2nV9n0icitwY0EzA6HOdsuOEgkL629n39bIshB8ebb4UwGOVlDTboQimY0c fw89oy62aTcTgNkxu9spA2BUTkzurLOTbtOgakZ9yniJkDVPsb4m3QH74Vh1clEVuWKx 1U2daUElymQwPHAUAwHA6VnX1SOqZu2jsknq6eVlu1G7b9MjKv4h/aKIO1CqSH2xZ3p4 hzkeH788Kp7HkmpeNPSqQBMVRWmcWtxTcN5aXsCMal+Yj/ISKOulegMxTez/nhn9MysI xAsQ== X-Gm-Message-State: APjAAAV1mSQlvRcYuMFhGJMZi58Jtj7fnHBTO3ZGA0NoUbJYZTDPOCOe v6+ZI1h7AKpYTM++sYFgOiONw04i X-Google-Smtp-Source: APXvYqwlRWOIC4CSfkgFKFX7AMluHvcorZSosSlJw7+cmIK8Lt1JiVp3d+ASQRaVd7+IdLfMiJ4TDA== X-Received: by 2002:a81:5885:: with SMTP id m127mr5913804ywb.484.1573742498371; Thu, 14 Nov 2019 06:41:38 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id i128sm1672380ywc.31.2019.11.14.06.41.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Nov 2019 06:41:37 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r354703 - head/sys/dev/ioat To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911140439.xAE4dngZ032224@repo.freebsd.org> <20191114101149.GA2707@kib.kiev.ua> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: <475757c6-3707-540b-0316-cbef278043c2@FreeBSD.org> Date: Thu, 14 Nov 2019 09:41:36 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191114101149.GA2707@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 47DPLr3QZ1z41YW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=cvDVoVrm; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::c35 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-4.81 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[5.3.c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.61)[ip: (-8.68), ipnet: 2607:f8b0::/32(-2.32), asn: 15169(-1.99), country: US(-0.05)]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 14:41:41 -0000 On 14.11.2019 05:11, Konstantin Belousov wrote: > On Thu, Nov 14, 2019 at 04:39:49AM +0000, Alexander Motin wrote: >> Author: mav >> Date: Thu Nov 14 04:39:48 2019 >> New Revision: 354703 >> URL: https://svnweb.freebsd.org/changeset/base/354703 >> >> Log: >> Pass more reasonable WAIT flags to bus_dma(9) calls. >> >> MFC after: 2 weeks >> >> Modified: >> head/sys/dev/ioat/ioat.c >> >> Modified: head/sys/dev/ioat/ioat.c >> ============================================================================== >> --- head/sys/dev/ioat/ioat.c Thu Nov 14 04:34:58 2019 (r354702) >> +++ head/sys/dev/ioat/ioat.c Thu Nov 14 04:39:48 2019 (r354703) >> @@ -555,13 +555,14 @@ ioat3_attach(device_t device) >> &ioat->comp_update_tag); >> >> error = bus_dmamem_alloc(ioat->comp_update_tag, >> - (void **)&ioat->comp_update, BUS_DMA_ZERO, &ioat->comp_update_map); >> + (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, >> + &ioat->comp_update_map); > For waitok, you need to provide locking function in the tag. I'm sorry, but why? It is alloc(), not load(). For load() it makes sense since it calls back, but this is just a form of malloc(), isn't it? I've looked through the both x86 implementations and found nothing suspicious. -- Alexander Motin From owner-svn-src-head@freebsd.org Thu Nov 14 15:10:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA2251AA963; Thu, 14 Nov 2019 15:10:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DPzY4hXnz4TNW; Thu, 14 Nov 2019 15:10:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85C9E21CD; Thu, 14 Nov 2019 15:10:01 +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 xAEFA1hN002153; Thu, 14 Nov 2019 15:10:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAEFA1xS002152; Thu, 14 Nov 2019 15:10:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911141510.xAEFA1xS002152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 14 Nov 2019 15:10:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354707 - head/contrib/llvm/lib/Support/Unix X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/lib/Support/Unix X-SVN-Commit-Revision: 354707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 15:10:01 -0000 Author: emaste Date: Thu Nov 14 15:10:01 2019 New Revision: 354707 URL: https://svnweb.freebsd.org/changeset/base/354707 Log: llvm: use elf_aux_info to get executable's path, if available Obtained from: LLVM a0a38b81ea MFC with: r354692 Sponsored by: The FreeBSD Foundation Modified: head/contrib/llvm/lib/Support/Unix/Path.inc Modified: head/contrib/llvm/lib/Support/Unix/Path.inc ============================================================================== --- head/contrib/llvm/lib/Support/Unix/Path.inc Thu Nov 14 12:14:55 2019 (r354706) +++ head/contrib/llvm/lib/Support/Unix/Path.inc Thu Nov 14 15:10:01 2019 (r354707) @@ -39,8 +39,13 @@ #include #include #elif defined(__FreeBSD__) +#include +#if __FreeBSD_version >= 1300057 +#include +#else #include extern char **environ; +#endif #elif defined(__DragonFly__) #include #endif @@ -192,10 +197,17 @@ std::string getMainExecutable(const char *argv0, void // sysctl may not return the desired path if there are multiple hardlinks // to the file. char exe_path[PATH_MAX]; +#if __FreeBSD_version >= 1300057 + if (elf_aux_info(AT_EXECPATH, exe_path, sizeof(exe_path)) == 0) + return exe_path; +#else + // elf_aux_info(AT_EXECPATH, ... is not available on older FreeBSD. Fall + // back to finding the ELF auxiliary vectors after the processes's + // environment. char **p = ::environ; while (*p++ != 0) ; - // ELF auxiliary vectors immediately follow the process's environment. + // Iterate through auxiliary vectors for AT_EXECPATH. for (;;) { switch (*(uintptr_t *)p++) { case AT_EXECPATH: @@ -205,6 +217,7 @@ std::string getMainExecutable(const char *argv0, void } p++; } +#endif // Fall back to argv[0] if auxiliary vectors are not available. if (getprogpath(exe_path, argv0) != NULL) return exe_path; From owner-svn-src-head@freebsd.org Thu Nov 14 16:28:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88B0A1AD17E; Thu, 14 Nov 2019 16:28:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DRjb353Kz4FBr; Thu, 14 Nov 2019 16:28:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41869303F; Thu, 14 Nov 2019 16:28:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAEGS3ar052854; Thu, 14 Nov 2019 16:28:03 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAEGS3QO052853; Thu, 14 Nov 2019 16:28:03 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201911141628.xAEGS3QO052853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 14 Nov 2019 16:28:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354708 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 354708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 16:28:03 -0000 Author: tuexen Date: Thu Nov 14 16:28:02 2019 New Revision: 354708 URL: https://svnweb.freebsd.org/changeset/base/354708 Log: For idle TCP sessions using the CUBIC congestio control, reset ssthresh to the higher of the previous ssthresh or 3/4 of the prior cwnd. Submitted by: Richard Scheffenegger Reviewed by: Cheng Cui Differential Revision: https://reviews.freebsd.org/D18982 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Thu Nov 14 15:10:01 2019 (r354707) +++ head/sys/netinet/cc/cc_cubic.c Thu Nov 14 16:28:02 2019 (r354708) @@ -78,6 +78,7 @@ static int cubic_mod_init(void); static void cubic_post_recovery(struct cc_var *ccv); static void cubic_record_rtt(struct cc_var *ccv); static void cubic_ssthresh_update(struct cc_var *ccv); +static void cubic_after_idle(struct cc_var *ccv); struct cubic { /* Cubic K in fixed point form with CUBIC_SHIFT worth of precision. */ @@ -112,6 +113,7 @@ struct cc_algo cubic_cc_algo = { .conn_init = cubic_conn_init, .mod_init = cubic_mod_init, .post_recovery = cubic_post_recovery, + .after_idle = cubic_after_idle, }; static void @@ -192,7 +194,24 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) } } +/* + * This is a Cubic specific implementation of after_idle. + * - Reset cwnd by calling New Reno implementation of after_idle. + * - Reset t_last_cong. + */ static void +cubic_after_idle(struct cc_var *ccv) +{ + struct cubic *cubic_data; + + cubic_data = ccv->cc_data; + + newreno_cc_algo.after_idle(ccv); + cubic_data->t_last_cong = ticks; +} + + +static void cubic_cb_destroy(struct cc_var *ccv) { free(ccv->cc_data, M_CUBIC); @@ -287,9 +306,6 @@ cubic_conn_init(struct cc_var *ccv) static int cubic_mod_init(void) { - - cubic_cc_algo.after_idle = newreno_cc_algo.after_idle; - return (0); } From owner-svn-src-head@freebsd.org Thu Nov 14 16:32:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E808D1AD468; Thu, 14 Nov 2019 16:32:17 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DRpT2C0Qz4KH8; Thu, 14 Nov 2019 16:32:16 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from mb.fritz.box (ip4d16e760.dynamic.kabel-deutschland.de [77.22.231.96]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id EA4D2721E280D; Thu, 14 Nov 2019 17:32:10 +0100 (CET) From: Michael Tuexen Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Subject: Re: svn commit: r354708 - head/sys/netinet/cc Date: Thu, 14 Nov 2019 17:32:08 +0100 References: <201911141628.xAEGS3QO052853@repo.freebsd.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201911141628.xAEGS3QO052853@repo.freebsd.org> Message-Id: X-Mailer: Apple Mail (2.3601.0.10) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 47DRpT2C0Qz4KH8 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.82 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.82)[-0.822,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:680, ipnet:2001:638::/32, country:DE] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 16:32:18 -0000 > On 14. Nov 2019, at 17:28, Michael Tuexen wrote: >=20 > Author: tuexen > Date: Thu Nov 14 16:28:02 2019 > New Revision: 354708 > URL: https://svnweb.freebsd.org/changeset/base/354708 >=20 > Log: > For idle TCP sessions using the CUBIC congestio control, reset = ssthresh > to the higher of the previous ssthresh or 3/4 of the prior cwnd. I mixed that up. It should have been: This patch addresses a very common case of frequent application stalls, where TCP runs idle and looses the state of the network. According to RFC5681 section 4.1, the cwnd should be reset to the Restart Window. However, cwnd will be re-calculated by cubic as soon as=20= cwnd exceeds ssthresh. Without resetting the cubic epoch, the = calculation is based off the last time an actual congestion event happend - which = may be many tens of thousands of RTTs in the past. This results in excessive jumps of cwnd or integer overflows. The observable result are huge traffic burst and self-inflicted drops. Note: This patch ONLY addresses a very frequent problem case around after-idle. Other problematic scenarios revolve around clients signaling a small=20 receive window, where the session is for a long period limited by that. Once the client decides to suddenly signal a larger receive window, the t_cong_last can still be a very long time in the past, resulting in the same issues as observed before this patch with after-idle = sessions. >=20 > Submitted by: Richard Scheffenegger > Reviewed by: Cheng Cui > Differential Revision: https://reviews.freebsd.org/D18982 https://reviews.freebsd.org/D18954 >=20 > Modified: > head/sys/netinet/cc/cc_cubic.c >=20 > Modified: head/sys/netinet/cc/cc_cubic.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/netinet/cc/cc_cubic.c Thu Nov 14 15:10:01 2019 = (r354707) > +++ head/sys/netinet/cc/cc_cubic.c Thu Nov 14 16:28:02 2019 = (r354708) > @@ -78,6 +78,7 @@ static int cubic_mod_init(void); > static void cubic_post_recovery(struct cc_var *ccv); > static void cubic_record_rtt(struct cc_var *ccv); > static void cubic_ssthresh_update(struct cc_var *ccv); > +static void cubic_after_idle(struct cc_var *ccv); >=20 > struct cubic { > /* Cubic K in fixed point form with CUBIC_SHIFT worth of = precision. */ > @@ -112,6 +113,7 @@ struct cc_algo cubic_cc_algo =3D { > .conn_init =3D cubic_conn_init, > .mod_init =3D cubic_mod_init, > .post_recovery =3D cubic_post_recovery, > + .after_idle =3D cubic_after_idle, > }; >=20 > static void > @@ -192,7 +194,24 @@ cubic_ack_received(struct cc_var *ccv, uint16_t = type) > } > } >=20 > +/* > + * This is a Cubic specific implementation of after_idle. > + * - Reset cwnd by calling New Reno implementation of after_idle. > + * - Reset t_last_cong. > + */ > static void > +cubic_after_idle(struct cc_var *ccv) > +{ > + struct cubic *cubic_data; > + > + cubic_data =3D ccv->cc_data; > + > + newreno_cc_algo.after_idle(ccv); > + cubic_data->t_last_cong =3D ticks; > +} > + > + > +static void > cubic_cb_destroy(struct cc_var *ccv) > { > free(ccv->cc_data, M_CUBIC); > @@ -287,9 +306,6 @@ cubic_conn_init(struct cc_var *ccv) > static int > cubic_mod_init(void) > { > - > - cubic_cc_algo.after_idle =3D newreno_cc_algo.after_idle; > - > return (0); > } >=20 From owner-svn-src-head@freebsd.org Thu Nov 14 16:46:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 180E41AD742; Thu, 14 Nov 2019 16:46:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DS6r646Bz4dCM; Thu, 14 Nov 2019 16:46:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAF253407; Thu, 14 Nov 2019 16:46:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAEGkSCS064198; Thu, 14 Nov 2019 16:46:28 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAEGkSSw064195; Thu, 14 Nov 2019 16:46:28 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201911141646.xAEGkSSw064195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 14 Nov 2019 16:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354709 - in head/sys/arm: arm conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/arm: arm conf X-SVN-Commit-Revision: 354709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 16:46:29 -0000 Author: ian Date: Thu Nov 14 16:46:27 2019 New Revision: 354709 URL: https://svnweb.freebsd.org/changeset/base/354709 Log: Rewrite arm/stack_machdep.c for EABI; add stack(9) support to arm kernels. The old stack_machdep.c code was written for the APCS ABI (aka "oldabi"). When we switched to ARM EABI (back in freebsd 10) this file never got updated, and apparently nobody noticed that until now. The new implementation uses the same stack unwinder code used by the arm implemenation of the db_trace stuff. Modified: head/sys/arm/arm/stack_machdep.c head/sys/arm/conf/std.armv6 head/sys/arm/conf/std.armv7 Modified: head/sys/arm/arm/stack_machdep.c ============================================================================== --- head/sys/arm/arm/stack_machdep.c Thu Nov 14 16:28:02 2019 (r354708) +++ head/sys/arm/arm/stack_machdep.c Thu Nov 14 16:46:27 2019 (r354709) @@ -1,8 +1,7 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Antoine Brodin - * All rights reserved. + * Copyright (c) 2019 Ian Lepore * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,63 +28,64 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include #include - -#include #include #include -/* - * This code makes assumptions about the stack layout. These are correct - * when using APCS (the old ABI), but are no longer true with AAPCS and the - * ARM EABI. There is also an issue with clang and llvm when building for - * APCS where it lays out the stack incorrectly. Because of this we disable - * this when building for ARM EABI or when building with clang. - */ +static void +stack_capture(struct stack *st, struct unwind_state *state) +{ -extern vm_offset_t kernel_vm_end; + stack_zero(st); + while (unwind_stack_one(state, 1) == 0) { + if (stack_put(st, state->registers[PC]) == -1) + break; + } +} -static void -stack_capture(struct stack *st, u_int32_t *frame) +void +stack_save(struct stack *st) { + struct unwind_state state; + uint32_t sp; + + /* Read the stack pointer */ + __asm __volatile("mov %0, sp" : "=&r" (sp)); + + state.registers[FP] = (uint32_t)__builtin_frame_address(0); + state.registers[SP] = sp; + state.registers[LR] = (uint32_t)__builtin_return_address(0); + state.registers[PC] = (uint32_t)stack_save; + + stack_capture(st, &state); } void stack_save_td(struct stack *st, struct thread *td) { - u_int32_t *frame; + struct unwind_state state; - if (TD_IS_SWAPPED(td)) - panic("stack_save_td: swapped"); - if (TD_IS_RUNNING(td)) - panic("stack_save_td: running"); + KASSERT(!TD_IS_SWAPPED(td), ("stack_save_td: swapped")); + KASSERT(!TD_IS_RUNNING(td), ("stack_save_td: running")); - /* - * This register, the frame pointer, is incorrect for the ARM EABI - * as it doesn't have a frame pointer, however it's value is not used - * when building for EABI. - */ - frame = (u_int32_t *)td->td_pcb->pcb_regs.sf_r11; - stack_zero(st); - stack_capture(st, frame); + state.registers[FP] = td->td_pcb->pcb_regs.sf_r11; + state.registers[SP] = td->td_pcb->pcb_regs.sf_sp; + state.registers[LR] = td->td_pcb->pcb_regs.sf_lr; + state.registers[PC] = td->td_pcb->pcb_regs.sf_pc; + + stack_capture(st, &state); } int stack_save_td_running(struct stack *st, struct thread *td) { + if (td == curthread) { + stack_save(st); + return (0); + } return (EOPNOTSUPP); -} - -void -stack_save(struct stack *st) -{ - u_int32_t *frame; - - frame = (u_int32_t *)__builtin_frame_address(0); - stack_zero(st); - stack_capture(st, frame); } Modified: head/sys/arm/conf/std.armv6 ============================================================================== --- head/sys/arm/conf/std.armv6 Thu Nov 14 16:28:02 2019 (r354708) +++ head/sys/arm/conf/std.armv6 Thu Nov 14 16:46:27 2019 (r354709) @@ -34,6 +34,7 @@ options GEOM_LABEL # Provides labelization options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support +options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores Modified: head/sys/arm/conf/std.armv7 ============================================================================== --- head/sys/arm/conf/std.armv7 Thu Nov 14 16:28:02 2019 (r354708) +++ head/sys/arm/conf/std.armv7 Thu Nov 14 16:46:27 2019 (r354709) @@ -34,6 +34,7 @@ options GEOM_LABEL # Provides labelization options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support +options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores From owner-svn-src-head@freebsd.org Thu Nov 14 17:04:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94C4C1ADD4D; Thu, 14 Nov 2019 17:04:19 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47DSWQ3lRZz42Z2; Thu, 14 Nov 2019 17:04:17 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 056713C0199; Thu, 14 Nov 2019 17:04:16 +0000 (UTC) Date: Thu, 14 Nov 2019 17:04:15 +0000 From: Brooks Davis To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354707 - head/contrib/llvm/lib/Support/Unix Message-ID: <20191114170415.GB17978@spindle.one-eyed-alien.net> References: <201911141510.xAEFA1xS002152@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4bRzO86E/ozDv8r1" Content-Disposition: inline In-Reply-To: <201911141510.xAEFA1xS002152@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 47DSWQ3lRZz42Z2 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-6.51 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-3.61)[ip: (-9.45), ipnet: 199.48.128.0/22(-4.71), asn: 36236(-3.85), country: US(-0.05)]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 17:04:19 -0000 --4bRzO86E/ozDv8r1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 14, 2019 at 03:10:01PM +0000, Ed Maste wrote: > Author: emaste > Date: Thu Nov 14 15:10:01 2019 > New Revision: 354707 > URL: https://svnweb.freebsd.org/changeset/base/354707 >=20 > Log: > llvm: use elf_aux_info to get executable's path, if available Thanks! Encoding ABI details (especially ones that are not-quite-valid-C) in code we have any control over is best avoided. -- Brooks --4bRzO86E/ozDv8r1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJdzYkPAAoJEKzQXbSebgfAHP4H/Ag4oV7LnK6ZVrwJfueWKQ5/ dGCSMC2nd91P8YrWhFrfU4pBeOm+TVShrs9kjumHYExftrKCDcZgwGw8yCx9To5C WMuxtE5KUYtVejAZztd8JwT5oaKcfMq8QCnj9maoxOcFyXcD0hDrwhPBfNwxdyE0 MCKpdOt0T5+GLAUQ16EliTvEHyyhRZxCE65a3O64iKsEFNrQ4LRyyIM95mJfFFdk 94et0DUUDNYzUOnGmaDzEuSz/AJGgSevuJXVaMZLMi3sqfSK5isJFhHWpPPRinEB vqdmpqZUX/OKZOVLj0drO3hBKOn+iTdB+3W7lQNi4kETJLPYu337gGXHM/K6VL8= =Y6Uf -----END PGP SIGNATURE----- --4bRzO86E/ozDv8r1-- From owner-svn-src-head@freebsd.org Thu Nov 14 17:04:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 708881ADD55; Thu, 14 Nov 2019 17:04:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DSWS2MD3z42Zm; Thu, 14 Nov 2019 17:04:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31E4C3967; Thu, 14 Nov 2019 17:04:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAEH4KWO076340; Thu, 14 Nov 2019 17:04:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAEH4Kdd076339; Thu, 14 Nov 2019 17:04:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201911141704.xAEH4Kdd076339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 14 Nov 2019 17:04:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354710 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 17:04:20 -0000 Author: ian Date: Thu Nov 14 17:04:19 2019 New Revision: 354710 URL: https://svnweb.freebsd.org/changeset/base/354710 Log: Compile in arm/unwind.c if options STACK is in effect; the new arm stack(9) code now uses unwind.c. Modified: head/sys/conf/files.arm Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Thu Nov 14 16:46:27 2019 (r354709) +++ head/sys/conf/files.arm Thu Nov 14 17:04:19 2019 (r354710) @@ -85,7 +85,7 @@ arm/arm/trap-v4.c optional !armv7 !armv6 arm/arm/trap-v6.c optional armv7 | armv6 arm/arm/uio_machdep.c standard arm/arm/undefined.c standard -arm/arm/unwind.c optional ddb | kdtrace_hooks +arm/arm/unwind.c optional ddb | kdtrace_hooks | stack arm/arm/vm_machdep.c standard arm/arm/vfp.c standard arm/cloudabi32/cloudabi32_sysvec.c optional compat_cloudabi32 From owner-svn-src-head@freebsd.org Thu Nov 14 17:11:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66A8D1AE156; Thu, 14 Nov 2019 17:11:53 +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 47DSh91mrZz4901; Thu, 14 Nov 2019 17:11:53 +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 20AF83A19; Thu, 14 Nov 2019 17:11:53 +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 xAEHBrZo077598; Thu, 14 Nov 2019 17:11:53 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAEHBqet077595; Thu, 14 Nov 2019 17:11:52 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911141711.xAEHBqet077595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 14 Nov 2019 17:11:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354711 - in head/sys: compat/freebsd32 i386/linux kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: compat/freebsd32 i386/linux kern X-SVN-Commit-Revision: 354711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 17:11:53 -0000 Author: brooks Date: Thu Nov 14 17:11:52 2019 New Revision: 354711 URL: https://svnweb.freebsd.org/changeset/base/354711 Log: Tidy syscall declerations. Pointer arguments should be of the form " *..." and not "* ...". No functional change. Reviewed by: kevans Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22373 Modified: head/sys/compat/freebsd32/syscalls.master head/sys/i386/linux/syscalls.master head/sys/kern/syscalls.master Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Thu Nov 14 17:04:19 2019 (r354710) +++ head/sys/compat/freebsd32/syscalls.master Thu Nov 14 17:11:52 2019 (r354711) @@ -552,7 +552,7 @@ ; syscall numbers for FreeBSD 300 AUE_NULL NOPROTO { int modnext(int modid); } 301 AUE_NULL STD { int freebsd32_modstat(int modid, \ - struct module_stat32* stat); } + struct module_stat32 *stat); } 302 AUE_NULL NOPROTO { int modfnext(int modid); } 303 AUE_NULL NOPROTO { int modfind(const char *name); } 304 AUE_MODLOAD NOPROTO { int kldload(const char *file); } @@ -560,7 +560,7 @@ 306 AUE_NULL NOPROTO { int kldfind(const char *file); } 307 AUE_NULL NOPROTO { int kldnext(int fileid); } 308 AUE_NULL STD { int freebsd32_kldstat(int fileid, \ - struct kld32_file_stat* stat); } + struct kld32_file_stat *stat); } 309 AUE_NULL NOPROTO { int kldfirstmod(int fileid); } 310 AUE_GETSID NOPROTO { int getsid(pid_t pid); } 311 AUE_SETRESUID NOPROTO { int setresuid(uid_t ruid, uid_t euid, \ Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Thu Nov 14 17:04:19 2019 (r354710) +++ head/sys/i386/linux/syscalls.master Thu Nov 14 17:11:52 2019 (r354711) @@ -299,7 +299,7 @@ l_uid16_t *euid, l_uid16_t *suid); } 166 AUE_NULL STD { int linux_vm86(void); } 167 AUE_NULL UNIMPL query_module -168 AUE_POLL NOPROTO { int poll(struct pollfd* fds, \ +168 AUE_POLL NOPROTO { int poll(struct pollfd *fds, \ unsigned int nfds, long timeout); } 169 AUE_NULL UNIMPL nfsservctl 170 AUE_SETRESGID STD { int linux_setresgid16(l_gid16_t rgid, \ Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Thu Nov 14 17:04:19 2019 (r354710) +++ head/sys/kern/syscalls.master Thu Nov 14 17:11:52 2019 (r354711) @@ -1472,7 +1472,7 @@ 257 AUE_LIO_LISTIO STD { int lio_listio( int mode, - _Inout_updates_(nent) struct aiocb* const *acb_list, + _Inout_updates_(nent) struct aiocb * const *acb_list, int nent, _In_opt_ struct sigevent *sig ); @@ -1562,7 +1562,7 @@ 301 AUE_NULL STD { int modstat( int modid, - _Out_ struct module_stat* stat + _Out_ struct module_stat *stat ); } 302 AUE_NULL STD { From owner-svn-src-head@freebsd.org Thu Nov 14 18:38:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BECD1B0218; Thu, 14 Nov 2019 18:38:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DVcd0hDLz3Gpp; Thu, 14 Nov 2019 18:38:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC3434A48; Thu, 14 Nov 2019 18:38:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAEIcuhV029149; Thu, 14 Nov 2019 18:38:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAEIcuIn029148; Thu, 14 Nov 2019 18:38:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911141838.xAEIcuIn029148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 14 Nov 2019 18:38:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354712 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 18:38:57 -0000 Author: kevans Date: Thu Nov 14 18:38:56 2019 New Revision: 354712 URL: https://svnweb.freebsd.org/changeset/base/354712 Log: arm64: busdma_bounce: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes For any size that isn't page-aligned, we end up not pre-allocating enough for a single mapping because we truncate the size instead of rounding up to make sure the last bit is accounted for, leaving us one page shy of what we need to fulfill a request. Differential Revision: https://reviews.freebsd.org/D22288 Modified: head/sys/arm64/arm64/busdma_bounce.c Modified: head/sys/arm64/arm64/busdma_bounce.c ============================================================================== --- head/sys/arm64/arm64/busdma_bounce.c Thu Nov 14 17:11:52 2019 (r354711) +++ head/sys/arm64/arm64/busdma_bounce.c Thu Nov 14 18:38:56 2019 (r354712) @@ -216,7 +216,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si if (ptoa(bz->total_bpages) < maxsize) { int pages; - pages = atop(maxsize) - bz->total_bpages; + pages = atop(round_page(maxsize)) - bz->total_bpages; /* Add pages to our bounce pool */ if (alloc_bounce_pages(newtag, pages) < pages) From owner-svn-src-head@freebsd.org Thu Nov 14 19:56:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C5E41B1C05; Thu, 14 Nov 2019 19:56:43 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DXLM3jB7z4cqd; Thu, 14 Nov 2019 19:56:43 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 634B058F7; Thu, 14 Nov 2019 19:56:43 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAEJuhSL077033; Thu, 14 Nov 2019 19:56:43 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAEJuh1A077032; Thu, 14 Nov 2019 19:56:43 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201911141956.xAEJuh1A077032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Thu, 14 Nov 2019 19:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354713 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354713 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 19:56:43 -0000 Author: bdragon Date: Thu Nov 14 19:56:42 2019 New Revision: 354713 URL: https://svnweb.freebsd.org/changeset/base/354713 Log: [PowerPC64] Fix broken kernel modules due to LLD 9+ TOC optimization LLD9 introduced a TOC optimization that isn't compatible with kernel dynamic linker causing panic when loading kernel modules (pf, linuxkpi etc.) This patch disables TOC optimization when building kernel modules. Submitted by: Alfredo Dal'Ava Junior Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D22317 Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Thu Nov 14 18:38:56 2019 (r354712) +++ head/sys/conf/kmod.mk Thu Nov 14 19:56:42 2019 (r354713) @@ -169,6 +169,10 @@ CFLAGS+= -funwind-tables .if ${MACHINE_CPUARCH} == powerpc CFLAGS+= -mlongcall -fno-omit-frame-pointer +.if ${LINKER_TYPE} == "lld" +# TOC optimization in LLD (9.0) currently breaks kernel modules, so disable it +LDFLAGS+= --no-toc-optimize +.endif .endif .if ${MACHINE_CPUARCH} == mips From owner-svn-src-head@freebsd.org Thu Nov 14 21:58:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF73E1B42E2; Thu, 14 Nov 2019 21:58:42 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Db363Gt9z4g5r; Thu, 14 Nov 2019 21:58:42 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 464C86E76; Thu, 14 Nov 2019 21:58:42 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAELwgBe048361; Thu, 14 Nov 2019 21:58:42 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAELwemi048354; Thu, 14 Nov 2019 21:58:40 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911142158.xAELwemi048354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 14 Nov 2019 21:58:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354714 - in head/sys: arm64/arm64 arm64/conf arm64/include conf X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: arm64/arm64 arm64/conf arm64/include conf X-SVN-Commit-Revision: 354714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 21:58:42 -0000 Author: jhibbits Date: Thu Nov 14 21:58:40 2019 New Revision: 354714 URL: https://svnweb.freebsd.org/changeset/base/354714 Log: Boot arm64 kernel using booti command from U-boot. Summary: Boot arm64 kernel using booti command from U-boot. booti can relocate initrd image into higher ram addresses, therefore align the initrd load address to 1GiB and create VA = PA map for it. Create L2 pagetable entries to copy the initrd image into KVA. (parts of the code in https://reviews.freebsd.org/D13861 was referred and used as appropriate) Submitted by: Siddharth Tuli Reviewed by: manu Sponsored by: Juniper Networks, Inc Differential Revision: https://reviews.freebsd.org/D22255 Added: head/sys/arm64/arm64/machdep_boot.c (contents, props changed) Modified: head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/machdep.c head/sys/arm64/conf/GENERIC head/sys/arm64/include/machdep.h head/sys/conf/Makefile.arm64 head/sys/conf/files.arm64 head/sys/conf/options.arm64 Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Thu Nov 14 19:56:42 2019 (r354713) +++ head/sys/arm64/arm64/locore.S Thu Nov 14 21:58:40 2019 (r354714) @@ -57,6 +57,29 @@ .text .globl _start _start: +#ifdef LINUX_BOOT_ABI + /* + * See Documentation/arm64/booting.txt in the Linux kernel. + * This is needed to boot using U-Boot's booti command. + */ + +#define BOOTI_MAGIC 0x644d5241 +#define UBOOT_IMAGE_OFFSET 0 +#define UBOOT_IMAGE_SIZE _end - _start +#define UBOOT_IMAGE_FLAGS 0 + + b 1f /* Executable code */ + .long 0 /* Executable code */ + .quad UBOOT_IMAGE_OFFSET /* Image load offset, little endian */ + .quad UBOOT_IMAGE_SIZE /* Effective Image size, little endian */ + .quad UBOOT_IMAGE_FLAGS /* kernel flags, little endian */ + .quad 0 /* reserved */ + .quad 0 /* reserved */ + .quad 0 /* reserved */ + .long BOOTI_MAGIC /* Magic number, little endian, "ARM\x64" */ + .long 0 /* reserved (used for PE COFF offset) */ +1: +#endif /* Drop to EL1 */ bl drop_to_el1 @@ -351,15 +374,25 @@ create_pagetables: * Build the TTBR1 maps. */ - /* Find the size of the kernel */ mov x6, #(KERNBASE) - /* Find modulep - begin */ - sub x8, x0, x6 + and x7, x0, x6 + cmp x7, x6 + b.eq 1f + /* booted from U-Boot */ + ldr x7, .Lend + sub x8, x7, x6 /* kernel size = end - begin */ + b 2f +1: + /* booted from FreeBSD loader */ + sub x8, x0, x6 /* size = modulep - begin */ /* Add two 2MiB pages for the module data and round up */ ldr x7, =(3 * L2_SIZE - 1) add x8, x8, x7 +2: /* Get the number of l2 pages to allocate, rounded down */ lsr x10, x8, #(L2_SHIFT) + /* Add 1 to get actual count */ + add x10, x10, #1 /* Create the kernel space L2 table */ mov x6, x26 Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Thu Nov 14 19:56:42 2019 (r354713) +++ head/sys/arm64/arm64/machdep.c Thu Nov 14 21:58:40 2019 (r354714) @@ -963,6 +963,16 @@ try_load_dtb(caddr_t kmdp) vm_offset_t dtbp; dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); + +#if defined(FDT_DTB_STATIC) + /* + * In case the device tree blob was not retrieved (from metadata) try + * to use the statically embedded one. + */ + if (dtbp == 0) + dtbp = (vm_offset_t)&fdt_static_dtb; +#endif + if (dtbp == (vm_offset_t)NULL) { printf("ERROR loading DTB\n"); return; @@ -1066,6 +1076,26 @@ cache_setup(void) } } +static vm_offset_t +freebsd_parse_boot_param(struct arm64_bootparams *abp) +{ + vm_offset_t lastaddr; + void *kmdp; + static char *loader_envp; + + preload_metadata = (caddr_t)(uintptr_t)(abp->modulep); + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + return (0); + + boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); + loader_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + init_static_kenv(loader_envp, 0); + lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); + + return (lastaddr); +} + void initarm(struct arm64_bootparams *abp) { @@ -1081,26 +1111,31 @@ initarm(struct arm64_bootparams *abp) caddr_t kmdp; bool valid; - /* Set the module data location */ - preload_metadata = (caddr_t)(uintptr_t)(abp->modulep); + if ((abp->modulep & VM_MIN_KERNEL_ADDRESS) == + VM_MIN_KERNEL_ADDRESS) + /* Booted from loader. */ + lastaddr = freebsd_parse_boot_param(abp); +#ifdef LINUX_BOOT_ABI + else + /* Booted from U-Boot. */ + lastaddr = linux_parse_boot_param(abp); +#endif /* Find the kernel address */ kmdp = preload_search_by_type("elf kernel"); if (kmdp == NULL) kmdp = preload_search_by_type("elf64 kernel"); - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0); link_elf_ireloc(kmdp); #ifdef FDT try_load_dtb(kmdp); +#ifdef LINUX_BOOT_ABI + parse_bootargs(&lastaddr, abp); #endif +#endif efi_systbl_phys = MD_FETCH(kmdp, MODINFOMD_FW_HANDLE, vm_paddr_t); - - /* Find the address to start allocating from */ - lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); /* Load the physical memory ranges */ efihdr = (struct efi_map_header *)preload_search_info(kmdp, Added: head/sys/arm64/arm64/machdep_boot.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/arm64/machdep_boot.c Thu Nov 14 21:58:40 2019 (r354714) @@ -0,0 +1,330 @@ +/*- + * Copyright (c) 2019 Juniper Networks, Inc + * Copyright (c) 2004 Olivier Houchard + * Copyright (c) 1994-1998 Mark Brinicombe. + * Copyright (c) 1994 Brini. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef FDT +#include +#include +#include +#include +#include +#include +#include +#endif + +#ifdef FDT +#define PRELOAD_PUSH_VALUE(type, value) do { \ + *(type *)(preload_ptr + preload_size) = (value); \ + preload_size += sizeof(type); \ +} while (0) + +#define PRELOAD_PUSH_STRING(str) do { \ + uint32_t ssize; \ + ssize = strlen(str) + 1; \ + PRELOAD_PUSH_VALUE(uint32_t, ssize); \ + strcpy((char*)(preload_ptr + preload_size), str); \ + preload_size += ssize; \ + preload_size = roundup(preload_size, sizeof(u_long)); \ +} while (0) + +static int build_l2_block_pagetable(vm_offset_t, uint64_t, + struct arm64_bootparams *); + +#define INITRD_START "linux,initrd-start" +#define INITRD_END "linux,initrd-end" +#define KENV_SIZE 2048 + +static char static_kenv[KENV_SIZE]; +static caddr_t metadata_endptr; +#endif + +#define PMAP_BOOTSTRAP_PAGES 2 + +extern vm_offset_t end; + +/* + * Fake up a boot descriptor table + */ +static vm_offset_t +fake_preload_metadata(void *dtb_ptr, size_t dtb_size, + struct arm64_bootparams *abp) +{ + vm_offset_t lastaddr; + static char fake_preload[256]; + caddr_t preload_ptr; + size_t preload_size; + + preload_ptr = (caddr_t)&fake_preload[0]; + preload_size = 0; + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_NAME); + PRELOAD_PUSH_STRING("kernel"); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_TYPE); + PRELOAD_PUSH_STRING("elf kernel"); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_ADDR); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); + PRELOAD_PUSH_VALUE(uint64_t, VM_MIN_KERNEL_ADDRESS); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_SIZE); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(size_t)); + PRELOAD_PUSH_VALUE(uint64_t, (size_t)(&end - VM_MIN_KERNEL_ADDRESS)); + + lastaddr = (vm_offset_t)&end; + lastaddr = roundup(lastaddr, sizeof(vm_offset_t)); + +#ifdef FDT + if (dtb_ptr != NULL && + (build_l2_block_pagetable(lastaddr, dtb_size, abp) == 0)) { + /* Copy DTB to KVA space and insert it into module chain. */ + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_METADATA | MODINFOMD_DTBP); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(uint64_t)); + PRELOAD_PUSH_VALUE(uint64_t, (uint64_t)lastaddr); + memmove((void *)lastaddr, dtb_ptr, dtb_size); + lastaddr += dtb_size; + } + + lastaddr = roundup(lastaddr, sizeof(vm_offset_t)); + /* End marker */ + metadata_endptr = preload_ptr; +#endif + + PRELOAD_PUSH_VALUE(uint32_t, 0); + PRELOAD_PUSH_VALUE(uint32_t, 0); + + preload_metadata = fake_preload; + + return (lastaddr); +} + +/* + * Support booting from U-Boot's booti command. If modulep (register x0) + * is a valid address then it is a pointer to FDT. + */ +vm_offset_t +linux_parse_boot_param(struct arm64_bootparams *abp) +{ + uint32_t dtb_size = 0; + struct fdt_header *dtb_ptr = NULL; + +#if defined(FDT) && !defined(FDT_DTB_STATIC) + /* Test if modulep (x0) point to valid DTB. */ + dtb_ptr = (struct fdt_header *)abp->modulep; + if (dtb_ptr && fdt_check_header(dtb_ptr) == 0) + dtb_size = fdt_totalsize(dtb_ptr); +#endif + return (fake_preload_metadata(dtb_ptr, dtb_size, abp)); +} + +#ifdef FDT +/* + * Builds count 2 MiB page table entries. + * During startup, locore.S maps kernel memory in L2 page table. + * Create space to copy size bytes following the kernel memory. + * See build_l2_block_pagetable in locore.S + */ +static int +build_l2_block_pagetable(vm_offset_t lastaddr, uint64_t size, + struct arm64_bootparams *abp) +{ + vm_offset_t l2_block_entry, *l2pt_entry; + int32_t count_2mib; + volatile uint64_t output_bits; + + /* Number of 2MiB pages */ + count_2mib = ((lastaddr - KERNBASE) + size) >> L2_SHIFT; + + /* All the memory must not cross a 1GiB boundary */ + if (count_2mib >= Ln_ENTRIES) { + printf("%s: Adding %#lx bytes makes kernel cross 1GiB boundary\n", + __FUNCTION__, size); + return EINVAL; + } + + /* size fits within the last 2MiB page table entry */ + if (((lastaddr - KERNBASE) >> L2_SHIFT) == count_2mib) + return 0; + + /* Build the L2 block entry */ + l2_block_entry = ATTR_IDX(VM_MEMATTR_WRITE_BACK) | L2_BLOCK | ATTR_AF; +#ifdef SMP + l2_block_entry |= ATTR_SH(ATTR_SH_IS); +#endif + /* Number of 2MiB pages mapped to kernel */ + count_2mib = (lastaddr - KERNBASE) >> L2_SHIFT; + + /* Go to last L2 page table entry. Each pagetable entry is 8 bytes */ + l2pt_entry = (vm_offset_t*)((abp->kern_l1pt - PAGE_SIZE) + + (count_2mib << 3)); + output_bits = (*l2pt_entry++ >> L2_SHIFT) + 1; + + /* Build count 2MiB page table entries */ + for (count_2mib = size >> L2_SHIFT; count_2mib >= 0; + l2pt_entry++, output_bits++, count_2mib--) + *l2pt_entry = (output_bits << L2_SHIFT) | l2_block_entry; + + return 0; +} + +/* + * Align start addr to 1GiB boundary and build L1 page table entry for it. + * See build_l1_block_pagetable in locore.S + */ +static void +build_l1_block_pagetable(vm_offset_t start, struct arm64_bootparams *abp) +{ + vm_offset_t l1_table_idx, l1_block_entry, phy_addr, *l1_table_entry; + + /* Find the table index */ + l1_table_idx = (start >> L1_SHIFT) & Ln_ADDR_MASK; + + /* Build the L1 block entry */ + l1_block_entry = ATTR_nG | ATTR_IDX(VM_MEMATTR_UNCACHEABLE) | + L1_BLOCK | ATTR_AF; +#ifdef SMP + l1_block_entry |= ATTR_SH(ATTR_SH_IS); +#endif + + /* Set the physical address */ + phy_addr = l1_block_entry | (l1_table_idx << L1_SHIFT); + + /* Index of L1 pagetable. Each pagetable entry is 8 bytes */ + l1_table_entry = (vm_offset_t*)((abp->kern_l0pt + PAGE_SIZE) + + (l1_table_idx << 3)); + *l1_table_entry = phy_addr; +} + +/* + * Copy the initrd image passed using U-Boot's booti command into + * KVA space. + */ +static void +linux_load_initrd(vm_offset_t *lastaddr, struct arm64_bootparams *abp) +{ + phandle_t chosen; + uint64_t initrd_start = 0, initrd_end = 0; + uint64_t initrd_size; + caddr_t preload_ptr; + size_t preload_size = 0; + + if ((chosen = OF_finddevice("/chosen")) == -1) + return; + + if (!(OF_hasprop(chosen, INITRD_START) && + OF_hasprop(chosen, INITRD_END))) + return; + + if ((OF_getprop(chosen, INITRD_START, &initrd_start, sizeof(uint64_t))) > 0) + initrd_start = fdt64_to_cpu(initrd_start); + + if ((OF_getprop(chosen, INITRD_END, &initrd_end, sizeof(uint64_t))) > 0) + initrd_end = fdt64_to_cpu(initrd_end); + + if ((initrd_size = (initrd_end - initrd_start)) <= 0) + return; + + if (build_l2_block_pagetable(*lastaddr, initrd_size, abp) != 0) + return; + + build_l1_block_pagetable(initrd_start, abp); + + /* Copy the initrd image to virtual address space */ + memmove((void*)(*lastaddr), (void*)initrd_start, initrd_size); + + preload_ptr = metadata_endptr; + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_NAME); + PRELOAD_PUSH_STRING("initrd"); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_TYPE); + PRELOAD_PUSH_STRING("md_image"); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_SIZE); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(uint64_t)); + PRELOAD_PUSH_VALUE(uint64_t, initrd_size); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_ADDR); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); + PRELOAD_PUSH_VALUE(uint64_t, *lastaddr); + + *lastaddr += initrd_size; + *lastaddr = roundup(*lastaddr, sizeof(vm_offset_t)); + + /* End marker */ + metadata_endptr = preload_ptr; + PRELOAD_PUSH_VALUE(uint32_t, 0); + PRELOAD_PUSH_VALUE(uint32_t, 0); +} + +/* + * Parse initrd image arguments, bootargs passed in FDT from U-Boot. + */ +void +parse_bootargs(vm_offset_t *lastaddr, struct arm64_bootparams *abp) +{ + + /* + * Fake metadata is used to support boot from U-Boot. Process bootargs, + * initrd args from FDT blob set in fake medadata. + */ + if (metadata_endptr == NULL) + return; + + /* Booted from U-Boot */ + linux_load_initrd(lastaddr, abp); + + /* + * L2 PTEs map addresses in order of kernel, dtb, initrd image. + * Add L2 pages at the end for pmap to bootstrap L2, L3 PTEs, etc. + */ + build_l2_block_pagetable(*lastaddr, + (PMAP_BOOTSTRAP_PAGES * L2_SIZE) - 1, abp); + + init_static_kenv(static_kenv, sizeof(static_kenv)); + ofw_parse_bootargs(); +} +#endif Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Thu Nov 14 19:56:42 2019 (r354713) +++ head/sys/arm64/conf/GENERIC Thu Nov 14 21:58:40 2019 (r354714) @@ -77,6 +77,7 @@ options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.en options RCTL # Resource limits options SMP options INTRNG +options LINUX_BOOT_ABI # Boot using booti command from U-Boot # Debugging support. Always need this: options KDB # Enable kernel debugger support. Modified: head/sys/arm64/include/machdep.h ============================================================================== --- head/sys/arm64/include/machdep.h Thu Nov 14 19:56:42 2019 (r354713) +++ head/sys/arm64/include/machdep.h Thu Nov 14 21:58:40 2019 (r354714) @@ -48,5 +48,9 @@ extern enum arm64_bus arm64_bus_method; void dbg_init(void); void initarm(struct arm64_bootparams *); extern void (*pagezero)(void *); +vm_offset_t linux_parse_boot_param(struct arm64_bootparams *); +#ifdef LINUX_BOOT_ABI +void parse_bootargs(vm_offset_t *, struct arm64_bootparams *); +#endif #endif /* _MACHINE_MACHDEP_H_ */ Modified: head/sys/conf/Makefile.arm64 ============================================================================== --- head/sys/conf/Makefile.arm64 Thu Nov 14 19:56:42 2019 (r354713) +++ head/sys/conf/Makefile.arm64 Thu Nov 14 21:58:40 2019 (r354714) @@ -31,6 +31,18 @@ INCLUDES+= -I$S/contrib/libfdt CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer .endif +SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader \ + ${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \ + --dynamic-linker /red/herring \ + -o ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o + +SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// $(LDSCRIPT)\ + >ldscript.$M.noheader;\ + ${SYSTEM_LD_}; \ + ${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \ + ${KERNEL_KO}.bin; \ + rm ${FULLKERNEL}.noheader + %BEFORE_DEPEND %OBJS Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Nov 14 19:56:42 2019 (r354713) +++ head/sys/conf/files.arm64 Thu Nov 14 21:58:40 2019 (r354714) @@ -153,6 +153,7 @@ arm64/arm64/identcpu.c standard arm64/arm64/in_cksum.c optional inet | inet6 arm64/arm64/locore.S standard no-obj arm64/arm64/machdep.c standard +arm64/arm64/machdep_boot.c optional linux_boot_abi arm64/arm64/mem.c standard arm64/arm64/memcpy.S standard arm64/arm64/memmove.S standard Modified: head/sys/conf/options.arm64 ============================================================================== --- head/sys/conf/options.arm64 Thu Nov 14 19:56:42 2019 (r354713) +++ head/sys/conf/options.arm64 Thu Nov 14 21:58:40 2019 (r354714) @@ -2,6 +2,7 @@ ARM64 opt_global.h INTRNG opt_global.h +LINUX_BOOT_ABI opt_global.h SOCDEV_PA opt_global.h SOCDEV_VA opt_global.h THUNDERX_PASS_1_1_ERRATA opt_global.h From owner-svn-src-head@freebsd.org Thu Nov 14 22:24:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2B661B4BB8 for ; Thu, 14 Nov 2019 22:24:35 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Dbcz0vxwz4LHZ for ; Thu, 14 Nov 2019 22:24:34 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1573770273; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=R50JNA0AQIhRUOJSH2xjRj3QF6VvHkMnf+d14SMdKi0lmDHquxxpJzCmviiE3F10g/KiG3LWKjFsO OikcU66npe/4GMA0ApKHwXGQt+QNFfzXIyLA2gX7iFeFN2xzg6+YEh6aRf23ePfMxMSYiPLTKdFi4J 4lVxlWhOTOKzLBbcekZsD0fG9m/xryFpnIKIQM/TIFSZFoELCw2o+3fQzsaxDxPGh8B8t4q/Dqf1mR VeMlZQJwXDATobKLp44mZw4zCssgRYzmL0p408L5PgX1//ahCvgemMYEmPqEK++VY8Feb98skppBBQ jTJqUAzU9pbXYURSoih0b/tBM+iXM3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=2Ow2cqfmCAWG3hiFLe8yYjRq9XCoGvNWEO9F4qOGmt4=; b=WqWOcas7CsPzU4A/AeeckUxhm2z8ItdjIeXZwlxve+K3tdGTrEy014XV37tZINZBA581ypb65NfdN nVrFNxpdUMCBG+Km/xiIunEhPrET5F8XPkAHNUU/GGsNgHKylqrWwFgO3Abp+XItCb1rDVk3lOAKHC EVHMrzcDVACJDoeICDgRo/00ehUG8upLHCWq/bIQTF0DWG7zDppDljOhjnnw+xCQbLTz/3dzMn6t2m GvMUg8hnu7ovMZfAC1pPtqyQwYbeE6uFh1v/3QVnRDzkA0Oym1GEYxs13J/T1EjHebGkSHqCAK/Mex M1ATNIRSy3pg5Ucr4ImCeTwcmqABWnA== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=2Ow2cqfmCAWG3hiFLe8yYjRq9XCoGvNWEO9F4qOGmt4=; b=fgvHcK6X7FW1aH6u123kPhsy35cfgZRx8TGnjOOT7K9O8JQ/EEJuyjsylJvL9PZeWtdTHoPh/VG8T QcZB8VgfJ1aiaQ6Cd9djOYJuxmNRig6kypgaWN84HX+WLOauh0ra0nf+DxUk3llJuQxVQvdYUKXbod ouZaKOChPfqI1TMvaEbLYo6NBsjTmx90HKjNYRYsqriXFIU35dtY1OVLt9PJ3PfgWT9XqY85PuihEb sl8qVhj9Wxm6eGRLo1QtCSSFN1NtOObGsqUiYIqk0iAFsEaQBikPmYFenbVIwoU72kBrsDoEo1H3y0 lv5dviuWw3tpZG8hB/pUU6aDLecMZDQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: 86ba1a06-072d-11ea-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 86ba1a06-072d-11ea-829e-79a40d15cccd; Thu, 14 Nov 2019 22:24:31 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xAEMOULj028956; Thu, 14 Nov 2019 15:24:30 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <9e8c5e79c48f3f751723e96e5b3fb1b03a51c9c3.camel@freebsd.org> Subject: Re: svn commit: r354714 - in head/sys: arm64/arm64 arm64/conf arm64/include conf From: Ian Lepore To: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 14 Nov 2019 15:24:30 -0700 In-Reply-To: <201911142158.xAELwemi048354@repo.freebsd.org> References: <201911142158.xAELwemi048354@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47Dbcz0vxwz4LHZ X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.90)[-0.899,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 22:24:35 -0000 On Thu, 2019-11-14 at 21:58 +0000, Justin Hibbits wrote: > Author: jhibbits > Date: Thu Nov 14 21:58:40 2019 > New Revision: 354714 > URL: https://svnweb.freebsd.org/changeset/base/354714 > > Log: > Boot arm64 kernel using booti command from U-boot. > > [...] > > Added: head/sys/arm64/arm64/machdep_boot.c > ===================================================================== > ========= > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/arm64/arm64/machdep_boot.c Thu Nov 14 21:58:40 > 2019 (r354714) > @@ -0,0 +1,330 @@ > +/*- > + * Copyright (c) 2019 Juniper Networks, Inc > + * Copyright (c) 2004 Olivier Houchard > + * Copyright (c) 1994-1998 Mark Brinicombe. > + * Copyright (c) 1994 Brini. > + * All rights reserved. > + * > I think this copyright list should be pared down to just Olivier (maybe?) and Juniper. The Brini lines are from when this code was part of machdep.c that was imported from netbsd in the 2004 timeframe. That import did not include any of the code that got copied into this new arm64 file. The code to handle embedded dtb and parsing bootargs in various ABI formats was all added much more recently, 2012-2014 time frame. Warner should probably add himself to the copyrights though, I'm pretty sure he's the one who wrote the various flavors of bootargs parsers. -- Ian From owner-svn-src-head@freebsd.org Thu Nov 14 22:50:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21A541B526C; Thu, 14 Nov 2019 22:50:56 +0000 (UTC) (envelope-from cognet@ci0.org) Received: from kanar.ci0.org (kanar.ci0.org [IPv6:2001:bc8:35e6::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "sd-123398", Issuer "sd-123398" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DcCM0pdZz4C5n; Thu, 14 Nov 2019 22:50:54 +0000 (UTC) (envelope-from cognet@ci0.org) Received: from kanar.ci0.org (localhost [127.0.0.1]) by kanar.ci0.org (8.15.2/8.15.2) with ESMTPS id xAEMoikx084595 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 14 Nov 2019 23:50:44 +0100 (CET) (envelope-from cognet@ci0.org) Received: (from doginou@localhost) by kanar.ci0.org (8.15.2/8.15.2/Submit) id xAEMoigq084594; Thu, 14 Nov 2019 23:50:44 +0100 (CET) (envelope-from cognet@ci0.org) X-Authentication-Warning: kanar.ci0.org: doginou set sender to cognet@ci0.org using -f Date: Thu, 14 Nov 2019 23:50:44 +0100 From: Olivier Houchard To: Ian Lepore Cc: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354714 - in head/sys: arm64/arm64 arm64/conf arm64/include conf Message-ID: <20191114225044.GA84576@ci0.org> References: <201911142158.xAELwemi048354@repo.freebsd.org> <9e8c5e79c48f3f751723e96e5b3fb1b03a51c9c3.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9e8c5e79c48f3f751723e96e5b3fb1b03a51c9c3.camel@freebsd.org> User-Agent: Mutt/1.8.0 (2017-02-23) X-Rspamd-Queue-Id: 47DcCM0pdZz4C5n X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cognet@ci0.org has no SPF policy when checking 2001:bc8:35e6::1) smtp.mailfrom=cognet@ci0.org X-Spamd-Result: default: False [0.16 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.19)[-0.192,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.65)[-0.653,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; DMARC_NA(0.00)[ci0.org]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE(0.10)[ipnet: 2001:bc8::/32(0.40), asn: 12876(0.12), country: FR(-0.00)]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:12876, ipnet:2001:bc8::/32, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 22:50:56 -0000 On Thu, Nov 14, 2019 at 03:24:30PM -0700, Ian Lepore wrote: > On Thu, 2019-11-14 at 21:58 +0000, Justin Hibbits wrote: > > Author: jhibbits > > Date: Thu Nov 14 21:58:40 2019 > > New Revision: 354714 > > URL: https://svnweb.freebsd.org/changeset/base/354714 > > > > Log: > > Boot arm64 kernel using booti command from U-boot. > > > > [...] > > > > Added: head/sys/arm64/arm64/machdep_boot.c > > ===================================================================== > > ========= > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/arm64/arm64/machdep_boot.c Thu Nov 14 21:58:40 > > 2019 (r354714) > > @@ -0,0 +1,330 @@ > > +/*- > > + * Copyright (c) 2019 Juniper Networks, Inc > > + * Copyright (c) 2004 Olivier Houchard > > + * Copyright (c) 1994-1998 Mark Brinicombe. > > + * Copyright (c) 1994 Brini. > > + * All rights reserved. > > + * > > > > I think this copyright list should be pared down to just Olivier > (maybe?) and Juniper. The Brini lines are from when this code was part > of machdep.c that was imported from netbsd in the 2004 timeframe. That > import did not include any of the code that got copied into this new > arm64 file. The code to handle embedded dtb and parsing bootargs in > various ABI formats was all added much more recently, 2012-2014 time > frame. > > Warner should probably add himself to the copyrights though, I'm pretty > sure he's the one who wrote the various flavors of bootargs parsers. > There's actually still code of mine in this, well some descendant of it, all the fake metadata business, but I'm amazed it's still used today, especially on arm64, it was there to provide minimal infos back when we had no real bootloader on arm. Warner's copyright definitively belongs here. Regards, Olivier From owner-svn-src-head@freebsd.org Thu Nov 14 23:31:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6BEE1B6094; Thu, 14 Nov 2019 23:31:21 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Dd614SJTz4HFN; Thu, 14 Nov 2019 23:31:21 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B5C17F5A; Thu, 14 Nov 2019 23:31:21 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAENVLb8004517; Thu, 14 Nov 2019 23:31:21 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAENVKEU004510; Thu, 14 Nov 2019 23:31:20 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201911142331.xAENVKEU004510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Thu, 14 Nov 2019 23:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354715 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/vmware/pvscsi sys/i386/conf sys/modules/vmware sys/modules/vmware/pvscsi X-SVN-Group: head X-SVN-Commit-Author: jpaetzel X-SVN-Commit-Paths: in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/vmware/pvscsi sys/i386/conf sys/modules/vmware sys/modules/vmware/pvscsi X-SVN-Commit-Revision: 354715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 23:31:21 -0000 Author: jpaetzel Date: Thu Nov 14 23:31:20 2019 New Revision: 354715 URL: https://svnweb.freebsd.org/changeset/base/354715 Log: Add the pvscsi driver to the tree. This driver allows to usage of the paravirt SCSI controller in VMware products like ESXi. The pvscsi driver provides a substantial performance improvement in block devices versus the emulated mpt and mps SCSI/SAS controllers. Error handling in this driver has not been extensively tested yet. Submitted by: vbhakta@vmware.com Relnotes: yes Sponsored by: VMware, Panzura Differential Revision: D18613 Added: head/share/man/man4/pvscsi.4 (contents, props changed) head/sys/dev/vmware/pvscsi/ head/sys/dev/vmware/pvscsi/LICENSE (contents, props changed) head/sys/dev/vmware/pvscsi/pvscsi.c (contents, props changed) head/sys/dev/vmware/pvscsi/pvscsi.h (contents, props changed) head/sys/modules/vmware/pvscsi/ head/sys/modules/vmware/pvscsi/Makefile (contents, props changed) Modified: head/sys/amd64/conf/GENERIC head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/conf/GENERIC head/sys/modules/vmware/Makefile Added: head/share/man/man4/pvscsi.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/pvscsi.4 Thu Nov 14 23:31:20 2019 (r354715) @@ -0,0 +1,74 @@ +.\" Copyright (c) 2018 VMware, Inc. +.\" +.\" SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) +.\" +.\" $FreeBSD$ +.Dd December 5, 2018 +.Dt PVSCSI 4 +.Os +.Sh NAME +.Nm pvscsi +.Nd VMware Paravirtual SCSI Controller +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device pci" +.Cd "device scbus" +.Cd "device pvscsi" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +pvscsi_load="YES" +.Ed +.Pp +The following tunables are settable from the +.Xr loader 8 : +.Bl -ohang +.It Va hw.pvscsi.request_ring_pages +controls how many pages are allocated for the device request ring. +A non-positive value will cause the driver to choose the value based on device +capabilities. +A non-zero value will use that many number of pages up to a maximum of 32. +The default setting is 0. +.It Va hw.pvscsi.max_queue_depth +controls the queue size for the adapter. +A non-positive value will cause the driver to choose the value based on number +of request ring pages. +A non-zero value will set the queue size up to a maximum allowed by the number +of request ring pages. +Default is 0. +.It Va hw.pvscsi.use_msg +setting to nonzero value enables the use of the PVSCSI message queue allowing +for disk hot-add and remove without manual rescan needed. +Default is 1. +.It Va hw.pvscsi.use_msi +setting to nonzero value enables the use of MSI interrupts. +Default is 1. +.It Va hw.pvscsi.use_msix +setting to nonzero value enables the use of MSI-X interrupts. +Default is 1. +.It Va hw.pvscsi.use_req_call_threshold +setting to nonzero value enables the request call threshold functionality. +TODO. +Default is 1. +.El +.Sh DESCRIPTION +The +.Nm +driver provides support for the VMware Paravirtual SCSI Controller (PVSCSI) in +virtual machines by VMware. +.Sh SEE ALSO +.Xr cam 4 , +.Xr da 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0 . +.Sh AUTHORS +.An Vishal Bhakta Aq Mt vbhakta@vmware.com . Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Thu Nov 14 21:58:40 2019 (r354714) +++ head/sys/amd64/conf/GENERIC Thu Nov 14 23:31:20 2019 (r354715) @@ -152,6 +152,7 @@ device sym # NCR/Symbios Logic device trm # Tekram DC395U/UW/F DC315U adapters device isci # Intel C600 SAS controller device ocs_fc # Emulex FC adapters +device pvscsi # VMware PVSCSI # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Thu Nov 14 21:58:40 2019 (r354714) +++ head/sys/conf/files.amd64 Thu Nov 14 23:31:20 2019 (r354715) @@ -345,6 +345,7 @@ dev/vmware/vmci/vmci_kernel_if.c optional vmci dev/vmware/vmci/vmci_qpair.c optional vmci dev/vmware/vmci/vmci_queue_pair.c optional vmci dev/vmware/vmci/vmci_resource.c optional vmci +dev/vmware/pvscsi/pvscsi.c optional pvscsi dev/vmd/vmd.c optional vmd dev/vmd/vmd_bus.c optional vmd_bus dev/wbwd/wbwd.c optional wbwd Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Thu Nov 14 21:58:40 2019 (r354714) +++ head/sys/conf/files.i386 Thu Nov 14 23:31:20 2019 (r354715) @@ -162,6 +162,7 @@ dev/vmware/vmci/vmci_kernel_if.c optional vmci dev/vmware/vmci/vmci_qpair.c optional vmci dev/vmware/vmci/vmci_queue_pair.c optional vmci dev/vmware/vmci/vmci_resource.c optional vmci +dev/vmware/pvscsi/pvscsi.c optional pvscsi dev/acpi_support/acpi_wmi_if.m standard dev/wbwd/wbwd.c optional wbwd i386/acpica/acpi_machdep.c optional acpi Added: head/sys/dev/vmware/pvscsi/LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/vmware/pvscsi/LICENSE Thu Nov 14 23:31:20 2019 (r354715) @@ -0,0 +1,51 @@ +$FreeBSD$ + +These files are provided under a dual BSD-2 Clause/GPLv2 license. When +using or redistributing this file, you may do so under either license. + +BSD-2 Clause License + +Copyright (c) 2018 VMware, Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +GPL License Summary + +Copyright (c) 2018 VMware, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as +published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +The full GNU General Public License is included in this distribution +in the file called LICENSE.GPL. Added: head/sys/dev/vmware/pvscsi/pvscsi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/vmware/pvscsi/pvscsi.c Thu Nov 14 23:31:20 2019 (r354715) @@ -0,0 +1,1804 @@ +/*- + * Copyright (c) 2018 VMware, Inc. + * + * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "pvscsi.h" + +#define PVSCSI_DEFAULT_NUM_PAGES_REQ_RING 8 +#define PVSCSI_SENSE_LENGTH 256 + +MALLOC_DECLARE(M_PVSCSI); +MALLOC_DEFINE(M_PVSCSI, "pvscsi", "PVSCSI memory"); + +#ifdef PVSCSI_DEBUG_LOGGING +#define DEBUG_PRINTF(level, dev, fmt, ...) \ + do { \ + if (pvscsi_log_level >= (level)) { \ + device_printf((dev), (fmt), ##__VA_ARGS__); \ + } \ + } while(0) +#else +#define DEBUG_PRINTF(level, dev, fmt, ...) +#endif /* PVSCSI_DEBUG_LOGGING */ + +#define ccb_pvscsi_hcb spriv_ptr0 +#define ccb_pvscsi_sc spriv_ptr1 + +struct pvscsi_softc; +static timeout_t pvscsi_timeout; +struct pvscsi_hcb; +struct pvscsi_dma; + +static inline uint32_t pvscsi_reg_read(struct pvscsi_softc *sc, + uint32_t offset); +static inline void pvscsi_reg_write(struct pvscsi_softc *sc, uint32_t offset, + uint32_t val); +static inline uint32_t pvscsi_read_intr_status(struct pvscsi_softc *sc); +static inline void pvscsi_write_intr_status(struct pvscsi_softc *sc, + uint32_t val); +static inline void pvscsi_intr_enable(struct pvscsi_softc *sc); +static inline void pvscsi_intr_disable(struct pvscsi_softc *sc); +static void pvscsi_kick_io(struct pvscsi_softc *sc, uint8_t cdb0); +static void pvscsi_write_cmd(struct pvscsi_softc *sc, uint32_t cmd, void *data, + uint32_t len); +static uint32_t pvscsi_get_max_targets(struct pvscsi_softc *sc); +static int pvscsi_setup_req_call(struct pvscsi_softc *sc, uint32_t enable); +static void pvscsi_setup_rings(struct pvscsi_softc *sc); +static void pvscsi_setup_msg_ring(struct pvscsi_softc *sc); +static int pvscsi_hw_supports_msg(struct pvscsi_softc *sc); + +static void pvscsi_timeout(void *arg); +static void pvscsi_freeze(struct pvscsi_softc *sc); +static void pvscsi_adapter_reset(struct pvscsi_softc *sc); +static void pvscsi_bus_reset(struct pvscsi_softc *sc); +static void pvscsi_device_reset(struct pvscsi_softc *sc, uint32_t target); +static void pvscsi_abort(struct pvscsi_softc *sc, uint32_t target, + union ccb *ccb); + +static void pvscsi_process_completion(struct pvscsi_softc *sc, + struct pvscsi_ring_cmp_desc *e); +static void pvscsi_process_cmp_ring(struct pvscsi_softc *sc); +static void pvscsi_process_msg(struct pvscsi_softc *sc, + struct pvscsi_ring_msg_desc *e); +static void pvscsi_process_msg_ring(struct pvscsi_softc *sc); + +static void pvscsi_intr_locked(struct pvscsi_softc *sc); +static void pvscsi_intr(void *xsc); +static void pvscsi_poll(struct cam_sim *sim); + +static void pvscsi_execute_ccb(void *arg, bus_dma_segment_t *segs, int nseg, + int error); +static void pvscsi_action(struct cam_sim *sim, union ccb *ccb); + +static inline uint64_t pvscsi_hcb_to_context(struct pvscsi_softc *sc, + struct pvscsi_hcb *hcb); +static inline struct pvscsi_hcb* pvscsi_context_to_hcb(struct pvscsi_softc *sc, + uint64_t context); +static struct pvscsi_hcb * pvscsi_hcb_get(struct pvscsi_softc *sc); +static void pvscsi_hcb_put(struct pvscsi_softc *sc, struct pvscsi_hcb *hcb); + +static void pvscsi_dma_cb(void *arg, bus_dma_segment_t *segs, int nseg, + int error); +static void pvscsi_dma_free(struct pvscsi_softc *sc, struct pvscsi_dma *dma); +static int pvscsi_dma_alloc(struct pvscsi_softc *sc, struct pvscsi_dma *dma, + bus_size_t size, bus_size_t alignment); +static int pvscsi_dma_alloc_ppns(struct pvscsi_softc *sc, + struct pvscsi_dma *dma, uint64_t *ppn_list, uint32_t num_pages); +static void pvscsi_dma_free_per_hcb(struct pvscsi_softc *sc, + uint32_t hcbs_allocated); +static int pvscsi_dma_alloc_per_hcb(struct pvscsi_softc *sc); +static void pvscsi_free_rings(struct pvscsi_softc *sc); +static int pvscsi_allocate_rings(struct pvscsi_softc *sc); +static void pvscsi_free_interrupts(struct pvscsi_softc *sc); +static int pvscsi_setup_interrupts(struct pvscsi_softc *sc); +static void pvscsi_free_all(struct pvscsi_softc *sc); + +static int pvscsi_attach(device_t dev); +static int pvscsi_detach(device_t dev); +static int pvscsi_probe(device_t dev); +static int pvscsi_shutdown(device_t dev); +static int pvscsi_get_tunable(struct pvscsi_softc *sc, char *name, int value); + + +#ifdef PVSCSI_DEBUG_LOGGING +static int pvscsi_log_level = 0; +static SYSCTL_NODE(_hw, OID_AUTO, pvscsi, CTLFLAG_RD, 0, + "PVSCSI driver parameters"); +SYSCTL_INT(_hw_pvscsi, OID_AUTO, log_level, CTLFLAG_RWTUN, &pvscsi_log_level, + 0, "PVSCSI debug log level"); +#endif + +static int pvscsi_request_ring_pages = 0; +TUNABLE_INT("hw.pvscsi.request_ring_pages", &pvscsi_request_ring_pages); + +static int pvscsi_use_msg = 1; +TUNABLE_INT("hw.pvscsi.use_msg", &pvscsi_use_msg); + +static int pvscsi_use_msi = 1; +TUNABLE_INT("hw.pvscsi.use_msi", &pvscsi_use_msi); + +static int pvscsi_use_msix = 1; +TUNABLE_INT("hw.pvscsi.use_msix", &pvscsi_use_msix); + +static int pvscsi_use_req_call_threshold = 1; +TUNABLE_INT("hw.pvscsi.use_req_call_threshold", &pvscsi_use_req_call_threshold); + +static int pvscsi_max_queue_depth = 0; +TUNABLE_INT("hw.pvscsi.max_queue_depth", &pvscsi_max_queue_depth); + + +struct pvscsi_sg_list { + struct pvscsi_sg_element sge[PVSCSI_MAX_SG_ENTRIES_PER_SEGMENT]; +}; + + +#define PVSCSI_ABORT_TIMEOUT 2 +#define PVSCSI_RESET_TIMEOUT 10 + +#define PVSCSI_HCB_NONE 0 +#define PVSCSI_HCB_ABORT 1 +#define PVSCSI_HCB_DEVICE_RESET 2 +#define PVSCSI_HCB_BUS_RESET 3 + +struct pvscsi_hcb { + union ccb *ccb; + struct pvscsi_ring_req_desc *e; + int recovery; + SLIST_ENTRY(pvscsi_hcb) links; + + struct callout callout; + bus_dmamap_t dma_map; + void *sense_buffer; + bus_addr_t sense_buffer_paddr; + struct pvscsi_sg_list *sg_list; + bus_addr_t sg_list_paddr; +}; + +struct pvscsi_dma +{ + bus_dma_tag_t tag; + bus_dmamap_t map; + void *vaddr; + bus_addr_t paddr; + bus_size_t size; +}; + +struct pvscsi_softc { + device_t dev; + struct mtx lock; + struct cam_sim *sim; + struct cam_path *bus_path; + int frozen; + struct pvscsi_rings_state *rings_state; + struct pvscsi_ring_req_desc *req_ring; + struct pvscsi_ring_cmp_desc *cmp_ring; + struct pvscsi_ring_msg_desc *msg_ring; + uint32_t hcb_cnt; + struct pvscsi_hcb *hcbs; + SLIST_HEAD(, pvscsi_hcb) free_list; + bus_dma_tag_t parent_dmat; + bus_dma_tag_t buffer_dmat; + + bool use_msg; + uint32_t max_targets; + int mm_rid; + struct resource *mm_res; + int irq_id; + struct resource *irq_res; + void *irq_handler; + int use_req_call_threshold; + int use_msi_or_msix; + + uint64_t rings_state_ppn; + uint32_t req_ring_num_pages; + uint64_t req_ring_ppn[PVSCSI_MAX_NUM_PAGES_REQ_RING]; + uint32_t cmp_ring_num_pages; + uint64_t cmp_ring_ppn[PVSCSI_MAX_NUM_PAGES_CMP_RING]; + uint32_t msg_ring_num_pages; + uint64_t msg_ring_ppn[PVSCSI_MAX_NUM_PAGES_MSG_RING]; + + struct pvscsi_dma rings_state_dma; + struct pvscsi_dma req_ring_dma; + struct pvscsi_dma cmp_ring_dma; + struct pvscsi_dma msg_ring_dma; + + struct pvscsi_dma sg_list_dma; + struct pvscsi_dma sense_buffer_dma; +}; + +static int pvscsi_get_tunable(struct pvscsi_softc *sc, char *name, int value) +{ + char cfg[64]; + + snprintf(cfg, sizeof(cfg), "hw.pvscsi.%d.%s", device_get_unit(sc->dev), + name); + TUNABLE_INT_FETCH(cfg, &value); + + return (value); +} + +static void +pvscsi_freeze(struct pvscsi_softc *sc) +{ + + if (!sc->frozen) { + xpt_freeze_simq(sc->sim, 1); + sc->frozen = 1; + } +} + +static inline uint32_t +pvscsi_reg_read(struct pvscsi_softc *sc, uint32_t offset) +{ + + return (bus_read_4(sc->mm_res, offset)); +} + +static inline void +pvscsi_reg_write(struct pvscsi_softc *sc, uint32_t offset, uint32_t val) +{ + + bus_write_4(sc->mm_res, offset, val); +} + +static inline uint32_t +pvscsi_read_intr_status(struct pvscsi_softc *sc) +{ + + return (pvscsi_reg_read(sc, PVSCSI_REG_OFFSET_INTR_STATUS)); +} + +static inline void +pvscsi_write_intr_status(struct pvscsi_softc *sc, uint32_t val) +{ + + pvscsi_reg_write(sc, PVSCSI_REG_OFFSET_INTR_STATUS, val); +} + +static inline void +pvscsi_intr_enable(struct pvscsi_softc *sc) +{ + uint32_t mask; + + mask = PVSCSI_INTR_CMPL_MASK; + if (sc->use_msg) { + mask |= PVSCSI_INTR_MSG_MASK; + } + + pvscsi_reg_write(sc, PVSCSI_REG_OFFSET_INTR_MASK, mask); +} + +static inline void +pvscsi_intr_disable(struct pvscsi_softc *sc) +{ + + pvscsi_reg_write(sc, PVSCSI_REG_OFFSET_INTR_MASK, 0); +} + +static void +pvscsi_kick_io(struct pvscsi_softc *sc, uint8_t cdb0) +{ + struct pvscsi_rings_state *s; + + if (cdb0 == READ_6 || cdb0 == READ_10 || + cdb0 == READ_12 || cdb0 == READ_16 || + cdb0 == WRITE_6 || cdb0 == WRITE_10 || + cdb0 == WRITE_12 || cdb0 == WRITE_16) { + s = sc->rings_state; + + if (!sc->use_req_call_threshold || + (s->req_prod_idx - s->req_cons_idx) >= + s->req_call_threshold) { + pvscsi_reg_write(sc, PVSCSI_REG_OFFSET_KICK_RW_IO, 0); + } + } else { + pvscsi_reg_write(sc, PVSCSI_REG_OFFSET_KICK_NON_RW_IO, 0); + } +} + +static void +pvscsi_write_cmd(struct pvscsi_softc *sc, uint32_t cmd, void *data, + uint32_t len) +{ + uint32_t *data_ptr; + int i; + + KASSERT(len % sizeof(uint32_t) == 0, + ("command size not a multiple of 4")); + + data_ptr = data; + len /= sizeof(uint32_t); + + pvscsi_reg_write(sc, PVSCSI_REG_OFFSET_COMMAND, cmd); + for (i = 0; i < len; ++i) { + pvscsi_reg_write(sc, PVSCSI_REG_OFFSET_COMMAND_DATA, + data_ptr[i]); + } +} + +static inline uint64_t pvscsi_hcb_to_context(struct pvscsi_softc *sc, + struct pvscsi_hcb *hcb) +{ + + /* Offset by 1 because context must not be 0 */ + return (hcb - sc->hcbs + 1); +} + +static inline struct pvscsi_hcb* pvscsi_context_to_hcb(struct pvscsi_softc *sc, + uint64_t context) +{ + + return (sc->hcbs + (context - 1)); +} + +static struct pvscsi_hcb * +pvscsi_hcb_get(struct pvscsi_softc *sc) +{ + struct pvscsi_hcb *hcb; + + mtx_assert(&sc->lock, MA_OWNED); + + hcb = SLIST_FIRST(&sc->free_list); + if (hcb) { + SLIST_REMOVE_HEAD(&sc->free_list, links); + } + + return (hcb); +} + +static void +pvscsi_hcb_put(struct pvscsi_softc *sc, struct pvscsi_hcb *hcb) +{ + + mtx_assert(&sc->lock, MA_OWNED); + hcb->ccb = NULL; + hcb->e = NULL; + hcb->recovery = PVSCSI_HCB_NONE; + SLIST_INSERT_HEAD(&sc->free_list, hcb, links); +} + +static uint32_t +pvscsi_get_max_targets(struct pvscsi_softc *sc) +{ + uint32_t max_targets; + + pvscsi_write_cmd(sc, PVSCSI_CMD_GET_MAX_TARGETS, NULL, 0); + + max_targets = pvscsi_reg_read(sc, PVSCSI_REG_OFFSET_COMMAND_STATUS); + + if (max_targets == ~0) { + max_targets = 16; + } + + return (max_targets); +} + +static int pvscsi_setup_req_call(struct pvscsi_softc *sc, uint32_t enable) +{ + uint32_t status; + struct pvscsi_cmd_desc_setup_req_call cmd; + + if (!pvscsi_get_tunable(sc, "pvscsi_use_req_call_threshold", + pvscsi_use_req_call_threshold)) { + return (0); + } + + pvscsi_reg_write(sc, PVSCSI_REG_OFFSET_COMMAND, + PVSCSI_CMD_SETUP_REQCALLTHRESHOLD); + status = pvscsi_reg_read(sc, PVSCSI_REG_OFFSET_COMMAND_STATUS); + + if (status != -1) { + bzero(&cmd, sizeof(cmd)); + cmd.enable = enable; + pvscsi_write_cmd(sc, PVSCSI_CMD_SETUP_REQCALLTHRESHOLD, + &cmd, sizeof(cmd)); + status = pvscsi_reg_read(sc, PVSCSI_REG_OFFSET_COMMAND_STATUS); + + return (status != 0); + } else { + return (0); + } +} + +static void +pvscsi_dma_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + bus_addr_t *dest; + + KASSERT(nseg == 1, ("more than one segment")); + + dest = arg; + + if (!error) { + *dest = segs->ds_addr; + } +} + +static void +pvscsi_dma_free(struct pvscsi_softc *sc, struct pvscsi_dma *dma) +{ + + if (dma->tag != NULL) { + if (dma->paddr != 0) { + bus_dmamap_unload(dma->tag, dma->map); + } + + if (dma->vaddr != NULL) { + bus_dmamem_free(dma->tag, dma->vaddr, dma->map); + } + + bus_dma_tag_destroy(dma->tag); + } + + bzero(dma, sizeof(*dma)); +} + +static int +pvscsi_dma_alloc(struct pvscsi_softc *sc, struct pvscsi_dma *dma, + bus_size_t size, bus_size_t alignment) +{ + int error; + + bzero(dma, sizeof(*dma)); + + error = bus_dma_tag_create(sc->parent_dmat, alignment, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, + BUS_DMA_ALLOCNOW, NULL, NULL, &dma->tag); + if (error) { + device_printf(sc->dev, "error creating dma tag, error %d\n", + error); + goto fail; + } + + error = bus_dmamem_alloc(dma->tag, &dma->vaddr, + BUS_DMA_NOWAIT | BUS_DMA_ZERO, &dma->map); + if (error) { + device_printf(sc->dev, "error allocating dma mem, error %d\n", + error); + goto fail; + } + + error = bus_dmamap_load(dma->tag, dma->map, dma->vaddr, size, + pvscsi_dma_cb, &dma->paddr, BUS_DMA_NOWAIT); + if (error) { + device_printf(sc->dev, "error mapping dma mam, error %d\n", + error); + goto fail; + } + + dma->size = size; + +fail: + if (error) { + pvscsi_dma_free(sc, dma); + } + return (error); +} + +static int +pvscsi_dma_alloc_ppns(struct pvscsi_softc *sc, struct pvscsi_dma *dma, + uint64_t *ppn_list, uint32_t num_pages) +{ + int error; + uint32_t i; + uint64_t ppn; + + error = pvscsi_dma_alloc(sc, dma, num_pages * PAGE_SIZE, PAGE_SIZE); + if (error) { + device_printf(sc->dev, "Error allocating pages, error %d\n", + error); + return (error); + } + + ppn = dma->paddr >> PAGE_SHIFT; + for (i = 0; i < num_pages; i++) { + ppn_list[i] = ppn + i; + } + + return (0); +} + +static void +pvscsi_dma_free_per_hcb(struct pvscsi_softc *sc, uint32_t hcbs_allocated) +{ + int i; + int lock_owned; + struct pvscsi_hcb *hcb; + + lock_owned = mtx_owned(&sc->lock); + + if (lock_owned) { + mtx_unlock(&sc->lock); + } + for (i = 0; i < hcbs_allocated; ++i) { + hcb = sc->hcbs + i; + callout_drain(&hcb->callout); + }; + if (lock_owned) { + mtx_lock(&sc->lock); + } + + for (i = 0; i < hcbs_allocated; ++i) { + hcb = sc->hcbs + i; + bus_dmamap_destroy(sc->buffer_dmat, hcb->dma_map); + }; + + pvscsi_dma_free(sc, &sc->sense_buffer_dma); + pvscsi_dma_free(sc, &sc->sg_list_dma); +} + +static int +pvscsi_dma_alloc_per_hcb(struct pvscsi_softc *sc) +{ + int i; + int error; + struct pvscsi_hcb *hcb; + + i = 0; + + error = pvscsi_dma_alloc(sc, &sc->sg_list_dma, + sizeof(struct pvscsi_sg_list) * sc->hcb_cnt, 1); + if (error) { + device_printf(sc->dev, + "Error allocation sg list DMA memory, error %d\n", error); + goto fail; + } + + error = pvscsi_dma_alloc(sc, &sc->sense_buffer_dma, + PVSCSI_SENSE_LENGTH * sc->hcb_cnt, 1); + if (error) { + device_printf(sc->dev, + "Error allocation sg list DMA memory, error %d\n", error); + goto fail; + } + + for (i = 0; i < sc->hcb_cnt; ++i) { + hcb = sc->hcbs + i; + + error = bus_dmamap_create(sc->buffer_dmat, 0, &hcb->dma_map); + if (error) { + device_printf(sc->dev, + "Error creating dma map for hcb %d, error %d\n", + i, error); + goto fail; + } + + hcb->sense_buffer = + (void *)((caddr_t)sc->sense_buffer_dma.vaddr + + PVSCSI_SENSE_LENGTH * i); + hcb->sense_buffer_paddr = + sc->sense_buffer_dma.paddr + PVSCSI_SENSE_LENGTH * i; + + hcb->sg_list = + (struct pvscsi_sg_list *)((caddr_t)sc->sg_list_dma.vaddr + + sizeof(struct pvscsi_sg_list) * i); + hcb->sg_list_paddr = + sc->sg_list_dma.paddr + sizeof(struct pvscsi_sg_list) * i; + + callout_init_mtx(&hcb->callout, &sc->lock, 0); + } + + SLIST_INIT(&sc->free_list); + for (i = (sc->hcb_cnt - 1); i >= 0; --i) { + hcb = sc->hcbs + i; + SLIST_INSERT_HEAD(&sc->free_list, hcb, links); + } + +fail: + if (error) { + pvscsi_dma_free_per_hcb(sc, i); + } + + return (error); +} + +static void +pvscsi_free_rings(struct pvscsi_softc *sc) +{ + + pvscsi_dma_free(sc, &sc->rings_state_dma); + pvscsi_dma_free(sc, &sc->req_ring_dma); + pvscsi_dma_free(sc, &sc->cmp_ring_dma); + if (sc->use_msg) { + pvscsi_dma_free(sc, &sc->msg_ring_dma); + } +} + +static int +pvscsi_allocate_rings(struct pvscsi_softc *sc) +{ + int error; + + error = pvscsi_dma_alloc_ppns(sc, &sc->rings_state_dma, + &sc->rings_state_ppn, 1); + if (error) { + device_printf(sc->dev, + "Error allocating rings state, error = %d\n", error); + goto fail; + } + sc->rings_state = sc->rings_state_dma.vaddr; + + error = pvscsi_dma_alloc_ppns(sc, &sc->req_ring_dma, sc->req_ring_ppn, + sc->req_ring_num_pages); + if (error) { + device_printf(sc->dev, + "Error allocating req ring pages, error = %d\n", error); + goto fail; + } + sc->req_ring = sc->req_ring_dma.vaddr; + + error = pvscsi_dma_alloc_ppns(sc, &sc->cmp_ring_dma, sc->cmp_ring_ppn, + sc->cmp_ring_num_pages); + if (error) { + device_printf(sc->dev, + "Error allocating cmp ring pages, error = %d\n", error); + goto fail; + } + sc->cmp_ring = sc->cmp_ring_dma.vaddr; + + sc->msg_ring = NULL; + if (sc->use_msg) { + error = pvscsi_dma_alloc_ppns(sc, &sc->msg_ring_dma, + sc->msg_ring_ppn, sc->msg_ring_num_pages); + if (error) { + device_printf(sc->dev, + "Error allocating cmp ring pages, error = %d\n", + error); + goto fail; + } + sc->msg_ring = sc->msg_ring_dma.vaddr; + } + + DEBUG_PRINTF(1, sc->dev, "rings_state: %p\n", sc->rings_state); + DEBUG_PRINTF(1, sc->dev, "req_ring: %p - %u pages\n", sc->req_ring, + sc->req_ring_num_pages); + DEBUG_PRINTF(1, sc->dev, "cmp_ring: %p - %u pages\n", sc->cmp_ring, + sc->cmp_ring_num_pages); + DEBUG_PRINTF(1, sc->dev, "msg_ring: %p - %u pages\n", sc->msg_ring, + sc->msg_ring_num_pages); + +fail: + if (error) { + pvscsi_free_rings(sc); + } + return (error); +} + +static void +pvscsi_setup_rings(struct pvscsi_softc *sc) +{ + struct pvscsi_cmd_desc_setup_rings cmd; + uint32_t i; + + bzero(&cmd, sizeof(cmd)); + + cmd.rings_state_ppn = sc->rings_state_ppn; + + cmd.req_ring_num_pages = sc->req_ring_num_pages; + for (i = 0; i < sc->req_ring_num_pages; ++i) { + cmd.req_ring_ppns[i] = sc->req_ring_ppn[i]; + } + + cmd.cmp_ring_num_pages = sc->cmp_ring_num_pages; + for (i = 0; i < sc->cmp_ring_num_pages; ++i) { + cmd.cmp_ring_ppns[i] = sc->cmp_ring_ppn[i]; + } + + pvscsi_write_cmd(sc, PVSCSI_CMD_SETUP_RINGS, &cmd, sizeof(cmd)); +} + +static int +pvscsi_hw_supports_msg(struct pvscsi_softc *sc) +{ + uint32_t status; + + pvscsi_reg_write(sc, PVSCSI_REG_OFFSET_COMMAND, + PVSCSI_CMD_SETUP_MSG_RING); + status = pvscsi_reg_read(sc, PVSCSI_REG_OFFSET_COMMAND_STATUS); + + return (status != -1); +} + +static void +pvscsi_setup_msg_ring(struct pvscsi_softc *sc) +{ + struct pvscsi_cmd_desc_setup_msg_ring cmd; + uint32_t i; + + KASSERT(sc->use_msg, ("msg is not being used")); + + bzero(&cmd, sizeof(cmd)); + + cmd.num_pages = sc->msg_ring_num_pages; + for (i = 0; i < sc->msg_ring_num_pages; ++i) { + cmd.ring_ppns[i] = sc->msg_ring_ppn[i]; + } + + pvscsi_write_cmd(sc, PVSCSI_CMD_SETUP_MSG_RING, &cmd, sizeof(cmd)); +} + +static void +pvscsi_adapter_reset(struct pvscsi_softc *sc) +{ + uint32_t val; + + device_printf(sc->dev, "Adapter Reset\n"); + + pvscsi_write_cmd(sc, PVSCSI_CMD_ADAPTER_RESET, NULL, 0); + val = pvscsi_read_intr_status(sc); + + DEBUG_PRINTF(2, sc->dev, "adapter reset done: %u\n", val); +} + +static void +pvscsi_bus_reset(struct pvscsi_softc *sc) +{ + + device_printf(sc->dev, "Bus Reset\n"); + + pvscsi_write_cmd(sc, PVSCSI_CMD_RESET_BUS, NULL, 0); + pvscsi_process_cmp_ring(sc); + + DEBUG_PRINTF(2, sc->dev, "bus reset done\n"); +} + +static void +pvscsi_device_reset(struct pvscsi_softc *sc, uint32_t target) +{ + struct pvscsi_cmd_desc_reset_device cmd; + + memset(&cmd, 0, sizeof(cmd)); + + cmd.target = target; + + device_printf(sc->dev, "Device reset for target %u\n", target); + + pvscsi_write_cmd(sc, PVSCSI_CMD_RESET_DEVICE, &cmd, sizeof cmd); + pvscsi_process_cmp_ring(sc); + + DEBUG_PRINTF(2, sc->dev, "device reset done\n"); +} + +static void +pvscsi_abort(struct pvscsi_softc *sc, uint32_t target, union ccb *ccb) +{ + struct pvscsi_cmd_desc_abort_cmd cmd; + struct pvscsi_hcb *hcb; + uint64_t context; + + pvscsi_process_cmp_ring(sc); + + hcb = ccb->ccb_h.ccb_pvscsi_hcb; + + if (hcb != NULL) { + context = pvscsi_hcb_to_context(sc, hcb); + + memset(&cmd, 0, sizeof cmd); + cmd.target = target; + cmd.context = context; + + device_printf(sc->dev, "Abort for target %u context %llx\n", + target, (unsigned long long)context); + + pvscsi_write_cmd(sc, PVSCSI_CMD_ABORT_CMD, &cmd, sizeof(cmd)); + pvscsi_process_cmp_ring(sc); + + DEBUG_PRINTF(2, sc->dev, "abort done\n"); + } else { + DEBUG_PRINTF(1, sc->dev, + "Target %u ccb %p not found for abort\n", target, ccb); + } +} + +static int +pvscsi_probe(device_t dev) +{ + + if (pci_get_vendor(dev) == PCI_VENDOR_ID_VMWARE && + pci_get_device(dev) == PCI_DEVICE_ID_VMWARE_PVSCSI) { + device_set_desc(dev, "VMware Paravirtual SCSI Controller"); + return (BUS_PROBE_DEFAULT); + } + return (ENXIO); +} + +static int +pvscsi_shutdown(device_t dev) +{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Nov 15 01:07:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6F841B7D2E; Fri, 15 Nov 2019 01:07:20 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DgDl3p2Bz4NP2; Fri, 15 Nov 2019 01:07:19 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pg1-x52d.google.com with SMTP id f19so4884813pgk.11; Thu, 14 Nov 2019 17:07:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=03mC4k1+/GOyMWLNHc0jfrtl1YIftyFr+2Rhv4AhuWY=; b=cpAhfmyFskhB6T4Xtc8Zu5rWsb7ymS1xlDEiSPQ/sbSSQNIJxztAGYRYZM6TEEwA8o 5yMZiS+ku8lF/4LebCqUJbFblUY1WhsUIIO9OOVmoVjtjzyW5UpHu8xeN4S5bq/SmwXd J19hPW3dMHtYClb7BK2M5PMQL1fwBwdMFpD7ZYXnA4u2vRCpwErQfOwDiTpBRjOXgbyI /AAK2HW3z318wbDsfvMnbm+5tL6WrzZES1pQNQyV962LKI5Bust6Qj1TOJAexccoVxjy 6sA2gm7SgrzB/YwWsxxYrRpQBv7BTovnjQF0d+usY8OZ7z26O7y4RT4ILLFUvkUETUIC hy9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=03mC4k1+/GOyMWLNHc0jfrtl1YIftyFr+2Rhv4AhuWY=; b=VEDvr9jUJQhWMMGWh5ECdLz+upvyHbeYihh0SHqjFZH4H5arDS9eRb4761GJRHPY7u ueD0/ye2jPnYAK4DWs0VPDGX/Ubcj0S3diBYsHpB+cqQm+6VaNCwgD8y/Pz1tmWmnzIJ 2rhFcne9jCTKp75DcLpXkABuFurOTQ2cOLxh5g88zRTAniFy/h8mxA1WDLLPTDko8ftB TZtdHfrzq80EfATOMOwKITNJuG59AaC3s1W2/Or3C20fe1Z0bK39agBWz4A84/66V52Z prArIMzU2ADOYG7qCPznAXIZHIMUpekG/3NggovtrgR5MqRu3HmmKW40k0XKNtUMWgoY vmYA== X-Gm-Message-State: APjAAAWYyryPHxe7AloHjPn3Nqsgmke7I4uRwZclK2KEbNew7fG0L4fT WqBKuAzApuZ9D/x5lv03/a6Xe9mu X-Google-Smtp-Source: APXvYqxct7sEJLEWgcD6v6NpHiGn+JfnagkCY/GL87h3WwQS9ELYR+vm5ti7+2OiKf5qFvn/SuYn9g== X-Received: by 2002:a17:90a:8401:: with SMTP id j1mr6079600pjn.39.1573780037162; Thu, 14 Nov 2019 17:07:17 -0800 (PST) Received: from [192.168.1.110] (180-150-68-130.b49644.syd.nbn.aussiebb.net. [180.150.68.130]) by smtp.gmail.com with ESMTPSA id x190sm9335597pfc.89.2019.11.14.17.07.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Nov 2019 17:07:16 -0800 (PST) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r354708 - head/sys/netinet/cc To: Michael Tuexen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911141628.xAEGS3QO052853@repo.freebsd.org> From: Kubilay Kocak Message-ID: <0a9e49e9-b81a-3367-2d7d-6d748e83f36d@FreeBSD.org> Date: Fri, 15 Nov 2019 12:07:13 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Thunderbird/71.0 MIME-Version: 1.0 In-Reply-To: <201911141628.xAEGS3QO052853@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47DgDl3p2Bz4NP2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=cpAhfmyF; dmarc=none; spf=pass (mx1.freebsd.org: domain of koobsfreebsd@gmail.com designates 2607:f8b0:4864:20::52d as permitted sender) smtp.mailfrom=koobsfreebsd@gmail.com X-Spamd-Result: default: False [-4.84 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[koobs@FreeBSD.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; FORGED_SENDER(0.30)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; IP_SCORE(-2.64)[ip: (-8.86), ipnet: 2607:f8b0::/32(-2.32), asn: 15169(-1.99), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FROM_NEQ_ENVFROM(0.00)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; TAGGED_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_IN_DNSWL_NONE(0.00)[d.2.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 01:07:20 -0000 On 15/11/2019 3:28 am, Michael Tuexen wrote: > Author: tuexen > Date: Thu Nov 14 16:28:02 2019 > New Revision: 354708 > URL: https://svnweb.freebsd.org/changeset/base/354708 > > Log: > For idle TCP sessions using the CUBIC congestio control, reset ssthresh > to the higher of the previous ssthresh or 3/4 of the prior cwnd. > > Submitted by: Richard Scheffenegger > Reviewed by: Cheng Cui > Differential Revision: https://reviews.freebsd.org/D18982 > > Modified: > head/sys/netinet/cc/cc_cubic.c Are stable/12,11 affected by this too? > Modified: head/sys/netinet/cc/cc_cubic.c > ============================================================================== > --- head/sys/netinet/cc/cc_cubic.c Thu Nov 14 15:10:01 2019 (r354707) > +++ head/sys/netinet/cc/cc_cubic.c Thu Nov 14 16:28:02 2019 (r354708) > @@ -78,6 +78,7 @@ static int cubic_mod_init(void); > static void cubic_post_recovery(struct cc_var *ccv); > static void cubic_record_rtt(struct cc_var *ccv); > static void cubic_ssthresh_update(struct cc_var *ccv); > +static void cubic_after_idle(struct cc_var *ccv); > > struct cubic { > /* Cubic K in fixed point form with CUBIC_SHIFT worth of precision. */ > @@ -112,6 +113,7 @@ struct cc_algo cubic_cc_algo = { > .conn_init = cubic_conn_init, > .mod_init = cubic_mod_init, > .post_recovery = cubic_post_recovery, > + .after_idle = cubic_after_idle, > }; > > static void > @@ -192,7 +194,24 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) > } > } > > +/* > + * This is a Cubic specific implementation of after_idle. > + * - Reset cwnd by calling New Reno implementation of after_idle. > + * - Reset t_last_cong. > + */ > static void > +cubic_after_idle(struct cc_var *ccv) > +{ > + struct cubic *cubic_data; > + > + cubic_data = ccv->cc_data; > + > + newreno_cc_algo.after_idle(ccv); > + cubic_data->t_last_cong = ticks; > +} > + > + > +static void > cubic_cb_destroy(struct cc_var *ccv) > { > free(ccv->cc_data, M_CUBIC); > @@ -287,9 +306,6 @@ cubic_conn_init(struct cc_var *ccv) > static int > cubic_mod_init(void) > { > - > - cubic_cc_algo.after_idle = newreno_cc_algo.after_idle; > - > return (0); > } > > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Fri Nov 15 01:07:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74DE41B7DC2; Fri, 15 Nov 2019 01:07:40 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DgF82bfZz4P0x; Fri, 15 Nov 2019 01:07:40 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21C2190C8; Fri, 15 Nov 2019 01:07:40 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAF17dCs060769; Fri, 15 Nov 2019 01:07:39 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAF17dPO060768; Fri, 15 Nov 2019 01:07:39 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201911150107.xAF17dPO060768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Fri, 15 Nov 2019 01:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354716 - head/sys/dev/vmware/pvscsi X-SVN-Group: head X-SVN-Commit-Author: jpaetzel X-SVN-Commit-Paths: head/sys/dev/vmware/pvscsi X-SVN-Commit-Revision: 354716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 01:07:40 -0000 Author: jpaetzel Date: Fri Nov 15 01:07:39 2019 New Revision: 354716 URL: https://svnweb.freebsd.org/changeset/base/354716 Log: Fix build with GCC Fix suggested by: jhb, scottl Sponsored by: Panzura Modified: head/sys/dev/vmware/pvscsi/pvscsi.c Modified: head/sys/dev/vmware/pvscsi/pvscsi.c ============================================================================== --- head/sys/dev/vmware/pvscsi/pvscsi.c Thu Nov 14 23:31:20 2019 (r354715) +++ head/sys/dev/vmware/pvscsi/pvscsi.c Fri Nov 15 01:07:39 2019 (r354716) @@ -54,7 +54,6 @@ MALLOC_DEFINE(M_PVSCSI, "pvscsi", "PVSCSI memory"); #define ccb_pvscsi_sc spriv_ptr1 struct pvscsi_softc; -static timeout_t pvscsi_timeout; struct pvscsi_hcb; struct pvscsi_dma; From owner-svn-src-head@freebsd.org Fri Nov 15 03:15:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 983B91BAA7F; Fri, 15 Nov 2019 03:15:15 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Dk4M2TdXz3MfC; Fri, 15 Nov 2019 03:15:15 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D349A896; Fri, 15 Nov 2019 03:15:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAF3FEca038604; Fri, 15 Nov 2019 03:15:14 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAF3FE55038603; Fri, 15 Nov 2019 03:15:14 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911150315.xAF3FE55038603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 15 Nov 2019 03:15:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354717 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 354717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 03:15:15 -0000 Author: mhorne Date: Fri Nov 15 03:15:14 2019 New Revision: 354717 URL: https://svnweb.freebsd.org/changeset/base/354717 Log: plic: fix context calculation The RISC-V PLIC (platform level interrupt controller) registers are divided up by "context", which is purposefully left ambiguous in the PLIC spec. Currently we assume each CPU number corresponds 1-to-1 with a context number, but that is not correct. Most existing PLIC implementations (such as SiFive's) have multiple contexts per-cpu. For example, a single CPU might have a context for machine mode interrupts and a context for supervisor mode interrupts. To complicate things further, FreeBSD renumbers the CPUs during boot, but the PLIC driver still assumes that CPU ID equals the RISC-V hart number, meaning interrupt enables/claims might be performed for the wrong context registers. To fix this, we must calculate each CPU's context number during attachment. This is done by reading the interrupt properties from the device tree, from which a mapping from context to RISC-V hart to CPU number can be created. Reviewed by: br MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D21927 Modified: head/sys/riscv/riscv/plic.c Modified: head/sys/riscv/riscv/plic.c ============================================================================== --- head/sys/riscv/riscv/plic.c Fri Nov 15 01:07:39 2019 (r354716) +++ head/sys/riscv/riscv/plic.c Fri Nov 15 03:15:14 2019 (r354717) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -53,20 +54,40 @@ __FBSDID("$FreeBSD$"); #include "pic_if.h" #define PLIC_MAX_IRQS 1024 -#define PLIC_PRIORITY(n) (0x000000 + (n) * 0x4) -#define PLIC_ENABLE(n, h) (0x002000 + (h) * 0x80 + 4 * ((n) / 32)) -#define PLIC_THRESHOLD(h) (0x200000 + (h) * 0x1000 + 0x0) -#define PLIC_CLAIM(h) (0x200000 + (h) * 0x1000 + 0x4) +#define PLIC_PRIORITY_BASE 0x000000U + +#define PLIC_ENABLE_BASE 0x002000U +#define PLIC_ENABLE_STRIDE 0x80U + +#define PLIC_CONTEXT_BASE 0x200000U +#define PLIC_CONTEXT_STRIDE 0x1000U +#define PLIC_CONTEXT_THRESHOLD 0x0U +#define PLIC_CONTEXT_CLAIM 0x4U + +#define PLIC_PRIORITY(n) (PLIC_PRIORITY_BASE + (n) * sizeof(uint32_t)) +#define PLIC_ENABLE(sc, n, h) \ + (sc->contexts[h].enable_offset + ((n) / 32) * sizeof(uint32_t)) +#define PLIC_THRESHOLD(sc, h) \ + (sc->contexts[h].context_offset + PLIC_CONTEXT_THRESHOLD) +#define PLIC_CLAIM(sc, h) \ + (sc->contexts[h].context_offset + PLIC_CONTEXT_CLAIM) + struct plic_irqsrc { struct intr_irqsrc isrc; u_int irq; }; +struct plic_context { + bus_size_t enable_offset; + bus_size_t context_offset; +}; + struct plic_softc { device_t dev; struct resource * intc_res; struct plic_irqsrc isrcs[PLIC_MAX_IRQS]; + struct plic_context contexts[MAXCPU]; int ndev; }; @@ -75,6 +96,45 @@ struct plic_softc { #define WR4(sc, reg, val) \ bus_write_4(sc->intc_res, (reg), (val)) +static int +riscv_hartid_to_cpu(int hartid) +{ + int i; + + CPU_FOREACH(i) { + if (pcpu_find(i)->pc_hart == hartid) + return (i); + } + + return (-1); +} + +static int +plic_get_hartid(device_t dev, phandle_t intc) +{ + int hart; + + /* Check the interrupt controller layout. */ + if (OF_searchencprop(intc, "#interrupt-cells", &hart, + sizeof(hart)) == -1) { + device_printf(dev, + "Could not find #interrupt-cells for phandle %u\n", intc); + return (-1); + } + + /* + * The parent of the interrupt-controller is the CPU we are + * interested in, so search for its hart ID. + */ + if (OF_searchencprop(OF_parent(intc), "reg", (pcell_t *)&hart, + sizeof(hart)) == -1) { + device_printf(dev, "Could not find hartid\n"); + return (-1); + } + + return (hart); +} + static inline void plic_irq_dispatch(struct plic_softc *sc, u_int irq, struct trapframe *tf) @@ -98,11 +158,11 @@ plic_intr(void *arg) sc = arg; cpu = PCPU_GET(cpuid); - pending = RD4(sc, PLIC_CLAIM(cpu)); + pending = RD4(sc, PLIC_CLAIM(sc, cpu)); if (pending) { tf = curthread->td_intr_frame; plic_irq_dispatch(sc, pending, tf); - WR4(sc, PLIC_CLAIM(cpu), pending); + WR4(sc, PLIC_CLAIM(sc, cpu), pending); } return (FILTER_HANDLED); @@ -121,9 +181,9 @@ plic_disable_intr(device_t dev, struct intr_irqsrc *is cpu = PCPU_GET(cpuid); - reg = RD4(sc, PLIC_ENABLE(src->irq, cpu)); + reg = RD4(sc, PLIC_ENABLE(sc, src->irq, cpu)); reg &= ~(1 << (src->irq % 32)); - WR4(sc, PLIC_ENABLE(src->irq, cpu), reg); + WR4(sc, PLIC_ENABLE(sc, src->irq, cpu), reg); } static void @@ -141,9 +201,9 @@ plic_enable_intr(device_t dev, struct intr_irqsrc *isr cpu = PCPU_GET(cpuid); - reg = RD4(sc, PLIC_ENABLE(src->irq, cpu)); + reg = RD4(sc, PLIC_ENABLE(sc, src->irq, cpu)); reg |= (1 << (src->irq % 32)); - WR4(sc, PLIC_ENABLE(src->irq, cpu), reg); + WR4(sc, PLIC_ENABLE(sc, src->irq, cpu), reg); } static int @@ -189,6 +249,7 @@ plic_attach(device_t dev) struct plic_irqsrc *isrcs; struct plic_softc *sc; struct intr_pic *pic; + pcell_t *cells; uint32_t irq; const char *name; phandle_t node; @@ -196,6 +257,10 @@ plic_attach(device_t dev) uint32_t cpu; int error; int rid; + int nintr; + int context; + int i; + int hart; sc = device_get_softc(dev); @@ -225,6 +290,7 @@ plic_attach(device_t dev) return (ENXIO); } + /* Register the interrupt sources */ isrcs = sc->isrcs; name = device_get_nameunit(sc->dev); cpu = PCPU_GET(cpuid); @@ -236,9 +302,69 @@ plic_attach(device_t dev) return (error); WR4(sc, PLIC_PRIORITY(irq), 0); - WR4(sc, PLIC_ENABLE(irq, cpu), 0); } - WR4(sc, PLIC_THRESHOLD(cpu), 0); + + /* + * Calculate the per-cpu enable and context register offsets. + * + * This is tricky for a few reasons. The PLIC divides the interrupt + * enable, threshold, and claim bits by "context", where each context + * routes to a Core-Local Interrupt Controller (CLIC). + * + * The tricky part is that the PLIC spec imposes no restrictions on how + * these contexts are laid out. So for example, there is no guarantee + * that each CPU will have both a machine mode and supervisor context, + * or that different PLIC implementations will organize the context + * registers in the same way. On top of this, we must handle the fact + * that cpuid != hartid, as they may have been renumbered during boot. + * We perform the following steps: + * + * 1. Examine the PLIC's "interrupts-extended" property and skip any + * entries that are not for supervisor external interrupts. + * + * 2. Walk up the device tree to find the corresponding CPU, and grab + * it's hart ID. + * + * 3. Convert the hart to a cpuid, and calculate the register offsets + * based on the context number. + */ + nintr = OF_getencprop_alloc_multi(node, "interrupts-extended", + sizeof(uint32_t), (void **)&cells); + if (nintr <= 0) { + device_printf(dev, "Could not read interrupts-extended\n"); + return (ENXIO); + } + + /* interrupts-extended is a list of phandles and interrupt types. */ + for (i = 0, context = 0; i < nintr; i += 2, context++) { + /* Skip M-mode external interrupts */ + if (cells[i + 1] != IRQ_EXTERNAL_SUPERVISOR) + continue; + + /* Get the hart ID from the CLIC's phandle. */ + hart = plic_get_hartid(dev, OF_node_from_xref(cells[i])); + if (hart < 0) { + OF_prop_free(cells); + return (ENXIO); + } + + /* Get the corresponding cpuid. */ + cpu = riscv_hartid_to_cpu(hart); + if (cpu < 0) { + device_printf(dev, "Invalid hart!\n"); + OF_prop_free(cells); + return (ENXIO); + } + + /* Set the enable and context register offsets for the CPU. */ + sc->contexts[cpu].enable_offset = PLIC_ENABLE_BASE + + context * PLIC_ENABLE_STRIDE; + sc->contexts[cpu].context_offset = PLIC_CONTEXT_BASE + + context * PLIC_CONTEXT_STRIDE; + } + OF_prop_free(cells); + + WR4(sc, PLIC_THRESHOLD(sc, cpu), 0); xref = OF_xref_from_node(node); pic = intr_pic_register(sc->dev, xref); From owner-svn-src-head@freebsd.org Fri Nov 15 03:18:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B455B1BAB97; Fri, 15 Nov 2019 03:18:12 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Dk7m0t0gz3Q4f; Fri, 15 Nov 2019 03:18:12 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA62AA8A3; Fri, 15 Nov 2019 03:18:11 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAF3IBoG038773; Fri, 15 Nov 2019 03:18:11 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAF3IB4Q038772; Fri, 15 Nov 2019 03:18:11 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911150318.xAF3IB4Q038772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 15 Nov 2019 03:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354718 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 354718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 03:18:12 -0000 Author: mhorne Date: Fri Nov 15 03:18:11 2019 New Revision: 354718 URL: https://svnweb.freebsd.org/changeset/base/354718 Log: plic: support irq distribution Our PLIC implementation only enables interrupts on the boot cpu. Implement plic_bind_intr() so that they can be redistributed near the end of boot during intr_irq_shuffle(). This also slightly modifies how enable bits are handled in an attempt to better fit the PIC interface. plic_enable_intr()/plic_disable_intr() are converted to manage an interrupt source's threshold value, since this value can be used as to globally enable/disable an irq. All handing of the per-context enable bits is moved to the new methods plic_setup_intr() and plic_bind_intr(). Reviewed by: br MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D21928 Modified: head/sys/riscv/riscv/plic.c Modified: head/sys/riscv/riscv/plic.c ============================================================================== --- head/sys/riscv/riscv/plic.c Fri Nov 15 03:15:14 2019 (r354717) +++ head/sys/riscv/riscv/plic.c Fri Nov 15 03:18:11 2019 (r354718) @@ -3,11 +3,12 @@ * * Copyright (c) 2018 Ruslan Bukin * All rights reserved. + * Copyright (c) 2019 Mitchell Horne * - * This software was developed by SRI International and the University of - * Cambridge Computer Laboratory (Department of Computer Science and - * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the - * DARPA SSITH research programme. + * Portions of this software were developed by SRI International and the + * University of Cambridge Computer Laboratory (Department of Computer Science + * and Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of + * the DARPA SSITH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -73,6 +74,14 @@ __FBSDID("$FreeBSD$"); #define PLIC_CLAIM(sc, h) \ (sc->contexts[h].context_offset + PLIC_CONTEXT_CLAIM) +static pic_disable_intr_t plic_disable_intr; +static pic_enable_intr_t plic_enable_intr; +static pic_map_intr_t plic_map_intr; +static pic_setup_intr_t plic_setup_intr; +static pic_post_ithread_t plic_post_ithread; +static pic_pre_ithread_t plic_pre_ithread; +static pic_bind_intr_t plic_bind_intr; + struct plic_irqsrc { struct intr_irqsrc isrc; u_int irq; @@ -96,6 +105,8 @@ struct plic_softc { #define WR4(sc, reg, val) \ bus_write_4(sc->intc_res, (reg), (val)) +static u_int plic_irq_cpu; + static int riscv_hartid_to_cpu(int hartid) { @@ -173,17 +184,11 @@ plic_disable_intr(device_t dev, struct intr_irqsrc *is { struct plic_softc *sc; struct plic_irqsrc *src; - uint32_t reg; - uint32_t cpu; sc = device_get_softc(dev); src = (struct plic_irqsrc *)isrc; - cpu = PCPU_GET(cpuid); - - reg = RD4(sc, PLIC_ENABLE(sc, src->irq, cpu)); - reg &= ~(1 << (src->irq % 32)); - WR4(sc, PLIC_ENABLE(sc, src->irq, cpu), reg); + WR4(sc, PLIC_PRIORITY(src->irq), 0); } static void @@ -191,19 +196,11 @@ plic_enable_intr(device_t dev, struct intr_irqsrc *isr { struct plic_softc *sc; struct plic_irqsrc *src; - uint32_t reg; - uint32_t cpu; sc = device_get_softc(dev); src = (struct plic_irqsrc *)isrc; WR4(sc, PLIC_PRIORITY(src->irq), 1); - - cpu = PCPU_GET(cpuid); - - reg = RD4(sc, PLIC_ENABLE(sc, src->irq, cpu)); - reg |= (1 << (src->irq % 32)); - WR4(sc, PLIC_ENABLE(sc, src->irq, cpu), reg); } static int @@ -293,7 +290,6 @@ plic_attach(device_t dev) /* Register the interrupt sources */ isrcs = sc->isrcs; name = device_get_nameunit(sc->dev); - cpu = PCPU_GET(cpuid); for (irq = 1; irq <= sc->ndev; irq++) { isrcs[irq].irq = irq; error = intr_isrc_register(&isrcs[irq].isrc, sc->dev, @@ -364,7 +360,9 @@ plic_attach(device_t dev) } OF_prop_free(cells); - WR4(sc, PLIC_THRESHOLD(sc, cpu), 0); + /* Set the threshold for each CPU to accept all priorities. */ + CPU_FOREACH(cpu) + WR4(sc, PLIC_THRESHOLD(sc, cpu), 0); xref = OF_xref_from_node(node); pic = intr_pic_register(sc->dev, xref); @@ -379,25 +377,69 @@ plic_attach(device_t dev) static void plic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) { + + plic_disable_intr(dev, isrc); +} + +static void +plic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + plic_enable_intr(dev, isrc); +} + +static int +plic_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ struct plic_softc *sc; struct plic_irqsrc *src; sc = device_get_softc(dev); src = (struct plic_irqsrc *)isrc; - WR4(sc, PLIC_PRIORITY(src->irq), 0); + /* Bind to the boot CPU for now. */ + CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); + plic_bind_intr(dev, isrc); + + return (0); } -static void -plic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +static int +plic_bind_intr(device_t dev, struct intr_irqsrc *isrc) { struct plic_softc *sc; struct plic_irqsrc *src; + uint32_t reg; + u_int cpu; sc = device_get_softc(dev); src = (struct plic_irqsrc *)isrc; - WR4(sc, PLIC_PRIORITY(src->irq), 1); + /* Disable the interrupt source on all CPUs. */ + CPU_FOREACH(cpu) { + reg = RD4(sc, PLIC_ENABLE(sc, src->irq, cpu)); + reg &= ~(1 << (src->irq % 32)); + WR4(sc, PLIC_ENABLE(sc, src->irq, cpu), reg); + } + + if (CPU_EMPTY(&isrc->isrc_cpu)) { + cpu = plic_irq_cpu = intr_irq_next_cpu(plic_irq_cpu, &all_cpus); + CPU_SETOF(cpu, &isrc->isrc_cpu); + } else { + /* + * We will only bind to a single CPU so select the first + * CPU found. + */ + cpu = CPU_FFS(&isrc->isrc_cpu) - 1; + } + + /* Enable the interrupt on the selected CPU only. */ + reg = RD4(sc, PLIC_ENABLE(sc, src->irq, cpu)); + reg |= (1 << (src->irq % 32)); + WR4(sc, PLIC_ENABLE(sc, src->irq, cpu), reg); + + return (0); } static device_method_t plic_methods[] = { @@ -409,6 +451,8 @@ static device_method_t plic_methods[] = { DEVMETHOD(pic_map_intr, plic_map_intr), DEVMETHOD(pic_pre_ithread, plic_pre_ithread), DEVMETHOD(pic_post_ithread, plic_post_ithread), + DEVMETHOD(pic_setup_intr, plic_setup_intr), + DEVMETHOD(pic_bind_intr, plic_bind_intr), DEVMETHOD_END }; From owner-svn-src-head@freebsd.org Fri Nov 15 03:22:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7F5B1BAEB5; Fri, 15 Nov 2019 03:22:08 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DkDJ5t15z41Nf; Fri, 15 Nov 2019 03:22:08 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADDB3AA3D; Fri, 15 Nov 2019 03:22:08 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAF3M8d8043762; Fri, 15 Nov 2019 03:22:08 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAF3M8bE043761; Fri, 15 Nov 2019 03:22:08 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911150322.xAF3M8bE043761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 15 Nov 2019 03:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354719 - head/sys/riscv/include X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/include X-SVN-Commit-Revision: 354719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 03:22:09 -0000 Author: mhorne Date: Fri Nov 15 03:22:08 2019 New Revision: 354719 URL: https://svnweb.freebsd.org/changeset/base/354719 Log: RISC-V: pass arg6 in sbi_call Allow for an additional argument to sbi_call which will be passed in a6. This is required for SBI spec 0.2 support, as a6 will indicate the SBI function ID. While here, introduce some macros to clean up the calls. Reviewed by: kp, jhb MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D22325 Modified: head/sys/riscv/include/sbi.h Modified: head/sys/riscv/include/sbi.h ============================================================================== --- head/sys/riscv/include/sbi.h Fri Nov 15 03:18:11 2019 (r354718) +++ head/sys/riscv/include/sbi.h Fri Nov 15 03:22:08 2019 (r354719) @@ -47,25 +47,32 @@ #define SBI_REMOTE_SFENCE_VMA_ASID 7 #define SBI_SHUTDOWN 8 +#define SBI_CALL0(e, f) SBI_CALL4(e, f, 0, 0, 0, 0) +#define SBI_CALL1(e, f, p1) SBI_CALL4(e, f, p1, 0, 0, 0) +#define SBI_CALL2(e, f, p1, p2) SBI_CALL4(e, f, p1, p2, 0, 0) +#define SBI_CALL3(e, f, p1, p2, p3) SBI_CALL4(e, f, p1, p2, p3, 0) +#define SBI_CALL4(e, f, p1, p2, p3, p4) sbi_call(e, f, p1, p2, p3, p4) + /* * Documentation available at * https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.md */ static __inline uint64_t -sbi_call(uint64_t arg7, uint64_t arg0, uint64_t arg1, uint64_t arg2, - uint64_t arg3) +sbi_call(uint64_t arg7, uint64_t arg6, uint64_t arg0, uint64_t arg1, + uint64_t arg2, uint64_t arg3) { register uintptr_t a0 __asm ("a0") = (uintptr_t)(arg0); register uintptr_t a1 __asm ("a1") = (uintptr_t)(arg1); register uintptr_t a2 __asm ("a2") = (uintptr_t)(arg2); register uintptr_t a3 __asm ("a3") = (uintptr_t)(arg3); + register uintptr_t a6 __asm ("a6") = (uintptr_t)(arg6); register uintptr_t a7 __asm ("a7") = (uintptr_t)(arg7); __asm __volatile( \ "ecall" \ :"+r"(a0) \ - :"r"(a1), "r"(a2), "r" (a3), "r"(a7) \ + :"r"(a1), "r"(a2), "r"(a3), "r"(a6), "r"(a7) \ :"memory"); return (a0); @@ -75,49 +82,49 @@ static __inline void sbi_console_putchar(int ch) { - sbi_call(SBI_CONSOLE_PUTCHAR, ch, 0, 0, 0); + (void)SBI_CALL1(SBI_CONSOLE_PUTCHAR, 0, ch); } static __inline int sbi_console_getchar(void) { - return (sbi_call(SBI_CONSOLE_GETCHAR, 0, 0, 0, 0)); + return (SBI_CALL0(SBI_CONSOLE_GETCHAR, 0)); } static __inline void sbi_set_timer(uint64_t val) { - sbi_call(SBI_SET_TIMER, val, 0, 0, 0); + (void)SBI_CALL1(SBI_SET_TIMER, 0, val); } static __inline void sbi_shutdown(void) { - sbi_call(SBI_SHUTDOWN, 0, 0, 0, 0); + (void)SBI_CALL0(SBI_SHUTDOWN, 0); } static __inline void sbi_clear_ipi(void) { - sbi_call(SBI_CLEAR_IPI, 0, 0, 0, 0); + (void)SBI_CALL0(SBI_CLEAR_IPI, 0); } static __inline void sbi_send_ipi(const unsigned long *hart_mask) { - sbi_call(SBI_SEND_IPI, (uint64_t)hart_mask, 0, 0, 0); + (void)SBI_CALL1(SBI_SEND_IPI, 0, (uint64_t)hart_mask); } static __inline void sbi_remote_fence_i(const unsigned long *hart_mask) { - sbi_call(SBI_REMOTE_FENCE_I, (uint64_t)hart_mask, 0, 0, 0); + (void)SBI_CALL1(SBI_REMOTE_FENCE_I, 0, (uint64_t)hart_mask); } static __inline void @@ -125,7 +132,8 @@ sbi_remote_sfence_vma(const unsigned long *hart_mask, unsigned long start, unsigned long size) { - sbi_call(SBI_REMOTE_SFENCE_VMA, (uint64_t)hart_mask, start, size, 0); + (void)SBI_CALL3(SBI_REMOTE_SFENCE_VMA, 0, (uint64_t)hart_mask, start, + size); } static __inline void @@ -134,8 +142,8 @@ sbi_remote_sfence_vma_asid(const unsigned long *hart_m unsigned long asid) { - sbi_call(SBI_REMOTE_SFENCE_VMA_ASID, (uint64_t)hart_mask, start, size, - asid); + (void)SBI_CALL4(SBI_REMOTE_SFENCE_VMA_ASID, 0, (uint64_t)hart_mask, + start, size, asid); } #endif /* !_MACHINE_SBI_H_ */ From owner-svn-src-head@freebsd.org Fri Nov 15 03:34:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F9C41BB1C4; Fri, 15 Nov 2019 03:34:28 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DkVX1hBYz4RGn; Fri, 15 Nov 2019 03:34:28 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E32BAC35; Fri, 15 Nov 2019 03:34:28 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAF3YSWf050708; Fri, 15 Nov 2019 03:34:28 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAF3YRxG050704; Fri, 15 Nov 2019 03:34:27 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911150334.xAF3YRxG050704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 15 Nov 2019 03:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354720 - in head/sys: conf riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/sys: conf riscv/riscv X-SVN-Commit-Revision: 354720 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 03:34:28 -0000 Author: mhorne Date: Fri Nov 15 03:34:27 2019 New Revision: 354720 URL: https://svnweb.freebsd.org/changeset/base/354720 Log: RISC-V: add support for SBI spec v0.2 The Supervisor Binary Interface (SBI) specification v0.2 is a backwards incompatible update to the SBI call interface for kernels running in supervisor mode. The goal of this update was to make it easier for new and optional functionality to be added to the SBI. SBI functions are now called by passing an "extension ID" and a "function ID" which are passed in a7 and a6 respectively. SBI calls will also return an error and value in the following struct: struct sbi_ret { long error; long value; } This version introduces several new functions under the "base" extension. It is expected that all SBI implementations >= 0.2 will support this base set of functions, as they implement some essential services such as obtaining the SBI version, CPU implementation info, and extension probing. Existing SBI functions have been designated as "legacy". For the time being they will remain implemented, but it is expected that in the future their functionality will be duplicated or replaced by new SBI extensions. Each legacy function has been assigned its own extension ID, and for now we simply probe and assert for their existence. Compatibility with legacy SBI implementations (such as BBL) is maintained by checking the output of sbi_get_spec_version(). This function is guaranteed to succeed by the new spec, but will return an error in legacy implementations. We use this as an indicator of whether or not we can rely on the new SBI base extensions. For further info on the Supervisor Binary Interface, see: https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc Reviewed by: kp, jhb MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D22326 Added: head/sys/riscv/riscv/sbi.c (contents, props changed) Modified: head/sys/conf/files.riscv head/sys/riscv/riscv/identcpu.c head/sys/riscv/riscv/machdep.c Modified: head/sys/conf/files.riscv ============================================================================== --- head/sys/conf/files.riscv Fri Nov 15 03:22:08 2019 (r354719) +++ head/sys/conf/files.riscv Fri Nov 15 03:34:27 2019 (r354720) @@ -55,6 +55,7 @@ riscv/riscv/ofw_machdep.c optional fdt riscv/riscv/plic.c standard riscv/riscv/pmap.c standard riscv/riscv/riscv_console.c optional rcons +riscv/riscv/sbi.c standard riscv/riscv/soc.c standard riscv/riscv/stack_machdep.c optional ddb | stack riscv/riscv/support.S standard Modified: head/sys/riscv/riscv/identcpu.c ============================================================================== --- head/sys/riscv/riscv/identcpu.c Fri Nov 15 03:22:08 2019 (r354719) +++ head/sys/riscv/riscv/identcpu.c Fri Nov 15 03:34:27 2019 (r354720) @@ -60,6 +60,11 @@ char machine[] = "riscv"; SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "Machine class"); +/* Hardware implementation info. These values may be empty. */ +register_t mvendorid; /* The CPU's JEDEC vendor ID */ +register_t marchid; /* The architecture ID */ +register_t mimpid; /* The implementation ID */ + struct cpu_desc { u_int cpu_impl; u_int cpu_part_num; Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Fri Nov 15 03:22:08 2019 (r354719) +++ head/sys/riscv/riscv/machdep.c Fri Nov 15 03:34:27 2019 (r354720) @@ -850,6 +850,9 @@ initriscv(struct riscv_bootparams *rvbp) PCPU_SET(curthread, &thread0); + /* Initialize SBI interface. */ + sbi_init(); + /* Set the module data location */ lastaddr = fake_preload_metadata(rvbp); Added: head/sys/riscv/riscv/sbi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/riscv/riscv/sbi.c Fri Nov 15 03:34:27 2019 (r354720) @@ -0,0 +1,127 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Mitchell Horne + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include + +u_long sbi_spec_version; +u_long sbi_impl_id; +u_long sbi_impl_version; + +static struct sbi_ret +sbi_get_spec_version(void) +{ + return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_SPEC_VERSION)); +} + +static struct sbi_ret +sbi_get_impl_id(void) +{ + return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_IMPL_ID)); +} + +static struct sbi_ret +sbi_get_impl_version(void) +{ + return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_IMPL_VERSION)); +} + +static struct sbi_ret +sbi_get_mvendorid(void) +{ + return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_MVENDORID)); +} + + +static struct sbi_ret +sbi_get_marchid(void) +{ + return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_MARCHID)); +} + +static struct sbi_ret +sbi_get_mimpid(void) +{ + return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_MIMPID)); +} + +void +sbi_init(void) +{ + struct sbi_ret sret; + + /* + * Get the spec version. For legacy SBI implementations this will + * return an error, otherwise it is guaranteed to succeed. + */ + sret = sbi_get_spec_version(); + if (sret.error != 0) { + /* We are running a legacy SBI implementation. */ + sbi_spec_version = 0; + return; + } + + /* Set the SBI implementation info. */ + sbi_spec_version = sret.value; + sbi_impl_id = sbi_get_impl_id().value; + sbi_impl_version = sbi_get_impl_version().value; + + /* Set the hardware implementation info. */ + mvendorid = sbi_get_mvendorid().value; + marchid = sbi_get_marchid().value; + mimpid = sbi_get_mimpid().value; + + /* + * Probe for legacy extensions. Currently we rely on all of them + * to be implemented, but this is not guaranteed by the spec. + */ + KASSERT(sbi_probe_extension(SBI_SET_TIMER) != 0, + ("SBI doesn't implement sbi_set_timer()")); + KASSERT(sbi_probe_extension(SBI_CONSOLE_PUTCHAR) != 0, + ("SBI doesn't implement sbi_console_putchar()")); + KASSERT(sbi_probe_extension(SBI_CONSOLE_GETCHAR) != 0, + ("SBI doesn't implement sbi_console_getchar()")); + KASSERT(sbi_probe_extension(SBI_CLEAR_IPI) != 0, + ("SBI doesn't implement sbi_clear_ipi()")); + KASSERT(sbi_probe_extension(SBI_SEND_IPI) != 0, + ("SBI doesn't implement sbi_send_ipi()")); + KASSERT(sbi_probe_extension(SBI_REMOTE_FENCE_I) != 0, + ("SBI doesn't implement sbi_remote_fence_i()")); + KASSERT(sbi_probe_extension(SBI_REMOTE_SFENCE_VMA) != 0, + ("SBI doesn't implement sbi_remote_sfence_vma()")); + KASSERT(sbi_probe_extension(SBI_REMOTE_SFENCE_VMA_ASID) != 0, + ("SBI doesn't implement sbi_remote_sfence_vma_asid()")); + KASSERT(sbi_probe_extension(SBI_SHUTDOWN) != 0, + ("SBI doesn't implement sbi_shutdown()")); +} From owner-svn-src-head@freebsd.org Fri Nov 15 03:37:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83FAD1BB297; Fri, 15 Nov 2019 03:37:50 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DkZQ2ghrz4Xxt; Fri, 15 Nov 2019 03:37:50 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27413AC40; Fri, 15 Nov 2019 03:37:50 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAF3boIV050908; Fri, 15 Nov 2019 03:37:50 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAF3bnq0050906; Fri, 15 Nov 2019 03:37:49 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911150337.xAF3bnq0050906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 15 Nov 2019 03:37:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354721 - head/sys/riscv/include X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/include X-SVN-Commit-Revision: 354721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 03:37:50 -0000 Author: mhorne Date: Fri Nov 15 03:37:49 2019 New Revision: 354721 URL: https://svnweb.freebsd.org/changeset/base/354721 Log: Add missing files from r354720 MFC with: r354720 Differential Revision: https://reviews.freebsd.org/D22326 Modified: head/sys/riscv/include/md_var.h head/sys/riscv/include/sbi.h Modified: head/sys/riscv/include/md_var.h ============================================================================== --- head/sys/riscv/include/md_var.h Fri Nov 15 03:34:27 2019 (r354720) +++ head/sys/riscv/include/md_var.h Fri Nov 15 03:37:49 2019 (r354721) @@ -39,6 +39,9 @@ extern int szsigcode; extern uint64_t *vm_page_dump; extern int vm_page_dump_size; extern u_long elf_hwcap; +extern register_t mvendorid; +extern register_t marchid; +extern register_t mimpid; struct dumperinfo; Modified: head/sys/riscv/include/sbi.h ============================================================================== --- head/sys/riscv/include/sbi.h Fri Nov 15 03:34:27 2019 (r354720) +++ head/sys/riscv/include/sbi.h Fri Nov 15 03:37:49 2019 (r354721) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2016-2017 Ruslan Bukin * All rights reserved. + * Copyright (c) 2019 Mitchell Horne * * Portions of this software were developed by SRI International and the * University of Cambridge Computer Laboratory under DARPA/AFRL contract @@ -37,6 +38,35 @@ #ifndef _MACHINE_SBI_H_ #define _MACHINE_SBI_H_ +/* SBI Specification Version */ +#define SBI_SPEC_VERS_MAJOR_OFFSET 24 +#define SBI_SPEC_VERS_MAJOR_MASK (0x7F << SBI_SPEC_VERS_MAJOR_OFFSET) +#define SBI_SPEC_VERS_MINOR_OFFSET 0 +#define SBI_SPEC_VERS_MINOR_MASK (0xFFFFFF << SBI_SPEC_VERS_MINOR_OFFSET) + +/* SBI Implementation IDs */ +#define SBI_IMPL_ID_BBL 0 +#define SBI_IMPL_ID_OPENSBI 1 + +/* SBI Error Codes */ +#define SBI_SUCCESS 0 +#define SBI_ERR_FAILURE -1 +#define SBI_ERR_NOT_SUPPORTED -2 +#define SBI_ERR_INVALID_PARAM -3 +#define SBI_ERR_DENIED -4 +#define SBI_ERR_INVALID_ADDRESS -5 + +/* SBI Base Extension */ +#define SBI_EXT_ID_BASE 0x10 +#define SBI_BASE_GET_SPEC_VERSION 0 +#define SBI_BASE_GET_IMPL_ID 1 +#define SBI_BASE_GET_IMPL_VERSION 2 +#define SBI_BASE_PROBE_EXTENSION 3 +#define SBI_BASE_GET_MVENDORID 4 +#define SBI_BASE_GET_MARCHID 5 +#define SBI_BASE_GET_MIMPID 6 + +/* Legacy Extensions */ #define SBI_SET_TIMER 0 #define SBI_CONSOLE_PUTCHAR 1 #define SBI_CONSOLE_GETCHAR 2 @@ -55,13 +85,20 @@ /* * Documentation available at - * https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.md + * https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc */ -static __inline uint64_t +struct sbi_ret { + long error; + long value; +}; + +static __inline struct sbi_ret sbi_call(uint64_t arg7, uint64_t arg6, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3) { + struct sbi_ret ret; + register uintptr_t a0 __asm ("a0") = (uintptr_t)(arg0); register uintptr_t a1 __asm ("a1") = (uintptr_t)(arg1); register uintptr_t a2 __asm ("a2") = (uintptr_t)(arg2); @@ -71,13 +108,27 @@ sbi_call(uint64_t arg7, uint64_t arg6, uint64_t arg0, __asm __volatile( \ "ecall" \ - :"+r"(a0) \ - :"r"(a1), "r"(a2), "r"(a3), "r"(a6), "r"(a7) \ + :"+r"(a0), "+r"(a1) \ + :"r"(a2), "r"(a3), "r"(a6), "r"(a7) \ :"memory"); - return (a0); + ret.error = a0; + ret.value = a1; + return (ret); } +/* Base extension functions and variables. */ +extern u_long sbi_spec_version; +extern u_long sbi_impl_id; +extern u_long sbi_impl_version; + +static __inline long +sbi_probe_extension(long id) +{ + return (SBI_CALL1(SBI_EXT_ID_BASE, SBI_BASE_PROBE_EXTENSION, id).value); +} + +/* Legacy extension functions. */ static __inline void sbi_console_putchar(int ch) { @@ -89,7 +140,11 @@ static __inline int sbi_console_getchar(void) { - return (SBI_CALL0(SBI_CONSOLE_GETCHAR, 0)); + /* + * XXX: The "error" is returned here because legacy SBI functions + * continue to return their value in a0. + */ + return (SBI_CALL0(SBI_CONSOLE_GETCHAR, 0).error); } static __inline void @@ -145,5 +200,7 @@ sbi_remote_sfence_vma_asid(const unsigned long *hart_m (void)SBI_CALL4(SBI_REMOTE_SFENCE_VMA_ASID, 0, (uint64_t)hart_mask, start, size, asid); } + +void sbi_init(void); #endif /* !_MACHINE_SBI_H_ */ From owner-svn-src-head@freebsd.org Fri Nov 15 03:40:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 151891BB3CA; Fri, 15 Nov 2019 03:40:04 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Dkcz6kv0z4cpV; Fri, 15 Nov 2019 03:40:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8CE9AC47; Fri, 15 Nov 2019 03:40:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAF3e3kf051087; Fri, 15 Nov 2019 03:40:03 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAF3e364051084; Fri, 15 Nov 2019 03:40:03 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911150340.xAF3e364051084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 15 Nov 2019 03:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354722 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 354722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 03:40:04 -0000 Author: mhorne Date: Fri Nov 15 03:40:02 2019 New Revision: 354722 URL: https://svnweb.freebsd.org/changeset/base/354722 Log: RISC-V: Print SBI info at startup SBI version 0.2 introduces functions for obtaining the details of the SBI implementation, such as version and implemntation ID. Print this info at startup when it is available. Reviewed by: jhb, kp MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D22327 Modified: head/sys/riscv/include/sbi.h head/sys/riscv/riscv/machdep.c head/sys/riscv/riscv/sbi.c Modified: head/sys/riscv/include/sbi.h ============================================================================== --- head/sys/riscv/include/sbi.h Fri Nov 15 03:37:49 2019 (r354721) +++ head/sys/riscv/include/sbi.h Fri Nov 15 03:40:02 2019 (r354722) @@ -201,6 +201,7 @@ sbi_remote_sfence_vma_asid(const unsigned long *hart_m start, size, asid); } +void sbi_print_version(void); void sbi_init(void); #endif /* !_MACHINE_SBI_H_ */ Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Fri Nov 15 03:37:49 2019 (r354721) +++ head/sys/riscv/riscv/machdep.c Fri Nov 15 03:40:02 2019 (r354722) @@ -128,6 +128,7 @@ static void cpu_startup(void *dummy) { + sbi_print_version(); identify_cpu(); printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)realmem), Modified: head/sys/riscv/riscv/sbi.c ============================================================================== --- head/sys/riscv/riscv/sbi.c Fri Nov 15 03:37:49 2019 (r354721) +++ head/sys/riscv/riscv/sbi.c Fri Nov 15 03:40:02 2019 (r354722) @@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$"); #include #include +/* SBI Implementation-Specific Definitions */ +#define OPENSBI_VERSION_MAJOR_OFFSET 16 +#define OPENSBI_VERSION_MINOR_MASK 0xFFFF + u_long sbi_spec_version; u_long sbi_impl_id; u_long sbi_impl_version; @@ -74,6 +78,39 @@ static struct sbi_ret sbi_get_mimpid(void) { return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_MIMPID)); +} + +void +sbi_print_version(void) +{ + u_int major; + u_int minor; + + /* For legacy SBI implementations. */ + if (sbi_spec_version == 0) { + printf("SBI: Unknown (Legacy) Implementation\n"); + printf("SBI Specification Version: 0.1\n"); + return; + } + + switch (sbi_impl_id) { + case (SBI_IMPL_ID_BBL): + printf("SBI: Berkely Boot Loader %u\n", sbi_impl_version); + break; + case (SBI_IMPL_ID_OPENSBI): + major = sbi_impl_version >> OPENSBI_VERSION_MAJOR_OFFSET; + minor = sbi_impl_version & OPENSBI_VERSION_MINOR_MASK; + printf("SBI: OpenSBI v%u.%u\n", major, minor); + break; + default: + printf("SBI: Unrecognized Implementation: %u\n", sbi_impl_id); + break; + } + + major = (sbi_spec_version & SBI_SPEC_VERS_MAJOR_MASK) >> + SBI_SPEC_VERS_MAJOR_OFFSET; + minor = (sbi_spec_version & SBI_SPEC_VERS_MINOR_MASK); + printf("SBI Specification Version: %u.%u\n", major, minor); } void From owner-svn-src-head@freebsd.org Fri Nov 15 04:33:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 742281BC4E4; Fri, 15 Nov 2019 04:33:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DlpD0J2Nz3xcR; Fri, 15 Nov 2019 04:33:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8520B70F; Fri, 15 Nov 2019 04:33:07 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAF4X7xi086204; Fri, 15 Nov 2019 04:33:07 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAF4X72Z086202; Fri, 15 Nov 2019 04:33:07 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911150433.xAF4X72Z086202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 15 Nov 2019 04:33:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354723 - in head/sys: powerpc/include sys X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: powerpc/include sys X-SVN-Commit-Revision: 354723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 04:33:08 -0000 Author: jhibbits Date: Fri Nov 15 04:33:07 2019 New Revision: 354723 URL: https://svnweb.freebsd.org/changeset/base/354723 Log: atomic: Add atomic_cmpset_masked to powerpc and use it Summary: This is a more optimal way of doing atomic_compset_masked() than the fallback in sys/_atomic_subword.h. There's also an override for _atomic_fcmpset_masked_word(), which may or may not be necessary, and is unused for powerpc. Reviewed by: kevans, kib Differential Revision: https://reviews.freebsd.org/D22359 Modified: head/sys/powerpc/include/atomic.h head/sys/sys/_atomic_subword.h Modified: head/sys/powerpc/include/atomic.h ============================================================================== --- head/sys/powerpc/include/atomic.h Fri Nov 15 03:40:02 2019 (r354722) +++ head/sys/powerpc/include/atomic.h Fri Nov 15 04:33:07 2019 (r354723) @@ -608,6 +608,38 @@ atomic_cmpset_short(volatile u_short *p, u_short cmpva return (ret); } +#else +static __inline int +atomic_cmpset_masked(uint32_t *p, uint32_t cmpval, uint32_t newval, + uint32_t mask) +{ + int ret; + uint32_t tmp; + + __asm __volatile ( + "1:\tlwarx %2, 0, %2\n\t" /* load old value */ + "and %0, %2, %7\n\t" + "cmplw %4, %0\n\t" /* compare */ + "bne- 2f\n\t" /* exit if not equal */ + "andc %2, %2, %7\n\t" + "or %2, %2, %5\n\t" + "stwcx. %2, 0, %3\n\t" /* attempt to store */ + "bne- 1b\n\t" /* spin if failed */ + "li %0, 1\n\t" /* success - retval = 1 */ + "b 3f\n\t" /* we've succeeded */ + "2:\n\t" + "stwcx. %2, 0, %3\n\t" /* clear reservation (74xx) */ + "li %0, 0\n\t" /* failure - retval = 0 */ + "3:\n\t" + : "=&r" (ret), "=m" (*p), "+&r" (tmp) + : "r" (p), "r" (cmpval), "r" (newval), "m" (*p), + "r" (mask) + : "cr0", "memory"); + + return (ret); +} + +#define _atomic_cmpset_masked_word(a,o,v,m) atomic_cmpset_masked(a, o, v, m) #endif static __inline int Modified: head/sys/sys/_atomic_subword.h ============================================================================== --- head/sys/sys/_atomic_subword.h Fri Nov 15 03:40:02 2019 (r354722) +++ head/sys/sys/_atomic_subword.h Fri Nov 15 04:33:07 2019 (r354723) @@ -63,6 +63,7 @@ ((((__uintptr_t)(p) % 4)) * NBBY) #endif +#ifndef _atomic_cmpset_masked_word /* * Pass these bad boys a couple words and a mask of the bits you care about, * they'll loop until we either succeed or fail because of those bits rather @@ -92,7 +93,9 @@ _atomic_cmpset_masked_word(uint32_t *addr, uint32_t ol return (ret); } +#endif +#ifndef _atomic_fcmpset_masked_word static __inline int _atomic_fcmpset_masked_word(uint32_t *addr, uint32_t *old, uint32_t val, uint32_t mask) @@ -108,6 +111,7 @@ _atomic_fcmpset_masked_word(uint32_t *addr, uint32_t * *old = (*addr & ~mask) | *old; return (atomic_fcmpset_32(addr, old, (*old & ~mask) | val)); } +#endif static __inline int atomic_cmpset_8(__volatile uint8_t *addr, uint8_t old, uint8_t val) From owner-svn-src-head@freebsd.org Fri Nov 15 06:56:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93C271BE357; Fri, 15 Nov 2019 06:56:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DpzZ1FK3z4XJm; Fri, 15 Nov 2019 06:56:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9559ED161; Fri, 15 Nov 2019 06:56:25 +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 xAF6uPsa068038; Fri, 15 Nov 2019 06:56:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAF6uPmF068037; Fri, 15 Nov 2019 06:56:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911150656.xAF6uPmF068037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 15 Nov 2019 06:56:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354724 - head/contrib/llvm/lib/Transforms/InstCombine X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/lib/Transforms/InstCombine X-SVN-Commit-Revision: 354724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 06:56:26 -0000 Author: dim Date: Fri Nov 15 06:56:25 2019 New Revision: 354724 URL: https://svnweb.freebsd.org/changeset/base/354724 Log: Merge commit 5bbb604bb from llvm git (by Craig Topper): [InstCombine] Disable some portions of foldGEPICmp for GEPs that return a vector of pointers. Fix other portions. llvm-svn: 370114 This should fix instances of 'Assertion failed: (isa(Val) && "cast() argument of incompatible type!"), function cast, file /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', when building openjdk8 for aarch64 and armv7. Reported by: jbeich PR: 236566 MFC after: 3 days Modified: head/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Modified: head/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Fri Nov 15 04:33:07 2019 (r354723) +++ head/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Fri Nov 15 06:56:25 2019 (r354724) @@ -832,6 +832,10 @@ getAsConstantIndexedAddress(Value *V, const DataLayout static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, const DataLayout &DL) { + // FIXME: Support vector of pointers. + if (GEPLHS->getType()->isVectorTy()) + return nullptr; + if (!GEPLHS->hasAllConstantIndices()) return nullptr; @@ -882,7 +886,9 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE RHS = RHS->stripPointerCasts(); Value *PtrBase = GEPLHS->getOperand(0); - if (PtrBase == RHS && GEPLHS->isInBounds()) { + // FIXME: Support vector pointer GEPs. + if (PtrBase == RHS && GEPLHS->isInBounds() && + !GEPLHS->getType()->isVectorTy()) { // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0). // This transformation (ignoring the base and scales) is valid because we // know pointers can't overflow since the gep is inbounds. See if we can @@ -916,11 +922,13 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE // If we're comparing GEPs with two base pointers that only differ in type // and both GEPs have only constant indices or just one use, then fold // the compare with the adjusted indices. + // FIXME: Support vector of pointers. if (GEPLHS->isInBounds() && GEPRHS->isInBounds() && (GEPLHS->hasAllConstantIndices() || GEPLHS->hasOneUse()) && (GEPRHS->hasAllConstantIndices() || GEPRHS->hasOneUse()) && PtrBase->stripPointerCasts() == - GEPRHS->getOperand(0)->stripPointerCasts()) { + GEPRHS->getOperand(0)->stripPointerCasts() && + !GEPLHS->getType()->isVectorTy()) { Value *LOffset = EmitGEPOffset(GEPLHS); Value *ROffset = EmitGEPOffset(GEPRHS); @@ -964,15 +972,20 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE unsigned DiffOperand = 0; // The operand that differs. for (unsigned i = 1, e = GEPRHS->getNumOperands(); i != e; ++i) if (GEPLHS->getOperand(i) != GEPRHS->getOperand(i)) { - if (GEPLHS->getOperand(i)->getType()->getPrimitiveSizeInBits() != - GEPRHS->getOperand(i)->getType()->getPrimitiveSizeInBits()) { + Type *LHSType = GEPLHS->getOperand(i)->getType(); + Type *RHSType = GEPRHS->getOperand(i)->getType(); + // FIXME: Better support for vector of pointers. + if (LHSType->getPrimitiveSizeInBits() != + RHSType->getPrimitiveSizeInBits() || + (GEPLHS->getType()->isVectorTy() && + (!LHSType->isVectorTy() || !RHSType->isVectorTy()))) { // Irreconcilable differences. NumDifferences = 2; break; - } else { - if (NumDifferences++) break; - DiffOperand = i; } + + if (NumDifferences++) break; + DiffOperand = i; } if (NumDifferences == 0) // SAME GEP? From owner-svn-src-head@freebsd.org Fri Nov 15 09:18:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C46A41C16E9; Fri, 15 Nov 2019 09:18:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Dt7v2B6sz47D5; Fri, 15 Nov 2019 09:18:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAF9Ibc3076305 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 15 Nov 2019 11:18:40 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAF9Ibc3076305 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAF9Ib55076304; Fri, 15 Nov 2019 11:18:37 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 15 Nov 2019 11:18:37 +0200 From: Konstantin Belousov To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354703 - head/sys/dev/ioat Message-ID: <20191115091837.GD2707@kib.kiev.ua> References: <201911140439.xAE4dngZ032224@repo.freebsd.org> <20191114101149.GA2707@kib.kiev.ua> <475757c6-3707-540b-0316-cbef278043c2@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <475757c6-3707-540b-0316-cbef278043c2@FreeBSD.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47Dt7v2B6sz47D5 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 09:18:51 -0000 On Thu, Nov 14, 2019 at 09:41:36AM -0500, Alexander Motin wrote: > On 14.11.2019 05:11, Konstantin Belousov wrote: > > On Thu, Nov 14, 2019 at 04:39:49AM +0000, Alexander Motin wrote: > >> Author: mav > >> Date: Thu Nov 14 04:39:48 2019 > >> New Revision: 354703 > >> URL: https://svnweb.freebsd.org/changeset/base/354703 > >> > >> Log: > >> Pass more reasonable WAIT flags to bus_dma(9) calls. > >> > >> MFC after: 2 weeks > >> > >> Modified: > >> head/sys/dev/ioat/ioat.c > >> > >> Modified: head/sys/dev/ioat/ioat.c > >> ============================================================================== > >> --- head/sys/dev/ioat/ioat.c Thu Nov 14 04:34:58 2019 (r354702) > >> +++ head/sys/dev/ioat/ioat.c Thu Nov 14 04:39:48 2019 (r354703) > >> @@ -555,13 +555,14 @@ ioat3_attach(device_t device) > >> &ioat->comp_update_tag); > >> > >> error = bus_dmamem_alloc(ioat->comp_update_tag, > >> - (void **)&ioat->comp_update, BUS_DMA_ZERO, &ioat->comp_update_map); > >> + (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, > >> + &ioat->comp_update_map); > > For waitok, you need to provide locking function in the tag. > > I'm sorry, but why? It is alloc(), not load(). For load() it makes > sense since it calls back, but this is just a form of malloc(), isn't > it? I've looked through the both x86 implementations and found nothing > suspicious. I see. Still, if you (or somebody else) ever decided to use WAITOK loads, it would be much safer to provide the lock function now. I know that it is quite hard to reproduce this issue with modern hardware and bounce busdma on amd64. In reverse, it is quite easy to get it with either i386 PAE or DMAR busdma. From owner-svn-src-head@freebsd.org Fri Nov 15 11:00:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF8D01C3368; Fri, 15 Nov 2019 11:00:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DwNg5Ql1z4RH9; Fri, 15 Nov 2019 11:00:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F161FCEF; Fri, 15 Nov 2019 11:00:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFB03dr012984; Fri, 15 Nov 2019 11:00:03 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFB03M3012983; Fri, 15 Nov 2019 11:00:03 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911151100.xAFB03M3012983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 15 Nov 2019 11:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354726 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354726 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 11:00:03 -0000 Author: bz Date: Fri Nov 15 11:00:03 2019 New Revision: 354726 URL: https://svnweb.freebsd.org/changeset/base/354726 Log: if_llatbl: cleanup Remove function prototypes which are not needed (no use before function definition for these file static functions). MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/net/if_llatbl.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Fri Nov 15 07:01:04 2019 (r354725) +++ head/sys/net/if_llatbl.c Fri Nov 15 11:00:03 2019 (r354726) @@ -80,11 +80,6 @@ RW_SYSINIT(lltable_list_lock, &lltable_list_lock, "llt static void lltable_unlink(struct lltable *llt); static void llentries_unlink(struct lltable *llt, struct llentries *head); -static void htable_unlink_entry(struct llentry *lle); -static void htable_link_entry(struct lltable *llt, struct llentry *lle); -static int htable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f, - void *farg); - /* * Dump lle state for a specific address family. */ From owner-svn-src-head@freebsd.org Fri Nov 15 11:45:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A60C01C408D; Fri, 15 Nov 2019 11:45:15 +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 47DxNq2yd6z4QYf; Fri, 15 Nov 2019 11:45:15 +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 454AA185A3; Fri, 15 Nov 2019 11:45:15 +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 xAFBjFkK042400; Fri, 15 Nov 2019 11:45:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFBjEn0042399; Fri, 15 Nov 2019 11:45:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911151145.xAFBjEn0042399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 15 Nov 2019 11:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354727 - in head/sys: contrib/rdma/krping ofed/include/rdma X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: contrib/rdma/krping ofed/include/rdma X-SVN-Commit-Revision: 354727 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 11:45:15 -0000 Author: hselasky Date: Fri Nov 15 11:45:14 2019 New Revision: 354727 URL: https://svnweb.freebsd.org/changeset/base/354727 Log: Correct MR length field to be 64-bit in ibcore. Linux commit: edd31551148c09608feee6b8756ad148d550ee3b MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/contrib/rdma/krping/krping.c head/sys/ofed/include/rdma/ib_verbs.h Modified: head/sys/contrib/rdma/krping/krping.c ============================================================================== --- head/sys/contrib/rdma/krping/krping.c Fri Nov 15 11:00:03 2019 (r354726) +++ head/sys/contrib/rdma/krping/krping.c Fri Nov 15 11:45:14 2019 (r354727) @@ -736,7 +736,7 @@ static u32 krping_rdma_rkey(struct krping_cb *cb, u64 post_inv, cb->reg_mr_wr.key, cb->reg_mr->page_size, - cb->reg_mr->length, + (unsigned)cb->reg_mr->length, (unsigned long long)cb->reg_mr->iova); if (post_inv) Modified: head/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- head/sys/ofed/include/rdma/ib_verbs.h Fri Nov 15 11:00:03 2019 (r354726) +++ head/sys/ofed/include/rdma/ib_verbs.h Fri Nov 15 11:45:14 2019 (r354727) @@ -1559,7 +1559,7 @@ struct ib_mr { u32 lkey; u32 rkey; u64 iova; - u32 length; + u64 length; unsigned int page_size; bool need_inval; union { From owner-svn-src-head@freebsd.org Fri Nov 15 11:46:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A08561C416C; Fri, 15 Nov 2019 11:46:54 +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 47DxQk3nN7z4SHr; Fri, 15 Nov 2019 11:46:54 +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 61942185A7; Fri, 15 Nov 2019 11:46:54 +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 xAFBksAI042519; Fri, 15 Nov 2019 11:46:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFBksdZ042518; Fri, 15 Nov 2019 11:46:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911151146.xAFBksdZ042518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 15 Nov 2019 11:46:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354728 - head/sys/ofed/include/rdma X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/include/rdma X-SVN-Commit-Revision: 354728 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 11:46:54 -0000 Author: hselasky Date: Fri Nov 15 11:46:53 2019 New Revision: 354728 URL: https://svnweb.freebsd.org/changeset/base/354728 Log: Prevent potential underflow in ibcore. Linux commit: a9018adfde809d44e71189b984fa61cc89682b5e MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/include/rdma/ib_verbs.h Modified: head/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- head/sys/ofed/include/rdma/ib_verbs.h Fri Nov 15 11:45:14 2019 (r354727) +++ head/sys/ofed/include/rdma/ib_verbs.h Fri Nov 15 11:46:53 2019 (r354728) @@ -285,7 +285,7 @@ enum ib_cq_creation_flags { struct ib_cq_init_attr { unsigned int cqe; - int comp_vector; + u32 comp_vector; u32 flags; }; From owner-svn-src-head@freebsd.org Fri Nov 15 11:53:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98C971C4376; Fri, 15 Nov 2019 11:53:07 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DxYv3cKgz4b5D; Fri, 15 Nov 2019 11:53:07 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FDF318774; Fri, 15 Nov 2019 11:53:07 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFBr7Og047960; Fri, 15 Nov 2019 11:53:07 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFBr7D4047958; Fri, 15 Nov 2019 11:53:07 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911151153.xAFBr7D4047958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 15 Nov 2019 11:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354729 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 354729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 11:53:07 -0000 Author: scottl Date: Fri Nov 15 11:53:06 2019 New Revision: 354729 URL: https://svnweb.freebsd.org/changeset/base/354729 Log: Fix a typo in how the AVX512DQ feature bit is checked. Reviewed by: kib Sponsored by: Intel Modified: head/sys/x86/x86/busdma_machdep.c head/sys/x86/x86/cpu_machdep.c Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Fri Nov 15 11:46:53 2019 (r354728) +++ head/sys/x86/x86/busdma_machdep.c Fri Nov 15 11:53:06 2019 (r354729) @@ -236,6 +236,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (error); } +bus_dma_tag_t +bus_dma_tag_alloc(bus_dma_tag_t parent, bus_dma_props_t props) +{ + return (NULL); +} + int bus_dma_tag_destroy(bus_dma_tag_t dmat) { Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Fri Nov 15 11:46:53 2019 (r354728) +++ head/sys/x86/x86/cpu_machdep.c Fri Nov 15 11:53:06 2019 (r354729) @@ -1069,7 +1069,7 @@ hw_mds_recalculate(void) } xcr0 = rxcr(0); if ((xcr0 & XFEATURE_ENABLED_ZMM_HI256) != 0 && - (cpu_stdext_feature2 & CPUID_STDEXT_AVX512DQ) != 0) + (cpu_stdext_feature & CPUID_STDEXT_AVX512DQ) != 0) mds_handler = mds_handler_skl_avx512; else if ((xcr0 & XFEATURE_ENABLED_AVX) != 0 && (cpu_feature2 & CPUID2_AVX) != 0) From owner-svn-src-head@freebsd.org Fri Nov 15 11:54:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39E821C442B; Fri, 15 Nov 2019 11:54:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Dxbw0t07z4cWf; Fri, 15 Nov 2019 11:54:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00E9618776; Fri, 15 Nov 2019 11:54:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFBsprm048096; Fri, 15 Nov 2019 11:54:51 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFBspKw048095; Fri, 15 Nov 2019 11:54:51 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911151154.xAFBspKw048095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 15 Nov 2019 11:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354730 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 354730 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 11:54:52 -0000 Author: scottl Date: Fri Nov 15 11:54:51 2019 New Revision: 354730 URL: https://svnweb.freebsd.org/changeset/base/354730 Log: Revert a patch that accidentally was committed with r354729 Modified: head/sys/x86/x86/busdma_machdep.c Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Fri Nov 15 11:53:06 2019 (r354729) +++ head/sys/x86/x86/busdma_machdep.c Fri Nov 15 11:54:51 2019 (r354730) @@ -236,12 +236,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al return (error); } -bus_dma_tag_t -bus_dma_tag_alloc(bus_dma_tag_t parent, bus_dma_props_t props) -{ - return (NULL); -} - int bus_dma_tag_destroy(bus_dma_tag_t dmat) { From owner-svn-src-head@freebsd.org Fri Nov 15 13:45:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BABE51C7107; Fri, 15 Nov 2019 13:45:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F03l49wtz4CyG; Fri, 15 Nov 2019 13:45:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B58A19B24; Fri, 15 Nov 2019 13:45:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFDjdoo015616; Fri, 15 Nov 2019 13:45:39 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFDjdHP015615; Fri, 15 Nov 2019 13:45:39 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911151345.xAFDjdHP015615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 15 Nov 2019 13:45:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354731 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 13:45:39 -0000 Author: bz Date: Fri Nov 15 13:45:38 2019 New Revision: 354731 URL: https://svnweb.freebsd.org/changeset/base/354731 Log: nd6: simplify code We are taking the same actions in both cases of the branch inside the block. Simplify that code as the extra branch is not needed. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Fri Nov 15 11:54:51 2019 (r354730) +++ head/sys/netinet6/nd6.c Fri Nov 15 13:45:38 2019 (r354731) @@ -2328,13 +2328,7 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct } } if (lle == NULL) { - if (!(ND_IFINFO(ifp)->flags & ND6_IFF_PERFORMNUD)) { - m_freem(m); - return (ENOBUFS); - } - - if (m != NULL) - m_freem(m); + m_freem(m); return (ENOBUFS); } From owner-svn-src-head@freebsd.org Fri Nov 15 16:21:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 875961A9CB7; Fri, 15 Nov 2019 16:21:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F3Wv2ywLz4X2P; Fri, 15 Nov 2019 16:21:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 423D61B701; Fri, 15 Nov 2019 16:21:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFGLloW007416; Fri, 15 Nov 2019 16:21:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFGLl4Z007415; Fri, 15 Nov 2019 16:21:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201911151621.xAFGLl4Z007415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 15 Nov 2019 16:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354732 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 354732 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 16:21:47 -0000 Author: trasz Date: Fri Nov 15 16:21:46 2019 New Revision: 354732 URL: https://svnweb.freebsd.org/changeset/base/354732 Log: Support O_CLOEXEC in linux(4) open(2) and openat(2). Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21966 Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Fri Nov 15 13:45:38 2019 (r354731) +++ head/sys/compat/linux/linux_file.c Fri Nov 15 16:21:46 2019 (r354732) @@ -109,6 +109,8 @@ linux_common_open(struct thread *td, int dirfd, char * bsd_flags |= O_APPEND; if (l_flags & LINUX_O_SYNC) bsd_flags |= O_FSYNC; + if (l_flags & LINUX_O_CLOEXEC) + bsd_flags |= O_CLOEXEC; if (l_flags & LINUX_O_NONBLOCK) bsd_flags |= O_NONBLOCK; if (l_flags & LINUX_FASYNC) From owner-svn-src-head@freebsd.org Fri Nov 15 16:34:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CA581AA40E; Fri, 15 Nov 2019 16:34:36 +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 47F3ph0G2Bz40N7; Fri, 15 Nov 2019 16:34:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE65E1BA56; Fri, 15 Nov 2019 16:34:35 +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 xAFGYZOD017836; Fri, 15 Nov 2019 16:34:35 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFGYZxn017835; Fri, 15 Nov 2019 16:34:35 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201911151634.xAFGYZxn017835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 15 Nov 2019 16:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354733 - head/contrib/ntp/ntpd X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ntp/ntpd X-SVN-Commit-Revision: 354733 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 16:34:36 -0000 Author: cy Date: Fri Nov 15 16:34:35 2019 New Revision: 354733 URL: https://svnweb.freebsd.org/changeset/base/354733 Log: Disable ntpd stack gap. When ASLR with STACK GAP != 0 ntpd suffers SIGSEGV. PR: 241421, 241960 Reported by: Vladimir Zakharov , dewayne@heuristicsystems.com.au Reviewed by: kib, imp (previous version), ian (suggestion) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D22358 Modified: head/contrib/ntp/ntpd/ntpd.c Modified: head/contrib/ntp/ntpd/ntpd.c ============================================================================== --- head/contrib/ntp/ntpd/ntpd.c Fri Nov 15 16:21:46 2019 (r354732) +++ head/contrib/ntp/ntpd/ntpd.c Fri Nov 15 16:34:35 2019 (r354733) @@ -138,6 +138,17 @@ # include #endif /* LIBSECCOMP and KERN_SECCOMP */ +#ifdef __FreeBSD__ +#include +#ifndef PROC_STACKGAP_CTL +/* + * Even if we compile on an older system we can still run on a newer one. + */ +#define PROC_STACKGAP_CTL 17 +#define PROC_STACKGAP_DISABLE 0x0002 +#endif +#endif + #ifdef HAVE_DNSREGISTRATION # include DNSServiceRef mdns; @@ -402,6 +413,18 @@ main( char *argv[] ) { +#ifdef __FreeBSD__ + { + /* + * We Must disable ASLR stack gap on FreeBSD to avoid a + * segfault. See PR/241421 and PR/241960. + */ + int aslr_var = PROC_STACKGAP_DISABLE; + + pid_t my_pid = getpid(); + procctl(P_PID, my_pid, PROC_STACKGAP_CTL, &aslr_var); + } +#endif return ntpdmain(argc, argv); } #endif /* !SYS_WINNT */ From owner-svn-src-head@freebsd.org Fri Nov 15 16:43:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C10651AA996; Fri, 15 Nov 2019 16:43:37 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F4154FPfz4L4R; Fri, 15 Nov 2019 16:43:37 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 714CD1BC33; Fri, 15 Nov 2019 16:43:37 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFGhbri023974; Fri, 15 Nov 2019 16:43:37 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFGhbiJ023972; Fri, 15 Nov 2019 16:43:37 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201911151643.xAFGhbiJ023972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Fri, 15 Nov 2019 16:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354736 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 16:43:37 -0000 Author: arichardson Date: Fri Nov 15 16:43:36 2019 New Revision: 354736 URL: https://svnweb.freebsd.org/changeset/base/354736 Log: Use __ as the separator for the exported vars in bsd.compiler/linker.mk By using '__' instead of '.' as the separator we can also support systems that use dash as /bin/sh (it's the default shell on Ubuntu/Debian). Dash will unset any environment variables that use a non alphanumeric+undedscore character and therefore submakes will fail to import the COMPILER_* variables if we use '.' as the separator. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D22381 Modified: head/share/mk/bsd.compiler.mk head/share/mk/bsd.linker.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Fri Nov 15 16:40:55 2019 (r354735) +++ head/share/mk/bsd.compiler.mk Fri Nov 15 16:43:36 2019 (r354736) @@ -155,8 +155,8 @@ _can_export= no .endfor .if ${_can_export} == yes .for var in ${_exported_vars} -.if defined(${var}.${${X_}_cc_hash}) -${var}= ${${var}.${${X_}_cc_hash}} +.if defined(${var}__${${X_}_cc_hash}) +${var}= ${${var}__${${X_}_cc_hash}} .endif .endfor .endif @@ -229,9 +229,9 @@ X_COMPILER_FEATURES= ${COMPILER_FEATURES} # Export the values so sub-makes don't have to look them up again, using the # hash key computed above. .for var in ${_exported_vars} -${var}.${${X_}_cc_hash}:= ${${var}} -.export-env ${var}.${${X_}_cc_hash} -.undef ${var}.${${X_}_cc_hash} +${var}__${${X_}_cc_hash}:= ${${var}} +.export-env ${var}__${${X_}_cc_hash} +.undef ${var}__${${X_}_cc_hash} .endfor .endif # ${cc} == "CC" || !empty(XCC) Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Fri Nov 15 16:40:55 2019 (r354735) +++ head/share/mk/bsd.linker.mk Fri Nov 15 16:43:36 2019 (r354736) @@ -50,8 +50,8 @@ _can_export= no .endfor .if ${_can_export} == yes .for var in ${_exported_vars} -.if defined(${var}.${${X_}_ld_hash}) -${var}= ${${var}.${${X_}_ld_hash}} +.if defined(${var}__${${X_}_ld_hash}) +${var}= ${${var}__${${X_}_ld_hash}} .endif .endfor .endif @@ -101,9 +101,9 @@ X_LINKER_FREEBSD_VERSION= ${LINKER_FREEBSD_VERSION} # Export the values so sub-makes don't have to look them up again, using the # hash key computed above. .for var in ${_exported_vars} -${var}.${${X_}_ld_hash}:= ${${var}} -.export-env ${var}.${${X_}_ld_hash} -.undef ${var}.${${X_}_ld_hash} +${var}__${${X_}_ld_hash}:= ${${var}} +.export-env ${var}__${${X_}_ld_hash} +.undef ${var}__${${X_}_ld_hash} .endfor .endif # ${ld} == "LD" || !empty(XLD) From owner-svn-src-head@freebsd.org Fri Nov 15 18:02:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C6811AC175; Fri, 15 Nov 2019 18:02:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F5mF6lKzz40PJ; Fri, 15 Nov 2019 18:02:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAEF81CAA6; Fri, 15 Nov 2019 18:02:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFI2bWi071058; Fri, 15 Nov 2019 18:02:37 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFI2bTp071057; Fri, 15 Nov 2019 18:02:37 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911151802.xAFI2bTp071057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 15 Nov 2019 18:02:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354737 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 354737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 18:02:38 -0000 Author: glebius Date: Fri Nov 15 18:02:37 2019 New Revision: 354737 URL: https://svnweb.freebsd.org/changeset/base/354737 Log: Fix regression from r353841: ctx.rc needs to be initialized, otherwise driver might silently fail to initialize. Pointy hat to: glebius Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Nov 15 16:43:36 2019 (r354736) +++ head/sys/dev/cxgbe/t4_main.c Fri Nov 15 18:02:37 2019 (r354737) @@ -4998,6 +4998,7 @@ update_mac_settings(struct ifnet *ifp, int flags) ctx.hash = 0; ctx.i = 0; ctx.del = 1; + ctx.rc = 0; /* * Unlike other drivers, we accumulate list of pointers into * interface address lists and we need to keep it safe even From owner-svn-src-head@freebsd.org Fri Nov 15 18:09:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88A271AC290; Fri, 15 Nov 2019 18:09:18 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) (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 47F5vx0tWjz46jG; Fri, 15 Nov 2019 18:09:16 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0139E6F3; Fri, 15 Nov 2019 13:09:13 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 15 Nov 2019 13:09:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=/ K2DctMTNeyCmbq+RDLGpekQbI24oCLzELcBuGDeLrg=; b=QSydjZoPUlS4Whmqp gqDFZ2hElwwJ7Obv+PBb1MU4layXh+ue4zx/55CMlMcMRgiG6rlhpA+v36hC7dJp Gtj6kHU7Ipu2lRbsGJoo4Doqa5x14gLGN6E3NCY/cw6IohdNnQ7mgiMoezgaM2nT ZDw9hrYatxl0181vKilIeOuOn9g+3JPT+P9JYgCMpFMx8/LlTc3+YRlriPdXcKEp YGLn9yc3gQ7GpZP4RRxFTV5p6WY1jTIhVm1Lf72ldwbT2qMntmB2GbCQAoKQ+tww KgtdWxXMkAEm6MQX/UI3vF8t0RjJQtMBdEXYvGoiBMnoReXyO8ym/4EZOCWfkgZa i6Iaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=/K2DctMTNeyCmbq+RDLGpekQbI24oCLzELcBuGDeL rg=; b=tHPJvetd9Gv6BG6KDa2S4nQs11G8/4NJnmGfvrCsW1mCSxuR5EdDlw/YM G3vxCV5TMgvxfFGOQHj77g/g1lYNs7ZseWGQvBUQ1oz46/XYMOV/I0bx9XO2d5O7 IsJzgMLxIbEmBbuBwwFTqmIb+wb+tFK7WrjIeU+KCyClOLyDYVaPPznWWNVHAZIx IuKNo9B9iWV3Ia+eCI3BRZNKVKQqGkgAGqC+/2jF+aoemLclHftzpdfFIJCXWple bl+nG1DXq3ERIDUzBzz9BVN5NErEhStPchLebPXflAU4WsBRa7ZB7OC4PiSW4U9+ +bLMgI6M4FlB4sobbKVymY7EtHKzQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudefhedguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesth hqmhdthhdtjeenucfhrhhomhepufgtohhtthcunfhonhhguceoshgtohhtthhlsehsrghm shgtohdrohhrgheqnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppeekrd egiedrkeelrddvudefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehstghothhtlhesshgr mhhstghordhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.0.129] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id E363280059; Fri, 15 Nov 2019 13:09:12 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r354703 - head/sys/dev/ioat From: Scott Long In-Reply-To: <20191115091837.GD2707@kib.kiev.ua> Date: Fri, 15 Nov 2019 11:09:12 -0700 Cc: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <842A5858-39B8-4196-8A94-018FA37DE75E@samsco.org> References: <201911140439.xAE4dngZ032224@repo.freebsd.org> <20191114101149.GA2707@kib.kiev.ua> <475757c6-3707-540b-0316-cbef278043c2@FreeBSD.org> <20191115091837.GD2707@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 47F5vx0tWjz46jG X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=samsco.org header.s=fm1 header.b=QSydjZoP; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=tHPJvetd; dmarc=none; spf=pass (mx1.freebsd.org: domain of scottl@samsco.org designates 64.147.123.24 as permitted sender) smtp.mailfrom=scottl@samsco.org X-Spamd-Result: default: False [-5.59 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[samsco.org:s=fm1,messagingengine.com:s=fm1]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:64.147.123.24]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[samsco.org]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[samsco.org:+,messagingengine.com:+]; IP_SCORE(-3.49)[ip: (-9.79), ipnet: 64.147.123.0/24(-4.91), asn: 11403(-2.68), country: US(-0.05)]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_IN_DNSWL_LOW(-0.10)[24.123.147.64.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 18:09:18 -0000 > On Nov 15, 2019, at 2:18 AM, Konstantin Belousov = wrote: >=20 > On Thu, Nov 14, 2019 at 09:41:36AM -0500, Alexander Motin wrote: >> On 14.11.2019 05:11, Konstantin Belousov wrote: >>> On Thu, Nov 14, 2019 at 04:39:49AM +0000, Alexander Motin wrote: >>>> Author: mav >>>> Date: Thu Nov 14 04:39:48 2019 >>>> New Revision: 354703 >>>> URL: https://svnweb.freebsd.org/changeset/base/354703 >>>>=20 >>>> Log: >>>> Pass more reasonable WAIT flags to bus_dma(9) calls. >>>>=20 >>>> MFC after: 2 weeks >>>>=20 >>>> Modified: >>>> head/sys/dev/ioat/ioat.c >>>>=20 >>>> Modified: head/sys/dev/ioat/ioat.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/dev/ioat/ioat.c Thu Nov 14 04:34:58 2019 = (r354702) >>>> +++ head/sys/dev/ioat/ioat.c Thu Nov 14 04:39:48 2019 = (r354703) >>>> @@ -555,13 +555,14 @@ ioat3_attach(device_t device) >>>> &ioat->comp_update_tag); >>>>=20 >>>> error =3D bus_dmamem_alloc(ioat->comp_update_tag, >>>> - (void **)&ioat->comp_update, BUS_DMA_ZERO, = &ioat->comp_update_map); >>>> + (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, >>>> + &ioat->comp_update_map); >>> For waitok, you need to provide locking function in the tag. >>=20 >> I'm sorry, but why? It is alloc(), not load(). For load() it makes >> sense since it calls back, but this is just a form of malloc(), isn't >> it? I've looked through the both x86 implementations and found = nothing >> suspicious. >=20 > I see. Still, if you (or somebody else) ever decided to use WAITOK = loads,=20 > it would be much safer to provide the lock function now. >=20 Loads are always non-blocking, and the WAITOK flag is not part of that API. A load may defer its callback, and the asynchronous execution of = that callback is why we have the loaned lock. If a blocking alloc is = performed in a context where the caller holds a lock, then it=E2=80=99s the = caller=E2=80=99s responsibility to indicate NOWAIT and deal with the possible failure. Just like with malloc and contigmalloc, the API does not, nor will it ever, drop and require locks on behalf of the caller. The API tried to enforce the = practice that static resource allocation should happen at initialization time = when locks don=E2=80=99t need to be held. It=E2=80=99s unfortunate that the NOWAIT flag is overloaded for = different meanings in the load functions vs the alloc functions. Maybe this is what is = causing confusion? TL;DR: ALexander=E2=80=99s change is correct. Scott From owner-svn-src-head@freebsd.org Fri Nov 15 18:34:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 676141ACF3D; Fri, 15 Nov 2019 18:34:24 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F6Sw1RRLz3D5P; Fri, 15 Nov 2019 18:34:24 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C6891D032; Fri, 15 Nov 2019 18:34:24 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFIYN69088805; Fri, 15 Nov 2019 18:34:23 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFIYNIe088804; Fri, 15 Nov 2019 18:34:23 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201911151834.xAFIYNIe088804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Fri, 15 Nov 2019 18:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354738 - head/usr.sbin/makefs X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/usr.sbin/makefs X-SVN-Commit-Revision: 354738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 18:34:24 -0000 Author: arichardson Date: Fri Nov 15 18:34:23 2019 New Revision: 354738 URL: https://svnweb.freebsd.org/changeset/base/354738 Log: Fix contents= being ignored in msdosfs makefs mtree I noticed this while trying to build an EFI boot image Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D22387 Modified: head/usr.sbin/makefs/msdos.c Modified: head/usr.sbin/makefs/msdos.c ============================================================================== --- head/usr.sbin/makefs/msdos.c Fri Nov 15 18:02:37 2019 (r354737) +++ head/usr.sbin/makefs/msdos.c Fri Nov 15 18:34:23 2019 (r354738) @@ -262,7 +262,8 @@ msdos_populate_dir(const char *path, struct denode *di cur->name); continue; } - if (msdosfs_mkfile(pbuf, dir, cur) == NULL) { + if (msdosfs_mkfile(cur->contents ? cur->contents : pbuf, dir, + cur) == NULL) { warn("msdosfs_mkfile %s", pbuf); return -1; } From owner-svn-src-head@freebsd.org Fri Nov 15 18:34:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9968E1ACF71; Fri, 15 Nov 2019 18:34:31 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F6T33XLCz3DNy; Fri, 15 Nov 2019 18:34:31 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8249F1D033; Fri, 15 Nov 2019 18:34:30 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFIYUS2088861; Fri, 15 Nov 2019 18:34:30 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFIYUes088860; Fri, 15 Nov 2019 18:34:30 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201911151834.xAFIYUes088860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Fri, 15 Nov 2019 18:34:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354739 - head/usr.sbin/makefs X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/usr.sbin/makefs X-SVN-Commit-Revision: 354739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 18:34:31 -0000 Author: arichardson Date: Fri Nov 15 18:34:30 2019 New Revision: 354739 URL: https://svnweb.freebsd.org/changeset/base/354739 Log: makefs: Also set UFS di_birthtime when building on Linux Since st_birthtime doesn't exists on Linux (unless you use statx(2)), we instead populate it with the st_ctime value. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D22386 Modified: head/usr.sbin/makefs/ffs.c Modified: head/usr.sbin/makefs/ffs.c ============================================================================== --- head/usr.sbin/makefs/ffs.c Fri Nov 15 18:34:23 2019 (r354738) +++ head/usr.sbin/makefs/ffs.c Fri Nov 15 18:34:30 2019 (r354739) @@ -728,15 +728,22 @@ ffs_build_dinode2(struct ufs2_dinode *dinp, dirbuf_t * dinp->di_atime = st->st_atime; dinp->di_mtime = st->st_mtime; dinp->di_ctime = st->st_ctime; +#if HAVE_STRUCT_STAT_BIRTHTIME + dinp->di_birthtime = st->st_birthtime; +#else + dinp->di_birthtime = st->st_ctime; +#endif #if HAVE_STRUCT_STAT_ST_MTIMENSEC dinp->di_atimensec = st->st_atimensec; dinp->di_mtimensec = st->st_mtimensec; dinp->di_ctimensec = st->st_ctimensec; -#endif #if HAVE_STRUCT_STAT_BIRTHTIME - dinp->di_birthtime = st->st_birthtime; dinp->di_birthnsec = st->st_birthtimensec; +#else + dinp->di_birthnsec = st->st_ctimensec; #endif +#endif + /* not set: di_db, di_ib, di_blocks, di_spare */ membuf = NULL; From owner-svn-src-head@freebsd.org Fri Nov 15 18:34:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D8E71ACFB4; Fri, 15 Nov 2019 18:34:37 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F6T922nWz3DZB; Fri, 15 Nov 2019 18:34:37 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A17261D037; Fri, 15 Nov 2019 18:34:36 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFIYaO2088915; Fri, 15 Nov 2019 18:34:36 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFIYaFL088914; Fri, 15 Nov 2019 18:34:36 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201911151834.xAFIYaFL088914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Fri, 15 Nov 2019 18:34:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354740 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 18:34:37 -0000 Author: arichardson Date: Fri Nov 15 18:34:36 2019 New Revision: 354740 URL: https://svnweb.freebsd.org/changeset/base/354740 Log: Fix build race in bsd.files.mk We need to ensure that installdirs-FOO runs before installfiles-FOO since otherwise the directory may not exist when we attempt to install the target. This was randomly causing failures in our Jenkins instance when installing drti.o in cddl/lib/drti. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D22382 Modified: head/share/mk/bsd.files.mk Modified: head/share/mk/bsd.files.mk ============================================================================== --- head/share/mk/bsd.files.mk Fri Nov 15 18:34:30 2019 (r354739) +++ head/share/mk/bsd.files.mk Fri Nov 15 18:34:36 2019 (r354740) @@ -112,12 +112,11 @@ STAGE_AS_SETS+= ${${_${group}DIR_${file}}:C,[/*],_,g} STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}} stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file} -installfiles-${group}: _${group}INS1_${file} -_${group}INS1_${file}: installdirs-${_${group}DIR_${file}} _${group}INS_${file} -_${group}INS_${file}: ${file} +installfiles-${group}: _${group}INS_${file} +_${group}INS_${file}: ${file} installdirs-${_${group}DIR_${file}} ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \ -g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \ - ${.ALLSRC} ${${group}PREFIX_${file}}/${${group}NAME_${file}} + ${.ALLSRC:[1]} ${${group}PREFIX_${file}}/${${group}NAME_${file}} .endfor # file in ${${group}} .endif # defined(${group}) && !empty(${group}) From owner-svn-src-head@freebsd.org Fri Nov 15 18:42:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53EB91AD744; Fri, 15 Nov 2019 18:42:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F6f11YpSz40wx; Fri, 15 Nov 2019 18:42:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18B1E1D1E7; Fri, 15 Nov 2019 18:42:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFIgGnV093733; Fri, 15 Nov 2019 18:42:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFIgDrJ093716; Fri, 15 Nov 2019 18:42:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911151842.xAFIgDrJ093716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 15 Nov 2019 18:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354741 - in head/sys: amd64/amd64 arm/arm arm64/arm64 compat/freebsd32 compat/ia32 i386/i386 kern mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64 sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm/arm arm64/arm64 compat/freebsd32 compat/ia32 i386/i386 kern mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64 sys X-SVN-Commit-Revision: 354741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 18:42:17 -0000 Author: jhb Date: Fri Nov 15 18:42:13 2019 New Revision: 354741 URL: https://svnweb.freebsd.org/changeset/base/354741 Log: Add a sv_copyout_auxargs() hook in sysentvec. Change the FreeBSD ELF ABIs to use this new hook to copyout ELF auxv instead of doing it in the sv_fixup hook. In particular, this new hook allows the stack space to be allocated at the same time the auxv values are copied out to userland. This allows us to avoid wasting space for unused auxv entries as well as not having to recalculate where the auxv vector is by walking back up over the argv and environment vectors. Reviewed by: brooks, emaste Tested on: amd64 (amd64 and i386 binaries), i386, mips, mips64 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22355 Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/arm/arm/elf_machdep.c head/sys/arm64/arm64/elf32_machdep.c head/sys/arm64/arm64/elf_machdep.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/ia32/ia32_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/kern/imgact_elf.c head/sys/kern/kern_exec.c head/sys/mips/mips/elf_machdep.c head/sys/mips/mips/freebsd32_machdep.c head/sys/powerpc/powerpc/elf32_machdep.c head/sys/powerpc/powerpc/elf64_machdep.c head/sys/riscv/riscv/elf_machdep.c head/sys/sparc64/sparc64/elf_machdep.c head/sys/sys/imgact_elf.h head/sys/sys/sysent.h Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/amd64/amd64/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -68,6 +68,7 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/arm/arm/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -75,6 +75,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/arm64/arm64/elf32_machdep.c ============================================================================== --- head/sys/arm64/arm64/elf32_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/arm64/arm64/elf32_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -92,6 +92,7 @@ static struct sysentvec elf32_freebsd_sysvec = { .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, + .sv_copyout_auxargs = elf32_freebsd_copyout_auxargs, .sv_copyout_strings = freebsd32_copyout_strings, .sv_setregs = freebsd32_setregs, .sv_fixlimit = NULL, // XXX Modified: head/sys/arm64/arm64/elf_machdep.c ============================================================================== --- head/sys/arm64/arm64/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/arm64/arm64/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -76,6 +76,7 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/compat/freebsd32/freebsd32_misc.c Fri Nov 15 18:42:13 2019 (r354741) @@ -3195,14 +3195,8 @@ freebsd32_copyout_strings(struct image_params *imgp) if (imgp->sysent->sv_stackgap != NULL) imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp); - if (imgp->auxargs) { - /* - * Allocate room on the stack for the ELF auxargs - * array. It has up to AT_COUNT entries. - */ - vectp -= howmany(AT_COUNT * sizeof(Elf32_Auxinfo), - sizeof(*vectp)); - } + if (imgp->auxargs) + imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); /* * Allocate room for the argv[] and env vectors including the Modified: head/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- head/sys/compat/ia32/ia32_sysvec.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/compat/ia32/ia32_sysvec.c Fri Nov 15 18:42:13 2019 (r354741) @@ -114,6 +114,7 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = elf32_freebsd_copyout_auxargs, .sv_copyout_strings = freebsd32_copyout_strings, .sv_setregs = ia32_setregs, .sv_fixlimit = ia32_fixlimit, Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/i386/i386/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -70,6 +70,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/kern/imgact_elf.c Fri Nov 15 18:42:13 2019 (r354741) @@ -1289,7 +1289,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i addr = et_dyn_addr; /* - * Construct auxargs table (used by the fixup routine) + * Construct auxargs table (used by the copyout_auxargs routine) */ elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_NOWAIT); if (elf_auxargs == NULL) { @@ -1323,16 +1323,13 @@ ret: #define suword __CONCAT(suword, __ELF_WORD_SIZE) -int -__elfN(freebsd_fixup)(register_t **stack_base, struct image_params *imgp) +void +__elfN(freebsd_copyout_auxargs)(struct image_params *imgp, u_long *base) { Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs; Elf_Auxinfo *argarray, *pos; - Elf_Addr *base, *auxbase; - int error; + u_long auxlen; - base = (Elf_Addr *)*stack_base; - auxbase = base + imgp->args->argc + 1 + imgp->args->envc + 1; argarray = pos = malloc(AT_COUNT * sizeof(*pos), M_TEMP, M_WAITOK | M_ZERO); @@ -1376,11 +1373,18 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct imgp->auxargs = NULL; KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs")); - error = copyout(argarray, auxbase, sizeof(*argarray) * AT_COUNT); + auxlen = sizeof(*argarray) * (pos - argarray); + *base -= auxlen; + copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); - if (error != 0) - return (error); +} +int +__elfN(freebsd_fixup)(register_t **stack_base, struct image_params *imgp) +{ + Elf_Addr *base; + + base = (Elf_Addr *)*stack_base; base--; if (suword(base, imgp->args->argc) == -1) return (EFAULT); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/kern/kern_exec.c Fri Nov 15 18:42:13 2019 (r354741) @@ -1637,14 +1637,8 @@ exec_copyout_strings(struct image_params *imgp) if (imgp->sysent->sv_stackgap != NULL) imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp); - if (imgp->auxargs) { - /* - * Allocate room on the stack for the ELF auxargs - * array. It has up to AT_COUNT entries. - */ - vectp -= howmany(AT_COUNT * sizeof(Elf_Auxinfo), - sizeof(*vectp)); - } + if (imgp->auxargs) + imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); /* * Allocate room for the argv[] and env vectors including the Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/mips/mips/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -71,6 +71,7 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, @@ -125,6 +126,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/mips/mips/freebsd32_machdep.c ============================================================================== --- head/sys/mips/mips/freebsd32_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/mips/mips/freebsd32_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -94,6 +94,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = freebsd32_copyout_strings, .sv_setregs = freebsd32_exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf32_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/powerpc/powerpc/elf32_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -87,6 +87,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_errtbl = NULL, .sv_transtrap = NULL, .sv_fixup = __elfN(freebsd_fixup), + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_sendsig = sendsig, .sv_sigcode = sigcode32, .sv_szsigcode = &szsigcode32, Modified: head/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf64_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/powerpc/powerpc/elf64_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -74,6 +74,7 @@ struct sysentvec elf64_freebsd_sysvec_v1 = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs_funcdesc, .sv_fixlimit = NULL, @@ -111,6 +112,7 @@ struct sysentvec elf64_freebsd_sysvec_v2 = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/riscv/riscv/elf_machdep.c ============================================================================== --- head/sys/riscv/riscv/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/riscv/riscv/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -79,6 +79,7 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/sparc64/sparc64/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) @@ -75,6 +75,7 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/sys/imgact_elf.h ============================================================================== --- head/sys/sys/imgact_elf.h Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/sys/imgact_elf.h Fri Nov 15 18:42:13 2019 (r354741) @@ -99,6 +99,7 @@ int __elfN(freebsd_fixup)(register_t **, struct image_ int __elfN(coredump)(struct thread *, struct vnode *, off_t, int); size_t __elfN(populate_note)(int, void *, void *, size_t, void **); void __elfN(stackgap)(struct image_params *, u_long *); +void __elfN(freebsd_copyout_auxargs)(struct image_params *, u_long *); /* Machine specific function to dump per-thread information. */ void __elfN(dump_thread)(struct thread *, void *, size_t *); Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Fri Nov 15 18:34:36 2019 (r354740) +++ head/sys/sys/sysent.h Fri Nov 15 18:42:13 2019 (r354741) @@ -110,6 +110,7 @@ struct sysentvec { /* function to dump core, or NULL */ int (*sv_imgact_try)(struct image_params *); void (*sv_stackgap)(struct image_params *, u_long *); + void (*sv_copyout_auxargs)(struct image_params *, u_long *); int sv_minsigstksz; /* minimum signal stack size */ vm_offset_t sv_minuser; /* VM_MIN_ADDRESS */ vm_offset_t sv_maxuser; /* VM_MAXUSER_ADDRESS */ From owner-svn-src-head@freebsd.org Fri Nov 15 18:48:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3EED1ADAFB; Fri, 15 Nov 2019 18:48:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F6mv3hYrz4DX5; Fri, 15 Nov 2019 18:48:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A7681D218; Fri, 15 Nov 2019 18:48:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFImEA8095346; Fri, 15 Nov 2019 18:48:14 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFImEsW095342; Fri, 15 Nov 2019 18:48:14 GMT (envelope-from np@FreeBSD.org) Message-Id: <201911151848.xAFImEsW095342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 15 Nov 2019 18:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354742 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 354742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 18:48:16 -0000 Author: np Date: Fri Nov 15 18:48:14 2019 New Revision: 354742 URL: https://svnweb.freebsd.org/changeset/base/354742 Log: cxgbev(4): Catch up with the pciids in the PF driver. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_iov.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/t4_iov.c ============================================================================== --- head/sys/dev/cxgbe/t4_iov.c Fri Nov 15 18:42:13 2019 (r354741) +++ head/sys/dev/cxgbe/t4_iov.c Fri Nov 15 18:48:14 2019 (r354742) @@ -81,16 +81,10 @@ struct { {0x5012, "Chelsio T560-CR"}, /* 1 x 40G, 2 x 10G */ {0x5014, "Chelsio T580-LP-SO-CR"}, /* 2 x 40G, nomem */ {0x5015, "Chelsio T502-BT"}, /* 2 x 1G */ -#ifdef notyet - {0x5004, "Chelsio T520-BCH"}, - {0x5005, "Chelsio T540-BCH"}, - {0x5006, "Chelsio T540-CH"}, - {0x5008, "Chelsio T520-CX"}, - {0x500b, "Chelsio B520-SR"}, - {0x500c, "Chelsio B504-BT"}, - {0x500f, "Chelsio Amsterdam"}, - {0x5013, "Chelsio T580-CHR"}, -#endif + {0x5018, "Chelsio T540-BT"}, /* 4 x 10GBaseT */ + {0x5019, "Chelsio T540-LP-BT"}, /* 4 x 10GBaseT */ + {0x501a, "Chelsio T540-SO-BT"}, /* 4 x 10GBaseT, nomem */ + {0x501b, "Chelsio T540-SO-CR"}, /* 4 x 10G, nomem */ }, t6iov_pciids[] = { {0x6000, "Chelsio T6-DBG-25"}, /* 2 x 10/25G, debug */ {0x6001, "Chelsio T6225-CR"}, /* 2 x 10/25G */ @@ -111,6 +105,12 @@ struct { /* Custom */ {0x6080, "Chelsio T6225 80"}, {0x6081, "Chelsio T62100 81"}, + {0x6082, "Chelsio T6225-CR 82"}, + {0x6083, "Chelsio T62100-CR 83"}, + {0x6084, "Chelsio T64100-CR 84"}, + {0x6085, "Chelsio T6240-SO 85"}, + {0x6086, "Chelsio T6225-SO-CR 86"}, + {0x6087, "Chelsio T6225-CR 87"}, }; static int t4iov_attach_child(device_t dev); Modified: head/sys/dev/cxgbe/t4_vf.c ============================================================================== --- head/sys/dev/cxgbe/t4_vf.c Fri Nov 15 18:42:13 2019 (r354741) +++ head/sys/dev/cxgbe/t4_vf.c Fri Nov 15 18:48:14 2019 (r354742) @@ -97,16 +97,10 @@ struct { {0x5812, "Chelsio T560-CR VF"}, /* 1 x 40G, 2 x 10G */ {0x5814, "Chelsio T580-LP-SO-CR VF"}, /* 2 x 40G, nomem */ {0x5815, "Chelsio T502-BT VF"}, /* 2 x 1G */ -#ifdef notyet - {0x5804, "Chelsio T520-BCH VF"}, - {0x5805, "Chelsio T540-BCH VF"}, - {0x5806, "Chelsio T540-CH VF"}, - {0x5808, "Chelsio T520-CX VF"}, - {0x580b, "Chelsio B520-SR VF"}, - {0x580c, "Chelsio B504-BT VF"}, - {0x580f, "Chelsio Amsterdam VF"}, - {0x5813, "Chelsio T580-CHR VF"}, -#endif + {0x5818, "Chelsio T540-BT VF"}, /* 4 x 10GBaseT */ + {0x5819, "Chelsio T540-LP-BT VF"}, /* 4 x 10GBaseT */ + {0x581a, "Chelsio T540-SO-BT VF"}, /* 4 x 10GBaseT, nomem */ + {0x581b, "Chelsio T540-SO-CR VF"}, /* 4 x 10G, nomem */ }, t6vf_pciids[] = { {0x6800, "Chelsio T6-DBG-25 VF"}, /* 2 x 10/25G, debug */ {0x6801, "Chelsio T6225-CR VF"}, /* 2 x 10/25G */ @@ -127,6 +121,12 @@ struct { /* Custom */ {0x6880, "Chelsio T6225 80 VF"}, {0x6881, "Chelsio T62100 81 VF"}, + {0x6882, "Chelsio T6225-CR 82 VF"}, + {0x6883, "Chelsio T62100-CR 83 VF"}, + {0x6884, "Chelsio T64100-CR 84 VF"}, + {0x6885, "Chelsio T6240-SO 85 VF"}, + {0x6886, "Chelsio T6225-SO-CR 86 VF"}, + {0x6887, "Chelsio T6225-CR 87 VF"}, }; static d_ioctl_t t4vf_ioctl; From owner-svn-src-head@freebsd.org Fri Nov 15 18:57:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 515911ADF9B; Fri, 15 Nov 2019 18:57:01 +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 47F6z11Fdrz4WWX; Fri, 15 Nov 2019 18:57:01 +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 F2D741D3F7; Fri, 15 Nov 2019 18:57: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 xAFIv0il001178; Fri, 15 Nov 2019 18:57:00 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFIv0FU001177; Fri, 15 Nov 2019 18:57:00 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911151857.xAFIv0FU001177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 15 Nov 2019 18:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354743 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 354743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 18:57:01 -0000 Author: tsoome Date: Fri Nov 15 18:57:00 2019 New Revision: 354743 URL: https://svnweb.freebsd.org/changeset/base/354743 Log: loader: r354415 did miss to sort subpaths below the partitions Tested on actual system (MBP with UEFI 1.10). Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Fri Nov 15 18:48:14 2019 (r354742) +++ head/stand/efi/libefi/efipart.c Fri Nov 15 18:57:00 2019 (r354743) @@ -506,9 +506,12 @@ efipart_initcd(void) static bool efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH *node) { - pdinfo_t *pd, *last; - VENDOR_DEVICE_PATH *ven_node; + pdinfo_t *pd, *ptr; + if (node == NULL) + return (false); + + /* Find our disk device. */ STAILQ_FOREACH(pd, &hdinfo, pd_link) { if (efi_devpath_is_prefix(pd->pd_devpath, hd->pd_devpath)) break; @@ -516,13 +519,28 @@ efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH if (pd == NULL) return (false); + /* If the node is not MEDIA_HARDDRIVE_DP, it is sub-partition. */ + if (DevicePathSubType(node) != MEDIA_HARDDRIVE_DP) { + STAILQ_FOREACH(ptr, &pd->pd_part, pd_link) { + if (efi_devpath_is_prefix(ptr->pd_devpath, + hd->pd_devpath)) + break; + } + /* + * ptr == NULL means we have handles in unexpected order + * and we would need to re-order the partitions later. + */ + if (ptr != NULL) + pd = ptr; + } + /* Add the partition. */ if (DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) { hd->pd_unit = ((HARDDRIVE_DEVICE_PATH *)node)->PartitionNumber; } else { - last = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); - if (last != NULL) - hd->pd_unit = last->pd_unit + 1; + ptr = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); + if (ptr != NULL) + hd->pd_unit = ptr->pd_unit + 1; else hd->pd_unit = 0; } From owner-svn-src-head@freebsd.org Fri Nov 15 19:00:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 902AD1AE0A7; Fri, 15 Nov 2019 19:00:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47F72s3Mj5z4df5; Fri, 15 Nov 2019 19:00:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 585B61D416; Fri, 15 Nov 2019 19:00:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFJ0LUx001432; Fri, 15 Nov 2019 19:00:21 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFJ0Lrw001431; Fri, 15 Nov 2019 19:00:21 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911151900.xAFJ0Lrw001431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 15 Nov 2019 19:00:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354744 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 354744 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 19:00:21 -0000 Author: jhb Date: Fri Nov 15 19:00:20 2019 New Revision: 354744 URL: https://svnweb.freebsd.org/changeset/base/354744 Log: Combine ELF sysvecs for MIPS to reduce code duplication. Reviewed by: brooks, kevans Tested on: mips, mips64 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22357 Modified: head/sys/mips/mips/elf_machdep.c Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Fri Nov 15 18:57:00 2019 (r354743) +++ head/sys/mips/mips/elf_machdep.c Fri Nov 15 19:00:20 2019 (r354744) @@ -51,8 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __mips_n64 -struct sysentvec elf64_freebsd_sysvec = { +static struct sysentvec elf_freebsd_sysvec = { .sv_size = SYS_MAXSYSCALL, .sv_table = sysent, .sv_errsize = 0, @@ -62,62 +61,11 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_sendsig = sendsig, .sv_sigcode = sigcode, .sv_szsigcode = &szsigcode, +#ifdef __mips_n64 .sv_name = "FreeBSD ELF64", - .sv_coredump = __elfN(coredump), - .sv_imgact_try = NULL, - .sv_minsigstksz = MINSIGSTKSZ, - .sv_minuser = VM_MIN_ADDRESS, - .sv_maxuser = VM_MAXUSER_ADDRESS, - .sv_usrstack = USRSTACK, - .sv_psstrings = PS_STRINGS, - .sv_stackprot = VM_PROT_ALL, - .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), - .sv_copyout_strings = exec_copyout_strings, - .sv_setregs = exec_setregs, - .sv_fixlimit = NULL, - .sv_maxssiz = NULL, - .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_ASLR, - .sv_set_syscall_retval = cpu_set_syscall_retval, - .sv_fetch_syscall_args = cpu_fetch_syscall_args, - .sv_syscallnames = syscallnames, - .sv_schedtail = NULL, - .sv_thread_detach = NULL, - .sv_trap = NULL, -}; - -static Elf64_Brandinfo freebsd_brand_info = { - .brand = ELFOSABI_FREEBSD, - .machine = EM_MIPS, - .compat_3_brand = "FreeBSD", - .emul_path = NULL, - .interp_path = "/libexec/ld-elf.so.1", - .sysvec = &elf64_freebsd_sysvec, - .interp_newpath = NULL, - .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE -}; - -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t) elf64_insert_brand_entry, - &freebsd_brand_info); - -void -elf64_dump_thread(struct thread *td __unused, void *dst __unused, - size_t *off __unused) -{ -} #else -struct sysentvec elf32_freebsd_sysvec = { - .sv_size = SYS_MAXSYSCALL, - .sv_table = sysent, - .sv_errsize = 0, - .sv_errtbl = NULL, - .sv_transtrap = NULL, - .sv_fixup = __elfN(freebsd_fixup), - .sv_sendsig = sendsig, - .sv_sigcode = sigcode, - .sv_szsigcode = &szsigcode, .sv_name = "FreeBSD ELF32", +#endif .sv_coredump = __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, @@ -131,7 +79,11 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_setregs = exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, +#ifdef __mips_n64 + .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_ASLR, +#else .sv_flags = SV_ABI_FREEBSD | SV_ILP32 | SV_ASLR, +#endif .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, @@ -140,28 +92,27 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_trap = NULL, }; -static Elf32_Brandinfo freebsd_brand_info = { +static __ElfN(Brandinfo) freebsd_brand_info = { .brand = ELFOSABI_FREEBSD, .machine = EM_MIPS, .compat_3_brand = "FreeBSD", .emul_path = NULL, .interp_path = "/libexec/ld-elf.so.1", - .sysvec = &elf32_freebsd_sysvec, + .sysvec = &elf_freebsd_sysvec, .interp_newpath = NULL, - .brand_note = &elf32_freebsd_brandnote, + .brand_note = &__elfN(freebsd_brandnote), .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, - (sysinit_cfunc_t) elf32_insert_brand_entry, +SYSINIT(elf, SI_SUB_EXEC, SI_ORDER_ANY, + (sysinit_cfunc_t) __elfN(insert_brand_entry), &freebsd_brand_info); void -elf32_dump_thread(struct thread *td __unused, void *dst __unused, +__elfN(dump_thread)(struct thread *td __unused, void *dst __unused, size_t *off __unused) { } -#endif /* * The following MIPS relocation code for tracking multiple From owner-svn-src-head@freebsd.org Fri Nov 15 20:01:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 056701AF241; Fri, 15 Nov 2019 20:01:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47F8PB3msJz3yXh; Fri, 15 Nov 2019 20:01:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAFK18QH029252 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 15 Nov 2019 22:01:12 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAFK18QH029252 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAFK18Sr029251; Fri, 15 Nov 2019 22:01:08 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 15 Nov 2019 22:01:08 +0200 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354741 - in head/sys: amd64/amd64 arm/arm arm64/arm64 compat/freebsd32 compat/ia32 i386/i386 kern mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64 sys Message-ID: <20191115200108.GH2707@kib.kiev.ua> References: <201911151842.xAFIgDrJ093716@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201911151842.xAFIgDrJ093716@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47F8PB3msJz3yXh X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; R_SPF_SOFTFAIL(0.00)[~all:c]; IP_SCORE_FREEMAIL(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(0.00)[ip: (-2.72), ipnet: 2001:470::/32(-4.62), asn: 6939(-3.49), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 20:01:20 -0000 On Fri, Nov 15, 2019 at 06:42:13PM +0000, John Baldwin wrote: > Author: jhb > Date: Fri Nov 15 18:42:13 2019 > New Revision: 354741 > URL: https://svnweb.freebsd.org/changeset/base/354741 > > Log: > Add a sv_copyout_auxargs() hook in sysentvec. > > Change the FreeBSD ELF ABIs to use this new hook to copyout ELF auxv > instead of doing it in the sv_fixup hook. In particular, this new > hook allows the stack space to be allocated at the same time the auxv > values are copied out to userland. This allows us to avoid wasting > space for unused auxv entries as well as not having to recalculate > where the auxv vector is by walking back up over the argv and > environment vectors. > > Reviewed by: brooks, emaste > Tested on: amd64 (amd64 and i386 binaries), i386, mips, mips64 > Sponsored by: DARPA > Differential Revision: https://reviews.freebsd.org/D22355 > > Modified: > head/sys/amd64/amd64/elf_machdep.c > head/sys/arm/arm/elf_machdep.c > head/sys/arm64/arm64/elf32_machdep.c > head/sys/arm64/arm64/elf_machdep.c > head/sys/compat/freebsd32/freebsd32_misc.c > head/sys/compat/ia32/ia32_sysvec.c > head/sys/i386/i386/elf_machdep.c > head/sys/kern/imgact_elf.c > head/sys/kern/kern_exec.c > head/sys/mips/mips/elf_machdep.c > head/sys/mips/mips/freebsd32_machdep.c > head/sys/powerpc/powerpc/elf32_machdep.c > head/sys/powerpc/powerpc/elf64_machdep.c > head/sys/riscv/riscv/elf_machdep.c > head/sys/sparc64/sparc64/elf_machdep.c > head/sys/sys/imgact_elf.h > head/sys/sys/sysent.h > > Modified: head/sys/amd64/amd64/elf_machdep.c > ============================================================================== > --- head/sys/amd64/amd64/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) > +++ head/sys/amd64/amd64/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) > @@ -68,6 +68,7 @@ struct sysentvec elf64_freebsd_sysvec = { > .sv_usrstack = USRSTACK, > .sv_psstrings = PS_STRINGS, > .sv_stackprot = VM_PROT_ALL, > + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > > Modified: head/sys/arm/arm/elf_machdep.c > ============================================================================== > --- head/sys/arm/arm/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) > +++ head/sys/arm/arm/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) > @@ -75,6 +75,7 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_usrstack = USRSTACK, > .sv_psstrings = PS_STRINGS, > .sv_stackprot = VM_PROT_ALL, > + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > > Modified: head/sys/arm64/arm64/elf32_machdep.c > ============================================================================== > --- head/sys/arm64/arm64/elf32_machdep.c Fri Nov 15 18:34:36 2019 (r354740) > +++ head/sys/arm64/arm64/elf32_machdep.c Fri Nov 15 18:42:13 2019 (r354741) > @@ -92,6 +92,7 @@ static struct sysentvec elf32_freebsd_sysvec = { > .sv_usrstack = FREEBSD32_USRSTACK, > .sv_psstrings = FREEBSD32_PS_STRINGS, > .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, > + .sv_copyout_auxargs = elf32_freebsd_copyout_auxargs, > .sv_copyout_strings = freebsd32_copyout_strings, > .sv_setregs = freebsd32_setregs, > .sv_fixlimit = NULL, // XXX > > Modified: head/sys/arm64/arm64/elf_machdep.c > ============================================================================== > --- head/sys/arm64/arm64/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) > +++ head/sys/arm64/arm64/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) > @@ -76,6 +76,7 @@ static struct sysentvec elf64_freebsd_sysvec = { > .sv_usrstack = USRSTACK, > .sv_psstrings = PS_STRINGS, > .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, > + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > > Modified: head/sys/compat/freebsd32/freebsd32_misc.c > ============================================================================== > --- head/sys/compat/freebsd32/freebsd32_misc.c Fri Nov 15 18:34:36 2019 (r354740) > +++ head/sys/compat/freebsd32/freebsd32_misc.c Fri Nov 15 18:42:13 2019 (r354741) > @@ -3195,14 +3195,8 @@ freebsd32_copyout_strings(struct image_params *imgp) > if (imgp->sysent->sv_stackgap != NULL) > imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp); > > - if (imgp->auxargs) { > - /* > - * Allocate room on the stack for the ELF auxargs > - * array. It has up to AT_COUNT entries. > - */ > - vectp -= howmany(AT_COUNT * sizeof(Elf32_Auxinfo), > - sizeof(*vectp)); > - } > + if (imgp->auxargs) > + imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); > > /* > * Allocate room for the argv[] and env vectors including the > > Modified: head/sys/compat/ia32/ia32_sysvec.c > ============================================================================== > --- head/sys/compat/ia32/ia32_sysvec.c Fri Nov 15 18:34:36 2019 (r354740) > +++ head/sys/compat/ia32/ia32_sysvec.c Fri Nov 15 18:42:13 2019 (r354741) > @@ -114,6 +114,7 @@ struct sysentvec ia32_freebsd_sysvec = { > .sv_usrstack = FREEBSD32_USRSTACK, > .sv_psstrings = FREEBSD32_PS_STRINGS, > .sv_stackprot = VM_PROT_ALL, > + .sv_copyout_auxargs = elf32_freebsd_copyout_auxargs, > .sv_copyout_strings = freebsd32_copyout_strings, > .sv_setregs = ia32_setregs, > .sv_fixlimit = ia32_fixlimit, > > Modified: head/sys/i386/i386/elf_machdep.c > ============================================================================== > --- head/sys/i386/i386/elf_machdep.c Fri Nov 15 18:34:36 2019 (r354740) > +++ head/sys/i386/i386/elf_machdep.c Fri Nov 15 18:42:13 2019 (r354741) > @@ -70,6 +70,7 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_usrstack = USRSTACK, > .sv_psstrings = PS_STRINGS, > .sv_stackprot = VM_PROT_ALL, > + .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > > Modified: head/sys/kern/imgact_elf.c > ============================================================================== > --- head/sys/kern/imgact_elf.c Fri Nov 15 18:34:36 2019 (r354740) > +++ head/sys/kern/imgact_elf.c Fri Nov 15 18:42:13 2019 (r354741) > @@ -1289,7 +1289,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i > addr = et_dyn_addr; > > /* > - * Construct auxargs table (used by the fixup routine) > + * Construct auxargs table (used by the copyout_auxargs routine) > */ > elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_NOWAIT); > if (elf_auxargs == NULL) { > @@ -1323,16 +1323,13 @@ ret: > > #define suword __CONCAT(suword, __ELF_WORD_SIZE) > > -int > -__elfN(freebsd_fixup)(register_t **stack_base, struct image_params *imgp) > +void > +__elfN(freebsd_copyout_auxargs)(struct image_params *imgp, u_long *base) > { > Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs; > Elf_Auxinfo *argarray, *pos; > - Elf_Addr *base, *auxbase; > - int error; > + u_long auxlen; > > - base = (Elf_Addr *)*stack_base; > - auxbase = base + imgp->args->argc + 1 + imgp->args->envc + 1; > argarray = pos = malloc(AT_COUNT * sizeof(*pos), M_TEMP, > M_WAITOK | M_ZERO); > > @@ -1376,11 +1373,18 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct > imgp->auxargs = NULL; > KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs")); > > - error = copyout(argarray, auxbase, sizeof(*argarray) * AT_COUNT); > + auxlen = sizeof(*argarray) * (pos - argarray); > + *base -= auxlen; > + copyout(argarray, (void *)*base, auxlen); > free(argarray, M_TEMP); > - if (error != 0) > - return (error); > +} So you are ignoring copyout errors ? From owner-svn-src-head@freebsd.org Fri Nov 15 20:03:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 624C31AF42D; Fri, 15 Nov 2019 20:03:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47F8SG3HjHz40vh; Fri, 15 Nov 2019 20:03:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAFK3oGh029300 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 15 Nov 2019 22:03:53 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAFK3oGh029300 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAFK3neI029299; Fri, 15 Nov 2019 22:03:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 15 Nov 2019 22:03:49 +0200 From: Konstantin Belousov To: Scott Long Cc: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354703 - head/sys/dev/ioat Message-ID: <20191115200349.GI2707@kib.kiev.ua> References: <201911140439.xAE4dngZ032224@repo.freebsd.org> <20191114101149.GA2707@kib.kiev.ua> <475757c6-3707-540b-0316-cbef278043c2@FreeBSD.org> <20191115091837.GD2707@kib.kiev.ua> <842A5858-39B8-4196-8A94-018FA37DE75E@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <842A5858-39B8-4196-8A94-018FA37DE75E@samsco.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47F8SG3HjHz40vh X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(0.00)[ip: (-2.71), ipnet: 2001:470::/32(-4.62), asn: 6939(-3.49), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 20:03:59 -0000 On Fri, Nov 15, 2019 at 11:09:12AM -0700, Scott Long wrote: > > > > On Nov 15, 2019, at 2:18 AM, Konstantin Belousov wrote: > > > > On Thu, Nov 14, 2019 at 09:41:36AM -0500, Alexander Motin wrote: > >> On 14.11.2019 05:11, Konstantin Belousov wrote: > >>> On Thu, Nov 14, 2019 at 04:39:49AM +0000, Alexander Motin wrote: > >>>> Author: mav > >>>> Date: Thu Nov 14 04:39:48 2019 > >>>> New Revision: 354703 > >>>> URL: https://svnweb.freebsd.org/changeset/base/354703 > >>>> > >>>> Log: > >>>> Pass more reasonable WAIT flags to bus_dma(9) calls. > >>>> > >>>> MFC after: 2 weeks > >>>> > >>>> Modified: > >>>> head/sys/dev/ioat/ioat.c > >>>> > >>>> Modified: head/sys/dev/ioat/ioat.c > >>>> ============================================================================== > >>>> --- head/sys/dev/ioat/ioat.c Thu Nov 14 04:34:58 2019 (r354702) > >>>> +++ head/sys/dev/ioat/ioat.c Thu Nov 14 04:39:48 2019 (r354703) > >>>> @@ -555,13 +555,14 @@ ioat3_attach(device_t device) > >>>> &ioat->comp_update_tag); > >>>> > >>>> error = bus_dmamem_alloc(ioat->comp_update_tag, > >>>> - (void **)&ioat->comp_update, BUS_DMA_ZERO, &ioat->comp_update_map); > >>>> + (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, > >>>> + &ioat->comp_update_map); > >>> For waitok, you need to provide locking function in the tag. > >> > >> I'm sorry, but why? It is alloc(), not load(). For load() it makes > >> sense since it calls back, but this is just a form of malloc(), isn't > >> it? I've looked through the both x86 implementations and found nothing > >> suspicious. > > > > I see. Still, if you (or somebody else) ever decided to use WAITOK loads, > > it would be much safer to provide the lock function now. > > > > Loads are always non-blocking, and the WAITOK flag is not part of that > API. A load may defer its callback, and the asynchronous execution of that > callback is why we have the loaned lock. If a blocking alloc is performed in > a context where the caller holds a lock, then it’s the caller’s responsibility > to indicate NOWAIT and deal with the possible failure. Just like with > malloc and contigmalloc, the API does not, nor will it ever, drop and > require locks on behalf of the caller. The API tried to enforce the practice > that static resource allocation should happen at initialization time when > locks don’t need to be held. I only mean that if waitable loads are to be used, now or in future, then the locking function should be supplied. Also I mean that it is easy to forget to supply it because bounce busdma on amd64 and modern DMA engines never delay loading. > > It’s unfortunate that the NOWAIT flag is overloaded for different meanings > in the load functions vs the alloc functions. Maybe this is what is causing > confusion? > > TL;DR: ALexander’s change is correct. > > Scott > From owner-svn-src-head@freebsd.org Fri Nov 15 20:43:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 948201B0051; Fri, 15 Nov 2019 20:43:41 +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 47F9L451B5z4K3v; Fri, 15 Nov 2019 20:43:40 +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 559CF1E89A; Fri, 15 Nov 2019 20:43:40 +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 xAFKheEA065689; Fri, 15 Nov 2019 20:43:40 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFKheii065688; Fri, 15 Nov 2019 20:43:40 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911152043.xAFKheii065688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 15 Nov 2019 20:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354746 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 354746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 20:43:41 -0000 Author: tsoome Date: Fri Nov 15 20:43:39 2019 New Revision: 354746 URL: https://svnweb.freebsd.org/changeset/base/354746 Log: loader: add support for hybrid PMBR for GPT partition table Note hybrid table is nor really UEFI specification compliant. Sample hybrid partition table: > ::mbr Format: unknown Signature: 0xaa55 (valid) UniqueMBRDiskSignature: 0 PART TYPE ACTIVE STARTCHS ENDCHS SECTOR NUMSECT 0 EFI_PMBR:0xee 0 1023/254/63 1023/254/63 1 409639 1 0xff 0 1023/254/63 1023/254/63 409640 978508408 2 FDISK_EXT_WIN:0xc 0 1023/254/63 1023/254/63 978918048 31250000 3 0xff 0 1023/254/63 1023/254/63 1010168048 32 > Modified: head/stand/common/part.c Modified: head/stand/common/part.c ============================================================================== --- head/stand/common/part.c Fri Nov 15 19:03:02 2019 (r354745) +++ head/stand/common/part.c Fri Nov 15 20:43:39 2019 (r354746) @@ -647,7 +647,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect struct dos_partition *dp; struct ptable *table; uint8_t *buf; - int i, count; + int i; #ifdef LOADER_MBR_SUPPORT struct pentry *entry; uint32_t start, end; @@ -709,28 +709,23 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect } /* Check that we have PMBR. Also do some validation. */ dp = (struct dos_partition *)(buf + DOSPARTOFF); - for (i = 0, count = 0; i < NDOSPART; i++) { + /* + * In mac we can have PMBR partition in hybrid MBR; + * that is, MBR partition which has DOSPTYP_PMBR entry defined as + * start sector 1. After DOSPTYP_PMBR, there may be other partitions. + * UEFI compliant PMBR has no other partitions. + */ + for (i = 0; i < NDOSPART; i++) { if (dp[i].dp_flag != 0 && dp[i].dp_flag != 0x80) { DPRINTF("invalid partition flag %x", dp[i].dp_flag); goto out; } #ifdef LOADER_GPT_SUPPORT - if (dp[i].dp_typ == DOSPTYP_PMBR) { + if (dp[i].dp_typ == DOSPTYP_PMBR && dp[i].dp_start == 1) { table->type = PTABLE_GPT; DPRINTF("PMBR detected"); } #endif - if (dp[i].dp_typ != 0) - count++; - } - /* Do we have some invalid values? */ - if (table->type == PTABLE_GPT && count > 1) { - if (dp[1].dp_typ != DOSPTYP_HFS) { - table->type = PTABLE_NONE; - DPRINTF("Incorrect PMBR, ignore it"); - } else { - DPRINTF("Bootcamp detected"); - } } #ifdef LOADER_GPT_SUPPORT if (table->type == PTABLE_GPT) { From owner-svn-src-head@freebsd.org Fri Nov 15 21:19:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 728471B0868; Fri, 15 Nov 2019 21:19:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FB6z0yDFz4Rxs; Fri, 15 Nov 2019 21:19:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E91A81EE00; Fri, 15 Nov 2019 21:19:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFLJ6l8083769; Fri, 15 Nov 2019 21:19:06 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFLJ6m4083768; Fri, 15 Nov 2019 21:19:06 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911152119.xAFLJ6m4083768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 15 Nov 2019 21:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354747 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354747 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 21:19:07 -0000 Author: bz Date: Fri Nov 15 21:19:06 2019 New Revision: 354747 URL: https://svnweb.freebsd.org/changeset/base/354747 Log: Allow per-file lex and yacc options. In order to allow software with multiple (different) options for lex and yacc add extra per-file options to the calls. This is especially useful when one .l file needs -Pprefix. Reviewed by: imp MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D22337 Modified: head/share/mk/bsd.dep.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Fri Nov 15 20:43:39 2019 (r354746) +++ head/share/mk/bsd.dep.mk Fri Nov 15 21:19:06 2019 (r354747) @@ -108,7 +108,7 @@ OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.o+= ${ .for _LSRC in ${SRCS:M*.l:N*/*} .for _LC in ${_LSRC:R}.c ${_LC}: ${_LSRC} - ${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC} + ${LEX} ${LFLAGS} ${LFLAGS.${_LSRC}} -o${.TARGET} ${.ALLSRC} OBJS_DEPEND_GUESS.${_LC:R}.o+= ${_LC} SRCS:= ${SRCS:S/${_LSRC}/${_LC}/} CLEANFILES+= ${_LC} @@ -129,7 +129,7 @@ y.tab.h: ${_YC} .NOMETA ${_YC}: .PHONY .META .endif ${_YC}: ${_YSRC} - ${YACC} ${YFLAGS} ${.ALLSRC} + ${YACC} ${YFLAGS} ${YFLAGS.${_YSRC}} ${.ALLSRC} cp y.tab.c ${_YC} CLEANFILES+= y.tab.c y.tab.h .elif !empty(YFLAGS:M-d) @@ -142,13 +142,13 @@ ${_YH}: ${_YC} .NOMETA ${_YC}: .PHONY .META .endif ${_YC}: ${_YSRC} - ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} + ${YACC} ${YFLAGS} ${YFLAGS.${_YSRC}} -o ${_YC} ${.ALLSRC} SRCS+= ${_YH} CLEANFILES+= ${_YH} .endfor .else ${_YC}: ${_YSRC} - ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} + ${YACC} ${YFLAGS} ${YFLAGS.${_YSRC}} -o ${_YC} ${.ALLSRC} .endif OBJS_DEPEND_GUESS.${_YC:R}.o+= ${_YC} .endfor From owner-svn-src-head@freebsd.org Fri Nov 15 21:25:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD82C1B0AC3; Fri, 15 Nov 2019 21:25:30 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FBGJ6DvBz3DLf; Fri, 15 Nov 2019 21:25:28 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id Vj5liZSbpnCigVj5oi4PLl; Fri, 15 Nov 2019 14:25:25 -0700 X-Authority-Analysis: v=2.3 cv=cZisUULM c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=MeAgGD-zjQ4A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=1ycSchCX2eMNX77IUAIA:9 a=QEXdDO2ut3YA:10 a=Zuf05Qt0VeRZODgHXmcA:9 a=Ss12xka0_fTBLgmP:21 a=_W_S_7VecoQA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from [10.199.95.156] (unknown [24.244.29.145]) by spqr.komquats.com (Postfix) with ESMTPSA id B967C209; Fri, 15 Nov 2019 13:25:20 -0800 (PST) Date: Fri, 15 Nov 2019 14:25:00 -0700 User-Agent: K-9 Mail for Android In-Reply-To: <201911152119.xAFLJ6m4083768@repo.freebsd.org> References: <201911152119.xAFLJ6m4083768@repo.freebsd.org> MIME-Version: 1.0 Subject: Re: svn commit: r354747 - head/share/mk To: "Bjoern A. Zeeb" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Cy Schubert Message-ID: <10B5FAE7-0143-4437-B3A0-B5F28F9423E3@cschubert.com> X-CMAE-Envelope: MS4wfIobwfUm3y9j5KgbRldTUn4SRHGFFJpQJhgP8587WmBYVbY96kx0TKqd3xyoYhOpitw+KuG/6kbIkRmO5Td8tkZWrmQLOGl4MyZKGj6yzKXiO6YdOWXa dzePLeRIYxjUPFTYj+oezhRr/cg+75TzYRJ/FYyLY5aUmh/LWu1i0zOqY0pI7oo7UJZ8zodc4nD9+GzT7EAdsxjUSdQvMnmx/crqaKX6JAIW8HyfqAB3N9ga AETYxqJBhONTpwlkvqk+mXSZ4FACRvTRcLQhPvoCawiwRbQyVLji5o7n/VhLsBnH X-Rspamd-Queue-Id: 47FBGJ6DvBz3DLf X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.9) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.53 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.33)[ip: (-6.20), ipnet: 64.59.128.0/20(-3.04), asn: 6327(-2.35), country: CA(-0.09)]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[9.134.59.64.list.dnswl.org : 127.0.5.1]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MID_RHS_MATCH_FROM(0.00)[]; FROM_EQ_ENVFROM(0.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 21:25:30 -0000 On November 15, 2019 2:19:06 PM MST, "Bjoern A=2E Zeeb" = wrote: >Author: bz >Date: Fri Nov 15 21:19:06 2019 >New Revision: 354747 >URL: https://svnweb=2Efreebsd=2Eorg/changeset/base/354747 > >Log: > Allow per-file lex and yacc options=2E > =20 > In order to allow software with multiple (different) options > for lex and yacc add extra per-file options to the calls=2E > This is especially useful when one =2El file needs -Pprefix=2E > =20 > Reviewed by: imp > MFC after: 3 weeks > Differential Revision: https://reviews=2Efreebsd=2Eorg/D22337 > >Modified: > head/share/mk/bsd=2Edep=2Emk > >Modified: head/share/mk/bsd=2Edep=2Emk >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >--- head/share/mk/bsd=2Edep=2Emk Fri Nov 15 20:43:39 2019 (r354746) >+++ head/share/mk/bsd=2Edep=2Emk Fri Nov 15 21:19:06 2019 (r354747) >@@ -108,7 +108,7 @@ >OBJS_DEPEND_GUESS=2E${_S:${OBJS_SRCS_FILTER:ts:}}=2Eo+=3D ${ > =2Efor _LSRC in ${SRCS:M*=2El:N*/*} > =2Efor _LC in ${_LSRC:R}=2Ec > ${_LC}: ${_LSRC} >- ${LEX} ${LFLAGS} -o${=2ETARGET} ${=2EALLSRC} >+ ${LEX} ${LFLAGS} ${LFLAGS=2E${_LSRC}} -o${=2ETARGET} ${=2EALLSRC} > OBJS_DEPEND_GUESS=2E${_LC:R}=2Eo+=3D ${_LC} > SRCS:=3D ${SRCS:S/${_LSRC}/${_LC}/} > CLEANFILES+=3D ${_LC} >@@ -129,7 +129,7 @@ y=2Etab=2Eh: ${_YC} =2ENOMETA > ${_YC}: =2EPHONY =2EMETA > =2Eendif > ${_YC}: ${_YSRC} >- ${YACC} ${YFLAGS} ${=2EALLSRC} >+ ${YACC} ${YFLAGS} ${YFLAGS=2E${_YSRC}} ${=2EALLSRC} > cp y=2Etab=2Ec ${_YC} > CLEANFILES+=3D y=2Etab=2Ec y=2Etab=2Eh > =2Eelif !empty(YFLAGS:M-d) >@@ -142,13 +142,13 @@ ${_YH}: ${_YC} =2ENOMETA > ${_YC}: =2EPHONY =2EMETA > =2Eendif > ${_YC}: ${_YSRC} >- ${YACC} ${YFLAGS} -o ${_YC} ${=2EALLSRC} >+ ${YACC} ${YFLAGS} ${YFLAGS=2E${_YSRC}} -o ${_YC} ${=2EALLSRC} > SRCS+=3D ${_YH} > CLEANFILES+=3D ${_YH} > =2Eendfor > =2Eelse > ${_YC}: ${_YSRC} >- ${YACC} ${YFLAGS} -o ${_YC} ${=2EALLSRC} >+ ${YACC} ${YFLAGS} ${YFLAGS=2E${_YSRC}} -o ${_YC} ${=2EALLSRC} > =2Eendif > OBJS_DEPEND_GUESS=2E${_YC:R}=2Eo+=3D ${_YC} > =2Eendfor Thank you=2E --=20 Pardon the typos and autocorrect, small keyboard in use=2E=20 Cy Schubert FreeBSD UNIX: Web: https://www=2EFreeBSD=2Eorg The need of the many outweighs the greed of the few=2E Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E From owner-svn-src-head@freebsd.org Fri Nov 15 21:40:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00B1F1B0F19; Fri, 15 Nov 2019 21:40:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FBbt6mttz4LYr; Fri, 15 Nov 2019 21:40:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3F761F1FC; Fri, 15 Nov 2019 21:40:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFLeg0Z096527; Fri, 15 Nov 2019 21:40:42 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFLeerj095592; Fri, 15 Nov 2019 21:40:40 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911152140.xAFLeerj095592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 15 Nov 2019 21:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354748 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 21:40:43 -0000 Author: bz Date: Fri Nov 15 21:40:40 2019 New Revision: 354748 URL: https://svnweb.freebsd.org/changeset/base/354748 Log: netinet6: Remove PULLDOWN_TESTs. Remove the KAME introduced PULLDOWN_TESTs which did not even have a compile-time option in sys/conf to turn them on for a custom kernel build. They made the code a lot harder to read or more complicated in a few cases. Convert the IP6_EXTHDR_CHECK() calls into FreeBSD looking code. Rather than throwing the packet away if it would not fit the KAME mbuf expectations, convert the macros to m_pullup() calls. Do not do any extra manual conditional checks upfront as to whether the m_len would suffice (*), simply let m_pullup() do its work (incl. an early check). Remove extra m_pullup() calls where earlier in the function or the only caller has already done the pullup. Discussed with: rwatson (*) Reviewed by: ae MFC after: 8 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22334 Modified: head/sys/netinet6/dest6.c head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/route6.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/dest6.c ============================================================================== --- head/sys/netinet6/dest6.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/dest6.c Fri Nov 15 21:40:40 2019 (r354748) @@ -72,25 +72,23 @@ dest6_input(struct mbuf **mp, int *offp, int proto) m = *mp; off = *offp; - /* validation of the length of the header */ -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(*dstopts), IPPROTO_DONE); + /* Validation of the length of the header. */ + m = m_pullup(m, off + sizeof(*dstopts)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (IPPROTO_DONE); + } dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); -#else - IP6_EXTHDR_GET(dstopts, struct ip6_dest *, m, off, sizeof(*dstopts)); - if (dstopts == NULL) - return IPPROTO_DONE; -#endif dstoptlen = (dstopts->ip6d_len + 1) << 3; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, dstoptlen, IPPROTO_DONE); + m = m_pullup(m, off + dstoptlen); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (IPPROTO_DONE); + } dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); -#else - IP6_EXTHDR_GET(dstopts, struct ip6_dest *, m, off, dstoptlen); - if (dstopts == NULL) - return IPPROTO_DONE; -#endif off += dstoptlen; dstoptlen -= sizeof(struct ip6_dest); opt = (u_int8_t *)dstopts + sizeof(struct ip6_dest); Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/frag6.c Fri Nov 15 21:40:40 2019 (r354748) @@ -218,30 +218,22 @@ SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGBUCKETSIZE, * Remove the IPv6 fragmentation header from the mbuf. */ int -ip6_deletefraghdr(struct mbuf *m, int offset, int wait) +ip6_deletefraghdr(struct mbuf *m, int offset, int wait __unused) { struct ip6_hdr *ip6; - struct mbuf *t; - /* Delete frag6 header. */ - if (m->m_len >= offset + sizeof(struct ip6_frag)) { + KASSERT(m->m_len >= offset + sizeof(struct ip6_frag), + ("%s: ext headers not contigous in mbuf %p m_len %d >= " + "offset %d + %zu\n", __func__, m, m->m_len, offset, + sizeof(struct ip6_frag))); - /* This is the only possible case with !PULLDOWN_TEST. */ - ip6 = mtod(m, struct ip6_hdr *); - bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag), - offset); - m->m_data += sizeof(struct ip6_frag); - m->m_len -= sizeof(struct ip6_frag); - } else { - - /* This comes with no copy if the boundary is on cluster. */ - if ((t = m_split(m, offset, wait)) == NULL) - return (ENOMEM); - m_adj(t, sizeof(struct ip6_frag)); - m_cat(m, t); - } - + /* Delete frag6 header. */ + ip6 = mtod(m, struct ip6_hdr *); + bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag), offset); + m->m_data += sizeof(struct ip6_frag); + m->m_len -= sizeof(struct ip6_frag); m->m_flags |= M_FRAGMENTED; + return (0); } @@ -397,15 +389,13 @@ frag6_input(struct mbuf **mp, int *offp, int proto) M_ASSERTPKTHDR(m); - ip6 = mtod(m, struct ip6_hdr *); -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, offset, sizeof(struct ip6_frag), IPPROTO_DONE); - ip6f = (struct ip6_frag *)((caddr_t)ip6 + offset); -#else - IP6_EXTHDR_GET(ip6f, struct ip6_frag *, m, offset, sizeof(*ip6f)); - if (ip6f == NULL) + m = m_pullup(m, offset + sizeof(struct ip6_frag)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; return (IPPROTO_DONE); -#endif + } + ip6 = mtod(m, struct ip6_hdr *); dstifp = NULL; /* Find the destination interface of the packet. */ @@ -429,6 +419,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * sizeof(struct ip6_frag) == 8 * sizeof(struct ip6_hdr) = 40 */ + ip6f = (struct ip6_frag *)((caddr_t)ip6 + offset); if ((ip6f->ip6f_offlg & IP6F_MORE_FRAG) && (((ntohs(ip6->ip6_plen) - offset) & 0x7) != 0)) { icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, @@ -833,15 +824,7 @@ postinsert: V_ip6qb[bucket].count--; atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); - if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0) { -#ifdef MAC - mac_ip6q_destroy(q6); -#endif - free(q6, M_FRAG6); - atomic_subtract_int(&V_frag6_nfragpackets, 1); - - goto dropfrag; - } + ip6_deletefraghdr(m, offset, M_NOWAIT); /* Set nxt(-hdr field value) to the original value. */ m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t), Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/icmp6.c Fri Nov 15 21:40:40 2019 (r354748) @@ -232,16 +232,13 @@ icmp6_error2(struct mbuf *m, int type, int code, int p if (ifp == NULL) return; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), ); -#else if (m->m_len < sizeof(struct ip6_hdr)) { m = m_pullup(m, sizeof(struct ip6_hdr)); - if (m == NULL) + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); return; + } } -#endif - ip6 = mtod(m, struct ip6_hdr *); if (in6_setscope(&ip6->ip6_src, ifp, NULL) != 0) @@ -276,15 +273,13 @@ icmp6_error(struct mbuf *m, int type, int code, int pa } #endif -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), ); -#else if (m->m_len < sizeof(struct ip6_hdr)) { m = m_pullup(m, sizeof(struct ip6_hdr)); - if (m == NULL) + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); return; + } } -#endif oip6 = mtod(m, struct ip6_hdr *); /* @@ -322,17 +317,14 @@ icmp6_error(struct mbuf *m, int type, int code, int pa if (off >= 0 && nxt == IPPROTO_ICMPV6) { struct icmp6_hdr *icp; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, off + sizeof(struct icmp6_hdr), ); - icp = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); -#else - IP6_EXTHDR_GET(icp, struct icmp6_hdr *, m, off, - sizeof(*icp)); - if (icp == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, off + sizeof(struct icmp6_hdr)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); return; } -#endif + oip6 = mtod(m, struct ip6_hdr *); + icp = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); + if (icp->icmp6_type < ICMP6_ECHO_REQUEST || icp->icmp6_type == ND_REDIRECT) { /* @@ -349,8 +341,6 @@ icmp6_error(struct mbuf *m, int type, int code, int pa /* non-ICMPv6 - send the error */ } - oip6 = mtod(m, struct ip6_hdr *); /* adjust pointer */ - /* Finally, do rate limitation check. */ if (icmp6_ratelimit(&oip6->ip6_src, type, code)) { ICMP6STAT_INC(icp6s_toofreq); @@ -411,10 +401,12 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) m = *mp; off = *offp; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE); - /* m might change if M_LOOP. So, call mtod after this */ -#endif + m = m_pullup(m, off + sizeof(struct icmp6_hdr)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (IPPROTO_DONE); + } /* * Locate icmp6 structure in mbuf, and check @@ -445,17 +437,8 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) } /* Calculate the checksum. */ -#ifndef PULLDOWN_TEST icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off); -#else - IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6)); - if (icmp6 == NULL) { - ICMP6STAT_INC(icp6s_tooshort); - return IPPROTO_DONE; - } -#endif code = icmp6->icmp6_code; - if ((sum = in6_cksum(m, IPPROTO_ICMPV6, off, icmp6len)) != 0) { nd6log((LOG_ERR, "ICMP6 checksum error(%d|%x) %s\n", @@ -583,8 +566,12 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) n->m_pkthdr.len = n0len + (noff - off); n->m_next = n0; } else { - IP6_EXTHDR_GET(nicmp6, struct icmp6_hdr *, n, off, - sizeof(*nicmp6)); + n = m_pullup(n, off + sizeof(*nicmp6)); + if (n == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + break; + } + nicmp6 = (struct icmp6_hdr *)(mtod(n, caddr_t) + off); noff = off; } if (n) { @@ -648,10 +635,12 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) if (pr == NULL) pr = curthread->td_ucred->cr_prison; if (mode == FQDN) { -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo), - IPPROTO_DONE); -#endif + m = m_pullup(m, off + sizeof(struct icmp6_nodeinfo)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (IPPROTO_DONE); + } n = m_copym(m, 0, M_COPYALL, M_NOWAIT); if (n) n = ni6_input(n, off, pr); @@ -736,7 +725,12 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) if (icmp6len < sizeof(struct nd_router_solicit)) goto badlen; if (send_sendso_input_hook != NULL) { - IP6_EXTHDR_CHECK(m, off, icmp6len, IPPROTO_DONE); + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (IPPROTO_DONE); + } error = send_sendso_input_hook(m, ifp, SND_IN, ip6len); if (error == 0) { m = NULL; @@ -896,18 +890,14 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp ICMP6STAT_INC(icp6s_tooshort); goto freeit; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, - sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr), -1); - icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); -#else - IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, - sizeof(*icmp6) + sizeof(struct ip6_hdr)); - if (icmp6 == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + + m = m_pullup(m, off + sizeof(*icmp6) + sizeof(struct ip6_hdr)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; return (-1); } -#endif + icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); eip6 = (struct ip6_hdr *)(icmp6 + 1); /* Detect the upper level protocol */ @@ -931,19 +921,14 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp case IPPROTO_HOPOPTS: case IPPROTO_DSTOPTS: case IPPROTO_AH: -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, - eoff + sizeof(struct ip6_ext), -1); - eh = (struct ip6_ext *)(mtod(m, caddr_t) + eoff); -#else - IP6_EXTHDR_GET(eh, struct ip6_ext *, m, - eoff, sizeof(*eh)); - if (eh == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, eoff + sizeof(struct ip6_ext)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; return (-1); } -#endif - + eh = (struct ip6_ext *) + (mtod(m, caddr_t) + eoff); if (nxt == IPPROTO_AH) eoff += (eh->ip6e_len + 2) << 2; else @@ -959,18 +944,14 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp * information that depends on the final * destination (e.g. path MTU). */ -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, eoff + sizeof(*rth), -1); - rth = (struct ip6_rthdr *) - (mtod(m, caddr_t) + eoff); -#else - IP6_EXTHDR_GET(rth, struct ip6_rthdr *, m, - eoff, sizeof(*rth)); - if (rth == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, eoff + sizeof(*rth)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; return (-1); } -#endif + rth = (struct ip6_rthdr *) + (mtod(m, caddr_t) + eoff); rthlen = (rth->ip6r_len + 1) << 3; /* * XXX: currently there is no @@ -984,19 +965,14 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp rth->ip6r_type == IPV6_RTHDR_TYPE_0) { int hops; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, eoff + rthlen, -1); - rth0 = (struct ip6_rthdr0 *) - (mtod(m, caddr_t) + eoff); -#else - IP6_EXTHDR_GET(rth0, - struct ip6_rthdr0 *, m, - eoff, rthlen); - if (rth0 == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, eoff + rthlen); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; return (-1); } -#endif + rth0 = (struct ip6_rthdr0 *) + (mtod(m, caddr_t) + eoff); /* just ignore a bogus header */ if ((rth0->ip6r0_len % 2) == 0 && (hops = rth0->ip6r0_len/2)) @@ -1006,19 +982,14 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp nxt = rth->ip6r_nxt; break; case IPPROTO_FRAGMENT: -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, eoff + - sizeof(struct ip6_frag), -1); - fh = (struct ip6_frag *)(mtod(m, caddr_t) + - eoff); -#else - IP6_EXTHDR_GET(fh, struct ip6_frag *, m, - eoff, sizeof(*fh)); - if (fh == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, eoff + sizeof(struct ip6_frag)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; return (-1); } -#endif + fh = (struct ip6_frag *)(mtod(m, caddr_t) + + eoff); /* * Data after a fragment header is meaningless * unless it is the first fragment, but @@ -1044,16 +1015,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp } } notify: -#ifndef PULLDOWN_TEST icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); -#else - IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, - sizeof(*icmp6) + sizeof(struct ip6_hdr)); - if (icmp6 == NULL) { - ICMP6STAT_INC(icp6s_tooshort); - return (-1); - } -#endif /* * retrieve parameters from the inner IPv6 header, and convert @@ -1198,15 +1160,7 @@ ni6_input(struct mbuf *m, int off, struct prison *pr) struct in6_ifaddr *ia6 = NULL; ip6 = mtod(m, struct ip6_hdr *); -#ifndef PULLDOWN_TEST ni6 = (struct icmp6_nodeinfo *)(mtod(m, caddr_t) + off); -#else - IP6_EXTHDR_GET(ni6, struct icmp6_nodeinfo *, m, off, sizeof(*ni6)); - if (ni6 == NULL) { - /* m is already reclaimed */ - return (NULL); - } -#endif /* * Validate IPv6 source address. @@ -1303,7 +1257,6 @@ ni6_input(struct mbuf *m, int off, struct prison *pr) * * We do not do proxy at this moment. */ - /* m_pulldown instead of copy? */ m_copydata(m, off + sizeof(struct icmp6_nodeinfo), subjlen, (caddr_t)&in6_subj); if (in6_setscope(&in6_subj, m->m_pkthdr.rcvif, NULL)) @@ -1342,10 +1295,16 @@ ni6_input(struct mbuf *m, int off, struct prison *pr) mtx_unlock(&pr->pr_mtx); if (!n || n->m_next || n->m_len == 0) goto bad; - IP6_EXTHDR_GET(subj, char *, m, - off + sizeof(struct icmp6_nodeinfo), subjlen); - if (subj == NULL) + m = m_pullup(m, off + sizeof(struct icmp6_nodeinfo) + + subjlen); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); goto bad; + } + /* ip6 possibly invalid but not used after. */ + ni6 = (struct icmp6_nodeinfo *)(mtod(m, caddr_t) + off); + subj = (char *)(mtod(m, caddr_t) + off + + sizeof(struct icmp6_nodeinfo)); if (!ni6_dnsmatch(subj, subjlen, mtod(n, const char *), n->m_len)) { goto bad; @@ -1903,16 +1862,8 @@ icmp6_rip6_input(struct mbuf **mp, int off) NET_EPOCH_ASSERT(); -#ifndef PULLDOWN_TEST - /* this is assumed to be safe. */ + /* This is assumed to be safe; icmp6_input() does a pullup. */ icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off); -#else - IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6)); - if (icmp6 == NULL) { - /* m is already reclaimed */ - return (IPPROTO_DONE); - } -#endif /* * XXX: the address may have embedded scope zone ID, which should be @@ -2229,9 +2180,7 @@ icmp6_redirect_input(struct mbuf *m, int off) struct ifnet *ifp; struct ip6_hdr *ip6; struct nd_redirect *nd_rd; - struct in6_addr src6; - struct in6_addr redtgt6; - struct in6_addr reddst6; + struct in6_addr src6, redtgt6, reddst6; union nd_opts ndopts; char ip6buf[INET6_ADDRSTRLEN]; char *lladdr; @@ -2252,16 +2201,13 @@ icmp6_redirect_input(struct mbuf *m, int off) ip6 = mtod(m, struct ip6_hdr *); icmp6len = ntohs(ip6->ip6_plen); -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off); -#else - IP6_EXTHDR_GET(nd_rd, struct nd_redirect *, m, off, icmp6len); - if (nd_rd == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); return; } -#endif + ip6 = mtod(m, struct ip6_hdr *); + nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off); ifp = m->m_pkthdr.rcvif; redtgt6 = nd_rd->nd_rd_target; Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/ip6_input.c Fri Nov 15 21:40:40 2019 (r354748) @@ -203,9 +203,6 @@ struct rmlock in6_ifaddr_lock; RM_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock"); static int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *); -#ifdef PULLDOWN_TEST -static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int); -#endif /* * IP6 initialization: fill in IP6 protocol switch table. @@ -441,17 +438,8 @@ ip6_input_hbh(struct mbuf **mp, uint32_t *plen, uint32 (caddr_t)&ip6->ip6_plen - (caddr_t)ip6); goto out; } -#ifndef PULLDOWN_TEST /* ip6_hopopts_input() ensures that mbuf is contiguous */ hbh = (struct ip6_hbh *)(ip6 + 1); -#else - IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), - sizeof(struct ip6_hbh)); - if (hbh == NULL) { - IP6STAT_INC(ip6s_tooshort); - goto out; - } -#endif *nxt = hbh->ip6h_nxt; /* @@ -602,7 +590,6 @@ ip6_input(struct mbuf *m) in6_ifstat_inc(rcvif, ifs6_in_receive); IP6STAT_INC(ip6s_total); -#ifndef PULLDOWN_TEST /* * L2 bridge code and some other code can return mbuf chain * that does not conform to KAME requirement. too bad. @@ -624,9 +611,6 @@ ip6_input(struct mbuf *m) m_freem(m); m = n; } - IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), /* nothing */); -#endif - if (m->m_len < sizeof(struct ip6_hdr)) { if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { IP6STAT_INC(ip6s_toosmall); @@ -985,28 +969,22 @@ ip6_hopopts_input(u_int32_t *plenp, u_int32_t *rtalert struct ip6_hbh *hbh; /* validation of the length of the header */ -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(*hbh), -1); + m = m_pullup(m, off + sizeof(*hbh)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (-1); + } hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off); hbhlen = (hbh->ip6h_len + 1) << 3; - IP6_EXTHDR_CHECK(m, off, hbhlen, -1); - hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off); -#else - IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, - sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); - if (hbh == NULL) { - IP6STAT_INC(ip6s_tooshort); - return -1; + m = m_pullup(m, off + hbhlen); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (-1); } - hbhlen = (hbh->ip6h_len + 1) << 3; - IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), - hbhlen); - if (hbh == NULL) { - IP6STAT_INC(ip6s_tooshort); - return -1; - } -#endif + hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off); off += hbhlen; hbhlen -= sizeof(struct ip6_hbh); if (ip6_process_hopopts(m, (u_int8_t *)hbh + sizeof(struct ip6_hbh), @@ -1198,10 +1176,9 @@ ip6_unknown_opt(u_int8_t *optp, struct mbuf *m, int of * Create the "control" list for this pcb. * These functions will not modify mbuf chain at all. * - * With KAME mbuf chain restriction: * The routine will be called from upper layer handlers like tcp6_input(). * Thus the routine assumes that the caller (tcp6_input) have already - * called IP6_EXTHDR_CHECK() and all the extension headers are located in the + * called m_pullup() and all the extension headers are located in the * very first mbuf on the mbuf chain. * * ip6_savecontrol_v4 will handle those options that are possible to be @@ -1436,29 +1413,10 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, str */ if (ip6->ip6_nxt == IPPROTO_HOPOPTS) { struct ip6_hbh *hbh; - int hbhlen = 0; -#ifdef PULLDOWN_TEST - struct mbuf *ext; -#endif + int hbhlen; -#ifndef PULLDOWN_TEST hbh = (struct ip6_hbh *)(ip6 + 1); hbhlen = (hbh->ip6h_len + 1) << 3; -#else - ext = ip6_pullexthdr(m, sizeof(struct ip6_hdr), - ip6->ip6_nxt); - if (ext == NULL) { - IP6STAT_INC(ip6s_tooshort); - return; - } - hbh = mtod(ext, struct ip6_hbh *); - hbhlen = (hbh->ip6h_len + 1) << 3; - if (hbhlen != ext->m_len) { - m_freem(ext); - IP6STAT_INC(ip6s_tooshort); - return; - } -#endif /* * XXX: We copy the whole header even if a @@ -1472,9 +1430,6 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, str IPPROTO_IPV6); if (*mp) mp = &(*mp)->m_next; -#ifdef PULLDOWN_TEST - m_freem(ext); -#endif } } @@ -1491,9 +1446,6 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, str while (1) { /* is explicit loop prevention necessary? */ struct ip6_ext *ip6e = NULL; int elen; -#ifdef PULLDOWN_TEST - struct mbuf *ext = NULL; -#endif /* * if it is not an extension header, don't try to @@ -1509,7 +1461,6 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, str goto loopend; } -#ifndef PULLDOWN_TEST if (off + sizeof(*ip6e) > m->m_len) goto loopend; ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + off); @@ -1519,23 +1470,6 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, str elen = (ip6e->ip6e_len + 1) << 3; if (off + elen > m->m_len) goto loopend; -#else - ext = ip6_pullexthdr(m, off, nxt); - if (ext == NULL) { - IP6STAT_INC(ip6s_tooshort); - return; - } - ip6e = mtod(ext, struct ip6_ext *); - if (nxt == IPPROTO_AH) - elen = (ip6e->ip6e_len + 2) << 2; - else - elen = (ip6e->ip6e_len + 1) << 3; - if (elen != ext->m_len) { - m_freem(ext); - IP6STAT_INC(ip6s_tooshort); - return; - } -#endif switch (nxt) { case IPPROTO_DSTOPTS: @@ -1570,9 +1504,6 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, str * the code just in case (nxt overwritten or * other cases). */ -#ifdef PULLDOWN_TEST - m_freem(ext); -#endif goto loopend; } @@ -1581,10 +1512,6 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, str off += elen; nxt = ip6e->ip6e_nxt; ip6e = NULL; -#ifdef PULLDOWN_TEST - m_freem(ext); - ext = NULL; -#endif } loopend: ; @@ -1669,49 +1596,6 @@ ip6_notify_pmtu(struct inpcb *inp, struct sockaddr_in6 } else sorwakeup(so); } - -#ifdef PULLDOWN_TEST -/* - * pull single extension header from mbuf chain. returns single mbuf that - * contains the result, or NULL on error. - */ -static struct mbuf * -ip6_pullexthdr(struct mbuf *m, size_t off, int nxt) -{ - struct ip6_ext ip6e; - size_t elen; - struct mbuf *n; - -#ifdef DIAGNOSTIC - switch (nxt) { - case IPPROTO_DSTOPTS: - case IPPROTO_ROUTING: - case IPPROTO_HOPOPTS: - case IPPROTO_AH: /* is it possible? */ - break; - default: - printf("ip6_pullexthdr: invalid nxt=%d\n", nxt); - } -#endif - - m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e); - if (nxt == IPPROTO_AH) - elen = (ip6e.ip6e_len + 2) << 2; - else - elen = (ip6e.ip6e_len + 1) << 3; - - if (elen > MLEN) - n = m_getcl(M_NOWAIT, MT_DATA, 0); - else - n = m_get(M_NOWAIT, MT_DATA); - if (n == NULL) - return NULL; - - m_copydata(m, off, elen, mtod(n, caddr_t)); - n->m_len = elen; - return n; -} -#endif /* * Get pointer to the previous header followed by the header Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/ip6_mroute.c Fri Nov 15 21:40:40 2019 (r354748) @@ -1745,20 +1745,13 @@ pim6_input(struct mbuf *m, int off, int proto, void *a * Make sure that the IP6 and PIM headers in contiguous memory, and * possibly the PIM REGISTER header */ -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, minlen, IPPROTO_DONE); - /* adjust pointer */ - ip6 = mtod(m, struct ip6_hdr *); - - /* adjust mbuf to point to the PIM header */ - pim = (struct pim *)((caddr_t)ip6 + off); -#else - IP6_EXTHDR_GET(pim, struct pim *, m, off, minlen); - if (pim == NULL) { - PIM6STAT_INC(pim6s_rcv_tooshort); + m = m_pullup(m, off + minlen); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); return (IPPROTO_DONE); } -#endif + ip6 = mtod(m, struct ip6_hdr *); + pim = (struct pim *)((caddr_t)ip6 + off); #define PIM6_CHECKSUM #ifdef PIM6_CHECKSUM Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/mld6.c Fri Nov 15 21:40:40 2019 (r354748) @@ -1261,6 +1261,11 @@ mld_input(struct mbuf *m, int off, int icmp6len) ifp = m->m_pkthdr.rcvif; /* Pullup to appropriate size. */ + m = m_pullup(m, off + sizeof(*mld)); + if (m == NULL) { + ICMP6STAT_INC(icp6s_badlen); + return (IPPROTO_DONE); + } mld = (struct mld_hdr *)(mtod(m, uint8_t *) + off); if (mld->mld_type == MLD_LISTENER_QUERY && icmp6len >= sizeof(struct mldv2_query)) { @@ -1268,12 +1273,13 @@ mld_input(struct mbuf *m, int off, int icmp6len) } else { mldlen = sizeof(struct mld_hdr); } - IP6_EXTHDR_GET(mld, struct mld_hdr *, m, off, mldlen); - if (mld == NULL) { + m = m_pullup(m, off + mldlen); + if (m == NULL) { ICMP6STAT_INC(icp6s_badlen); return (IPPROTO_DONE); } ip6 = mtod(m, struct ip6_hdr *); + mld = (struct mld_hdr *)(mtod(m, uint8_t *) + off); /* * Userland needs to see all of this traffic for implementing Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/nd6_nbr.c Fri Nov 15 21:40:40 2019 (r354748) @@ -148,17 +148,13 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) goto bads; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_ns = (struct nd_neighbor_solicit *)((caddr_t)ip6 + off); -#else - IP6_EXTHDR_GET(nd_ns, struct nd_neighbor_solicit *, m, off, icmp6len); - if (nd_ns == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); return; } -#endif - ip6 = mtod(m, struct ip6_hdr *); /* adjust pointer for safety */ + ip6 = mtod(m, struct ip6_hdr *); + nd_ns = (struct nd_neighbor_solicit *)((caddr_t)ip6 + off); saddr6 = ip6->ip6_src; daddr6 = ip6->ip6_dst; @@ -656,16 +652,13 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) goto bad; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_na = (struct nd_neighbor_advert *)((caddr_t)ip6 + off); -#else - IP6_EXTHDR_GET(nd_na, struct nd_neighbor_advert *, m, off, icmp6len); - if (nd_na == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); return; } -#endif + ip6 = mtod(m, struct ip6_hdr *); + nd_na = (struct nd_neighbor_advert *)((caddr_t)ip6 + off); flags = nd_na->nd_na_flags_reserved; is_router = ((flags & ND_NA_FLAG_ROUTER) != 0); Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/nd6_rtr.c Fri Nov 15 21:40:40 2019 (r354748) @@ -202,16 +202,13 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) goto freeit; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_rs = (struct nd_router_solicit *)((caddr_t)ip6 + off); -#else - IP6_EXTHDR_GET(nd_rs, struct nd_router_solicit *, m, off, icmp6len); - if (nd_rs == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); return; } -#endif + ip6 = mtod(m, struct ip6_hdr *); + nd_rs = (struct nd_router_solicit *)((caddr_t)ip6 + off); icmp6len -= sizeof(*nd_rs); nd6_option_init(nd_rs + 1, icmp6len, &ndopts); @@ -403,16 +400,13 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) goto bad; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_ra = (struct nd_router_advert *)((caddr_t)ip6 + off); -#else - IP6_EXTHDR_GET(nd_ra, struct nd_router_advert *, m, off, icmp6len); - if (nd_ra == NULL) { - ICMP6STAT_INC(icp6s_tooshort); + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); return; } -#endif + ip6 = mtod(m, struct ip6_hdr *); + nd_ra = (struct nd_router_advert *)((caddr_t)ip6 + off); icmp6len -= sizeof(*nd_ra); nd6_option_init(nd_ra + 1, icmp6len, &ndopts); Modified: head/sys/netinet6/route6.c ============================================================================== --- head/sys/netinet6/route6.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/route6.c Fri Nov 15 21:40:40 2019 (r354748) @@ -83,18 +83,14 @@ route6_input(struct mbuf **mp, int *offp, int proto) } #endif -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(*rh), IPPROTO_DONE); + m = m_pullup(m, off + sizeof(*rh)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (IPPROTO_DONE); + } ip6 = mtod(m, struct ip6_hdr *); rh = (struct ip6_rthdr *)((caddr_t)ip6 + off); -#else - ip6 = mtod(m, struct ip6_hdr *); - IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh)); - if (rh == NULL) { - IP6STAT_INC(ip6s_tooshort); - return IPPROTO_DONE; - } -#endif /* * While this switch may look gratuitous, leave it in Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Fri Nov 15 21:19:06 2019 (r354747) +++ head/sys/netinet6/udp6_usrreq.c Fri Nov 15 21:40:40 2019 (r354748) @@ -223,16 +223,14 @@ udp6_input(struct mbuf **mp, int *offp, int proto) ifp = m->m_pkthdr.rcvif; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); - ip6 = mtod(m, struct ip6_hdr *); - uh = (struct udphdr *)((caddr_t)ip6 + off); -#else - IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(*uh)); - if (!uh) + m = m_pullup(m, off + sizeof(struct udphdr)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; return (IPPROTO_DONE); + } ip6 = mtod(m, struct ip6_hdr *); -#endif + uh = (struct udphdr *)((caddr_t)ip6 + off); UDPSTAT_INC(udps_ipackets); From owner-svn-src-head@freebsd.org Fri Nov 15 21:44:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C84DF1B133B; Fri, 15 Nov 2019 21:44:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FBh31TrVz4R3N; Fri, 15 Nov 2019 21:44:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2B1F1F3CC; Fri, 15 Nov 2019 21:44:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFLiIDw001395; Fri, 15 Nov 2019 21:44:18 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFLiHop001392; Fri, 15 Nov 2019 21:44:17 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911152144.xAFLiHop001392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 15 Nov 2019 21:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354749 - in head/sys: netinet netinet6 netipsec X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/sys: netinet netinet6 netipsec X-SVN-Commit-Revision: 354749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 21:44:19 -0000 Author: bz Date: Fri Nov 15 21:44:17 2019 New Revision: 354749 URL: https://svnweb.freebsd.org/changeset/base/354749 Log: netinet*: replace IP6_EXTHDR_GET() In a few places we have IP6_EXTHDR_GET() left in upper layer protocols. The IP6_EXTHDR_GET() macro might perform an m_pulldown() in case the data fragment is not contiguous. Convert these last remaining instances into m_pullup()s instead. In CARP, for example, we will a few lines later call m_pullup() anyway, the IPsec code coming from OpenBSD would otherwise have done the m_pullup() and are copying the data a bit later anyway, so pulling it in seems no better or worse. Note: this leaves very few m_pulldown() cases behind in the tree and we might want to consider removing them as well to make mbuf management easier again on a path to variable size mbufs, especially given m_pulldown() still has an issue not re-checking M_WRITEABLE(). Reviewed by: gallatin MFC after: 8 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22335 Modified: head/sys/netinet/ip_carp.c head/sys/netinet6/sctp6_usrreq.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Fri Nov 15 21:40:40 2019 (r354748) +++ head/sys/netinet/ip_carp.c Fri Nov 15 21:44:17 2019 (r354749) @@ -567,12 +567,13 @@ carp6_input(struct mbuf **mp, int *offp, int proto) /* verify that we have a complete carp packet */ len = m->m_len; - IP6_EXTHDR_GET(ch, struct carp_header *, m, *offp, sizeof(*ch)); - if (ch == NULL) { + m = m_pullup(m, *offp + sizeof(*ch)); + if (m == NULL) { CARPSTATS_INC(carps_badlen); CARP_DEBUG("%s: packet size %u too small\n", __func__, len); return (IPPROTO_DONE); } + ch = (struct carp_header *)(mtod(m, caddr_t) + *offp); /* verify the CARP checksum */ Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Fri Nov 15 21:40:40 2019 (r354748) +++ head/sys/netinet6/sctp6_usrreq.c Fri Nov 15 21:44:17 2019 (r354749) @@ -103,13 +103,13 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, SCTP_STAT_INCR_COUNTER64(sctps_inpackets); /* Get IP, SCTP, and first chunk header together in the first mbuf. */ offset = iphlen + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); - ip6 = mtod(m, struct ip6_hdr *); - IP6_EXTHDR_GET(sh, struct sctphdr *, m, iphlen, - (int)(sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); - if (sh == NULL) { + m = m_pullup(m, offset); + if (m == NULL) { SCTP_STAT_INCR(sctps_hdrops); return (IPPROTO_DONE); } + ip6 = mtod(m, struct ip6_hdr *); + sh = (struct sctphdr *)(mtod(m, caddr_t) + iphlen); ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(struct sctphdr)); offset -= sizeof(struct sctp_chunkhdr); memset(&src, 0, sizeof(struct sockaddr_in6)); Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Fri Nov 15 21:40:40 2019 (r354748) +++ head/sys/netipsec/xform_ah.c Fri Nov 15 21:44:17 2019 (r354749) @@ -575,14 +575,14 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski /* Figure out header size. */ rplen = HDRSIZE(sav); - /* XXX don't pullup, just copy header */ - IP6_EXTHDR_GET(ah, struct newah *, m, skip, rplen); - if (ah == NULL) { + m = m_pullup(m, skip + rplen); + if (m == NULL) { DPRINTF(("ah_input: cannot pullup header\n")); AHSTAT_INC(ahs_hdrops); /*XXX*/ error = ENOBUFS; goto bad; } + ah = (struct newah *)(mtod(m, caddr_t) + skip); /* Check replay window, if applicable. */ SECASVAR_LOCK(sav); Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Fri Nov 15 21:40:40 2019 (r354748) +++ head/sys/netipsec/xform_esp.c Fri Nov 15 21:44:17 2019 (r354749) @@ -307,8 +307,15 @@ esp_input(struct mbuf *m, struct secasvar *sav, int sk ESPSTAT_INC(esps_badilen); goto bad; } - /* XXX don't pullup, just copy header */ - IP6_EXTHDR_GET(esp, struct newesp *, m, skip, sizeof (struct newesp)); + + m = m_pullup(m, skip + sizeof(*esp)); + if (m == NULL) { + DPRINTF(("%s: cannot pullup header\n", __func__)); + ESPSTAT_INC(esps_hdrops); /*XXX*/ + error = ENOBUFS; + goto bad; + } + esp = (struct newesp *)(mtod(m, caddr_t) + skip); esph = sav->tdb_authalgxform; espx = sav->tdb_encalgxform; From owner-svn-src-head@freebsd.org Fri Nov 15 21:47:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F5391B1730; Fri, 15 Nov 2019 21:47:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FBlf6ZCRz4VX4; Fri, 15 Nov 2019 21:47:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 3ED4FC3C3; Fri, 15 Nov 2019 21:47:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354741 - in head/sys: amd64/amd64 arm/arm arm64/arm64 compat/freebsd32 compat/ia32 i386/i386 kern mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64 sys To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911151842.xAFIgDrJ093716@repo.freebsd.org> <20191115200108.GH2707@kib.kiev.ua> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <30eebb0d-cea1-ce0d-76e2-1e1ef32deeda@FreeBSD.org> Date: Fri, 15 Nov 2019 13:47:24 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191115200108.GH2707@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 21:47:27 -0000 On 11/15/19 12:01 PM, Konstantin Belousov wrote: > On Fri, Nov 15, 2019 at 06:42:13PM +0000, John Baldwin wrote: >> Author: jhb >> Date: Fri Nov 15 18:42:13 2019 >> New Revision: 354741 >> URL: https://svnweb.freebsd.org/changeset/base/354741 >> >> Log: >> Add a sv_copyout_auxargs() hook in sysentvec. >> >> Change the FreeBSD ELF ABIs to use this new hook to copyout ELF auxv >> instead of doing it in the sv_fixup hook. In particular, this new >> hook allows the stack space to be allocated at the same time the auxv >> values are copied out to userland. This allows us to avoid wasting >> space for unused auxv entries as well as not having to recalculate >> where the auxv vector is by walking back up over the argv and >> environment vectors. >> >> Reviewed by: brooks, emaste >> Tested on: amd64 (amd64 and i386 binaries), i386, mips, mips64 >> Sponsored by: DARPA >> Differential Revision: https://reviews.freebsd.org/D22355 >> >> @@ -1376,11 +1373,18 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct >> imgp->auxargs = NULL; >> KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs")); >> >> - error = copyout(argarray, auxbase, sizeof(*argarray) * AT_COUNT); >> + auxlen = sizeof(*argarray) * (pos - argarray); >> + *base -= auxlen; >> + copyout(argarray, (void *)*base, auxlen); >> free(argarray, M_TEMP); >> - if (error != 0) >> - return (error); >> +} > So you are ignoring copyout errors ? All of exec_copyout_strings() ignores copyout errors. Previously we would ignore errors for the argv and envv arrays and strings, but just happened to check for the error during fixup (but a.out binaries don't do a fixup, so none of their copyout calls are checked). We could change sv_copyout_strings to return an error value and return the stack pointer via a pointer arg instead and then start checking for errors in all the copyout_strings implementations if we wanted to start doing checks. -- John Baldwin From owner-svn-src-head@freebsd.org Fri Nov 15 21:51:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1172F1B19F2; Fri, 15 Nov 2019 21:51:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FBrb6MxRz4fMC; Fri, 15 Nov 2019 21:51:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE46D1F57A; Fri, 15 Nov 2019 21:51:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFLphuZ003850; Fri, 15 Nov 2019 21:51:43 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFLphCV003849; Fri, 15 Nov 2019 21:51:43 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911152151.xAFLphCV003849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 15 Nov 2019 21:51:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354750 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 21:51:44 -0000 Author: bz Date: Fri Nov 15 21:51:43 2019 New Revision: 354750 URL: https://svnweb.freebsd.org/changeset/base/354750 Log: IP6_EXTHDR_CHECK(): remove the last instances While r354748 removed almost all IP6_EXTHDR_CHECK() calls, these are not part of the PULLDOWN_TESTS. Equally convert these IP6_EXTHDR_CHECK()s here to m_pullup() and remove the extra check and m_pullup() in tcp_input() under isipv6 given tcp6_input() has done exactly that pullup already. MFC after: 8 weeks Sponsored by: Netflix Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Fri Nov 15 21:44:17 2019 (r354749) +++ head/sys/netinet/tcp_input.c Fri Nov 15 21:51:43 2019 (r354750) @@ -517,7 +517,12 @@ tcp6_input(struct mbuf **mp, int *offp, int proto) struct ip6_hdr *ip6; m = *mp; - IP6_EXTHDR_CHECK(m, *offp, sizeof(struct tcphdr), IPPROTO_DONE); + m = m_pullup(m, *offp + sizeof(struct tcphdr)); + if (m == NULL) { + *mp = m; + TCPSTAT_INC(tcps_rcvshort); + return (IPPROTO_DONE); + } /* * draft-itojun-ipv6-tcp-to-anycast @@ -595,16 +600,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto) #ifdef INET6 if (isipv6) { - /* IP6_EXTHDR_CHECK() is already done at tcp6_input(). */ - if (m->m_len < (sizeof(*ip6) + sizeof(*th))) { - m = m_pullup(m, sizeof(*ip6) + sizeof(*th)); - if (m == NULL) { - TCPSTAT_INC(tcps_rcvshort); - return (IPPROTO_DONE); - } - } - ip6 = mtod(m, struct ip6_hdr *); th = (struct tcphdr *)((caddr_t)ip6 + off0); tlen = sizeof(*ip6) + ntohs(ip6->ip6_plen) - off0; @@ -712,7 +708,11 @@ tcp_input(struct mbuf **mp, int *offp, int proto) if (off > sizeof (struct tcphdr)) { #ifdef INET6 if (isipv6) { - IP6_EXTHDR_CHECK(m, off0, off, IPPROTO_DONE); + m = m_pullup(m, off0 + off); + if (m == NULL) { + TCPSTAT_INC(tcps_rcvshort); + return (IPPROTO_DONE); + } ip6 = mtod(m, struct ip6_hdr *); th = (struct tcphdr *)((caddr_t)ip6 + off0); } From owner-svn-src-head@freebsd.org Fri Nov 15 21:54:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABB111B1B60; Fri, 15 Nov 2019 21:54:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47FBvf2QxFz3D8d; Fri, 15 Nov 2019 21:54:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAFLsCkU054836 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 15 Nov 2019 23:54:15 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAFLsCkU054836 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAFLsC3W054835; Fri, 15 Nov 2019 23:54:12 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 15 Nov 2019 23:54:12 +0200 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354741 - in head/sys: amd64/amd64 arm/arm arm64/arm64 compat/freebsd32 compat/ia32 i386/i386 kern mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64 sys Message-ID: <20191115215412.GJ2707@kib.kiev.ua> References: <201911151842.xAFIgDrJ093716@repo.freebsd.org> <20191115200108.GH2707@kib.kiev.ua> <30eebb0d-cea1-ce0d-76e2-1e1ef32deeda@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <30eebb0d-cea1-ce0d-76e2-1e1ef32deeda@FreeBSD.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47FBvf2QxFz3D8d X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; R_SPF_SOFTFAIL(0.00)[~all:c]; IP_SCORE_FREEMAIL(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(0.00)[ip: (-2.70), ipnet: 2001:470::/32(-4.61), asn: 6939(-3.49), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 21:54:23 -0000 On Fri, Nov 15, 2019 at 01:47:24PM -0800, John Baldwin wrote: > On 11/15/19 12:01 PM, Konstantin Belousov wrote: > > On Fri, Nov 15, 2019 at 06:42:13PM +0000, John Baldwin wrote: > >> Author: jhb > >> Date: Fri Nov 15 18:42:13 2019 > >> New Revision: 354741 > >> URL: https://svnweb.freebsd.org/changeset/base/354741 > >> > >> Log: > >> Add a sv_copyout_auxargs() hook in sysentvec. > >> > >> Change the FreeBSD ELF ABIs to use this new hook to copyout ELF auxv > >> instead of doing it in the sv_fixup hook. In particular, this new > >> hook allows the stack space to be allocated at the same time the auxv > >> values are copied out to userland. This allows us to avoid wasting > >> space for unused auxv entries as well as not having to recalculate > >> where the auxv vector is by walking back up over the argv and > >> environment vectors. > >> > >> Reviewed by: brooks, emaste > >> Tested on: amd64 (amd64 and i386 binaries), i386, mips, mips64 > >> Sponsored by: DARPA > >> Differential Revision: https://reviews.freebsd.org/D22355 > >> > >> @@ -1376,11 +1373,18 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct > >> imgp->auxargs = NULL; > >> KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs")); > >> > >> - error = copyout(argarray, auxbase, sizeof(*argarray) * AT_COUNT); > >> + auxlen = sizeof(*argarray) * (pos - argarray); > >> + *base -= auxlen; > >> + copyout(argarray, (void *)*base, auxlen); > >> free(argarray, M_TEMP); > >> - if (error != 0) > >> - return (error); > >> +} > > So you are ignoring copyout errors ? > > All of exec_copyout_strings() ignores copyout errors. Previously we would ignore > errors for the argv and envv arrays and strings, but just happened to check for > the error during fixup (but a.out binaries don't do a fixup, so none of their > copyout calls are checked). We could change sv_copyout_strings to return an error > value and return the stack pointer via a pointer arg instead and then start > checking for errors in all the copyout_strings implementations if we wanted to > start doing checks. > We should start checking for errors there, sometime. One of the reason is that user can cause situation where the copyouts fail due to the (mis)configured stack limit and stack gap size. From owner-svn-src-head@freebsd.org Fri Nov 15 21:55:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9E781B1BFD; Fri, 15 Nov 2019 21:55:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FBxB44hfz3F2p; Fri, 15 Nov 2019 21:55:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06E641F5D7; Fri, 15 Nov 2019 21:55:41 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFLtfic007149; Fri, 15 Nov 2019 21:55:41 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFLtfoQ007148; Fri, 15 Nov 2019 21:55:41 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911152155.xAFLtfoQ007148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 15 Nov 2019 21:55:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354751 - in head: share/doc/IPv6 sys/netinet X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: share/doc/IPv6 sys/netinet X-SVN-Commit-Revision: 354751 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 21:55:44 -0000 Author: bz Date: Fri Nov 15 21:55:41 2019 New Revision: 354751 URL: https://svnweb.freebsd.org/changeset/base/354751 Log: Remove now unused IPv6 macros and update docs. After r354748-354750 all uses of the IP6_EXTHDR_CHECK() and IP6_EXTHDR_GET() macros are gone from the kernel. IP6_EXTHDR_GET0() was unused. Remove the macros and update the documentation. Sponsored by: Netflix Modified: head/share/doc/IPv6/IMPLEMENTATION head/sys/netinet/ip6.h Modified: head/share/doc/IPv6/IMPLEMENTATION ============================================================================== --- head/share/doc/IPv6/IMPLEMENTATION Fri Nov 15 21:51:43 2019 (r354750) +++ head/share/doc/IPv6/IMPLEMENTATION Fri Nov 15 21:55:41 2019 (r354751) @@ -1049,20 +1049,6 @@ requirement. (For more information, refer to Section 2 3282 one ext mbuf 0 two or more ext mbuf -Each input function calls IP6_EXTHDR_CHECK in the beginning to check -if the region between IP6 and its header is -continuous. IP6_EXTHDR_CHECK calls m_pullup() only if the mbuf has -M_LOOP flag, that is, the packet comes from the loopback -interface. m_pullup() is never called for packets coming from physical -network interfaces. - -TCP6 reassembly makes use of IP6 header to store reassemble -information. IP6 is not supposed to be just before TCP6, so -ip6tcpreass structure has a pointer to TCP6 header. Of course, it has -also a pointer back to mbuf to avoid m_pullup(). - -Like TCP6, both IP and IP6 reassemble functions never call m_pullup(). - xxx_ctlinput() calls in_mrejoin() on PRC_IFNEWADDR. We think this is one of 4.4BSD implementation flaws. Since 4.4BSD keeps ia_multiaddrs in in_ifaddr{}, it can't use multicast feature if the interface has no Modified: head/sys/netinet/ip6.h ============================================================================== --- head/sys/netinet/ip6.h Fri Nov 15 21:51:43 2019 (r354750) +++ head/sys/netinet/ip6.h Fri Nov 15 21:55:41 2019 (r354751) @@ -262,88 +262,4 @@ struct ip6_frag { #define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/ #define IPV6_MAXOPTHDR 2048 /* max option header size, 256 64-bit words */ -#ifdef _KERNEL -/* - * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the - * target header (including IPv6 itself, extension headers and - * TCP/UDP/ICMP6 headers) are contiguous. KAME requires drivers - * to store incoming data into one internal mbuf or one or more external - * mbufs(never into two or more internal mbufs). Thus, the third case is - * supposed to never be matched but is prepared just in case. - */ - -#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \ -do { \ - if ((m)->m_next != NULL) { \ - if (((m)->m_flags & M_LOOP) && \ - ((m)->m_len < (off) + (hlen)) && \ - (((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \ - IP6STAT_INC(ip6s_exthdrtoolong); \ - return ret; \ - } else { \ - if ((m)->m_len < (off) + (hlen)) { \ - IP6STAT_INC(ip6s_exthdrtoolong); \ - m_freem(m); \ - return ret; \ - } \ - } \ - } else { \ - if ((m)->m_len < (off) + (hlen)) { \ - IP6STAT_INC(ip6s_tooshort); \ - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \ - m_freem(m); \ - return ret; \ - } \ - } \ -} while (/*CONSTCOND*/ 0) - -/* - * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to - * "len") is located in single mbuf, on contiguous memory region. - * The pointer to the region will be returned to pointer variable "val", - * with type "typ". - * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the - * very top of mbuf. GET0 is likely to make memory copy than GET. - * - * XXX we're now testing this, needs m_pulldown() - */ -#define IP6_EXTHDR_GET(val, typ, m, off, len) \ -do { \ - struct mbuf *t; \ - int tmp; \ - if ((m)->m_len >= (off) + (len)) \ - (val) = (typ)(mtod((m), caddr_t) + (off)); \ - else { \ - t = m_pulldown((m), (off), (len), &tmp); \ - if (t) { \ - if (t->m_len < tmp + (len)) \ - panic("m_pulldown malfunction"); \ - (val) = (typ)(mtod(t, caddr_t) + tmp); \ - } else { \ - (val) = (typ)NULL; \ - (m) = NULL; \ - } \ - } \ -} while (/*CONSTCOND*/ 0) - -#define IP6_EXTHDR_GET0(val, typ, m, off, len) \ -do { \ - struct mbuf *t; \ - if ((off) == 0) \ - (val) = (typ)mtod(m, caddr_t); \ - else { \ - t = m_pulldown((m), (off), (len), NULL); \ - if (t) { \ - if (t->m_len < (len)) \ - panic("m_pulldown malfunction"); \ - (val) = (typ)mtod(t, caddr_t); \ - } else { \ - (val) = (typ)NULL; \ - (m) = NULL; \ - } \ - } \ -} while (/*CONSTCOND*/ 0) - -#endif /*_KERNEL*/ - #endif /* not _NETINET_IP6_H_ */ From owner-svn-src-head@freebsd.org Fri Nov 15 22:48:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5D041B27C5; Fri, 15 Nov 2019 22:48:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FD5X47kRz4Wc6; Fri, 15 Nov 2019 22:48:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 696DA1FEC6; Fri, 15 Nov 2019 22:48:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFMm0Ss037001; Fri, 15 Nov 2019 22:48:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFMm0TG037000; Fri, 15 Nov 2019 22:48:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911152248.xAFMm0TG037000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 15 Nov 2019 22:48:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354752 - head/sys/dev/ioat X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ioat X-SVN-Commit-Revision: 354752 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 22:48:00 -0000 Author: mav Date: Fri Nov 15 22:47:59 2019 New Revision: 354752 URL: https://svnweb.freebsd.org/changeset/base/354752 Log: Cleanup address range checks in ioat(4). - Deduce allowed address range for bus_dma(9) from the hardware version. Different versions (CPU generations) have different documented limits. - Remove difference between address ranges for src/dst and crc. At least docs for few recent generations of CPUs do not mention anything like that, while older are already limited with above limits. - Remove address assertions from arguments. While I do not think the addresses out of allowed ranges should realistically happen there due to the platforms physical address limitations, there is now bus_dma(9) to make sure of that, preferably via IOMMU. - Since crc now has the same address range as src/dst, remove crc_dmamap, reusing dst2_dmamap instead. Discussed with: cem MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat_internal.h Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Fri Nov 15 21:55:41 2019 (r354751) +++ head/sys/dev/ioat/ioat.c Fri Nov 15 22:47:59 2019 (r354752) @@ -64,8 +64,11 @@ __FBSDID("$FreeBSD$"); #include "ioat_internal.h" #ifndef BUS_SPACE_MAXADDR_40BIT -#define BUS_SPACE_MAXADDR_40BIT 0xFFFFFFFFFFULL +#define BUS_SPACE_MAXADDR_40BIT MIN(BUS_SPACE_MAXADDR, 0xFFFFFFFFFFULL) #endif +#ifndef BUS_SPACE_MAXADDR_46BIT +#define BUS_SPACE_MAXADDR_46BIT MIN(BUS_SPACE_MAXADDR, 0x3FFFFFFFFFFFULL) +#endif static int ioat_probe(device_t device); static int ioat_attach(device_t device); @@ -413,17 +416,6 @@ ioat_detach(device_t device) bus_dma_tag_destroy(ioat->data_tag); } - if (ioat->data_crc_tag != NULL) { - for (i = 0; i < 1 << ioat->ring_size_order; i++) { - error = ioat_bus_dmamap_destroy(ioat, __func__, - ioat->data_crc_tag, ioat->ring[i].crc_dmamap); - if (error != 0) - return (error); - } - - bus_dma_tag_destroy(ioat->data_crc_tag); - } - if (ioat->ring != NULL) ioat_free_ring(ioat, 1 << ioat->ring_size_order, ioat->ring); @@ -514,6 +506,7 @@ ioat3_attach(device_t device) struct ioat_descriptor *ring; struct ioat_dma_hw_descriptor *dma_hw_desc; void *hw_desc; + bus_addr_t lowaddr; size_t ringsz; int i, num_descriptors; int error; @@ -549,16 +542,25 @@ ioat3_attach(device_t device) ioat->is_submitter_processing = FALSE; - bus_dma_tag_create(bus_get_dma_tag(ioat->device), sizeof(uint64_t), 0x0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + if (ioat->version >= IOAT_VER_3_3) + lowaddr = BUS_SPACE_MAXADDR_48BIT; + else if (ioat->version >= IOAT_VER_3_2) + lowaddr = BUS_SPACE_MAXADDR_46BIT; + else + lowaddr = BUS_SPACE_MAXADDR_40BIT; + + error = bus_dma_tag_create(bus_get_dma_tag(ioat->device), + sizeof(uint64_t), 0x0, lowaddr, BUS_SPACE_MAXADDR, NULL, NULL, sizeof(uint64_t), 1, sizeof(uint64_t), 0, NULL, NULL, &ioat->comp_update_tag); + if (error != 0) + return (error); error = bus_dmamem_alloc(ioat->comp_update_tag, (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, &ioat->comp_update_map); - if (ioat->comp_update == NULL) - return (ENOMEM); + if (error != 0) + return (error); error = bus_dmamap_load(ioat->comp_update_tag, ioat->comp_update_map, ioat->comp_update, sizeof(uint64_t), ioat_comp_update_map, ioat, @@ -571,9 +573,8 @@ ioat3_attach(device_t device) ringsz = sizeof(struct ioat_dma_hw_descriptor) * num_descriptors; error = bus_dma_tag_create(bus_get_dma_tag(ioat->device), - 2 * 1024 * 1024, 0x0, (bus_addr_t)BUS_SPACE_MAXADDR_40BIT, - BUS_SPACE_MAXADDR, NULL, NULL, ringsz, 1, ringsz, 0, NULL, NULL, - &ioat->hw_desc_tag); + 2 * 1024 * 1024, 0x0, lowaddr, BUS_SPACE_MAXADDR, NULL, NULL, + ringsz, 1, ringsz, 0, NULL, NULL, &ioat->hw_desc_tag); if (error != 0) return (error); @@ -590,24 +591,11 @@ ioat3_attach(device_t device) ioat->hw_desc_ring = hw_desc; error = bus_dma_tag_create(bus_get_dma_tag(ioat->device), - 1, 0, BUS_SPACE_MAXADDR_40BIT, BUS_SPACE_MAXADDR, NULL, NULL, + 1, 0, lowaddr, BUS_SPACE_MAXADDR, NULL, NULL, ioat->max_xfer_size, 1, ioat->max_xfer_size, 0, NULL, NULL, - &ioat->data_crc_tag); - if (error != 0) { - ioat_log_message(0, "%s: bus_dma_tag_create failed %d\n", - __func__, error); - return (error); - } - - error = bus_dma_tag_create(bus_get_dma_tag(ioat->device), - 1, 0, BUS_SPACE_MAXADDR_48BIT, BUS_SPACE_MAXADDR, NULL, NULL, - ioat->max_xfer_size, 1, ioat->max_xfer_size, 0, NULL, NULL, &ioat->data_tag); - if (error != 0) { - ioat_log_message(0, "%s: bus_dma_tag_create failed %d\n", - __func__, error); + if (error != 0) return (error); - } ioat->ring = malloc_domainset(num_descriptors * sizeof(*ring), M_IOAT, DOMAINSET_PREF(ioat->domain), M_ZERO | M_WAITOK); @@ -647,14 +635,6 @@ ioat3_attach(device_t device) error); return (error); } - error = bus_dmamap_create(ioat->data_crc_tag, 0, - &ring[i].crc_dmamap); - if (error != 0) { - ioat_log_message(0, - "%s: bus_dmamap_create failed %d\n", __func__, - error); - return (error); - } } for (i = 0; i < num_descriptors; i++) { @@ -853,7 +833,6 @@ ioat_process_events(struct ioat_softc *ioat, boolean_t bus_dmamap_unload(ioat->data_tag, desc->dst_dmamap); bus_dmamap_unload(ioat->data_tag, desc->src2_dmamap); bus_dmamap_unload(ioat->data_tag, desc->dst2_dmamap); - bus_dmamap_unload(ioat->data_crc_tag, desc->crc_dmamap); if (dmadesc->callback_fn != NULL) dmadesc->callback_fn(dmadesc->callback_arg, 0); @@ -1223,10 +1202,6 @@ ioat_copy(bus_dmaengine_t dmaengine, bus_addr_t dst, struct ioat_softc *ioat; ioat = to_ioat_softc(dmaengine); - - KASSERT(((src | dst) & (0xffffull << 48)) == 0, - ("%s: high 16 bits of src/dst are not zero", __func__)); - desc = ioat_op_generic(ioat, IOAT_OP_COPY, len, src, dst, callback_fn, callback_arg, flags); if (desc == NULL) @@ -1257,8 +1232,6 @@ ioat_copy_8k_aligned(bus_dmaengine_t dmaengine, bus_ad ioat = to_ioat_softc(dmaengine); CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); - KASSERT(((src1 | src2 | dst1 | dst2) & (0xffffull << 48)) == 0, - ("%s: high 16 bits of src/dst are not zero", __func__)); KASSERT(((src1 | src2 | dst1 | dst2) & PAGE_MASK) == 0, ("%s: addresses are not page-aligned", __func__)); @@ -1340,8 +1313,6 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t ds KASSERT((ioat->capabilities & IOAT_DMACAP_MOVECRC) != 0, ("%s: device lacks MOVECRC capability", __func__)); - KASSERT(((src | dst) & (0xffffffull << 40)) == 0, - ("%s: high 24 bits of src/dst are not zero", __func__)); teststore = (flags & _DMA_CRC_TESTSTORE); KASSERT(teststore != _DMA_CRC_TESTSTORE, ("%s: TEST and STORE invalid", __func__)); @@ -1361,10 +1332,6 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t ds break; } - KASSERT((flags & DMA_CRC_INLINE) != 0 || - (crcptr & (0xffffffull << 40)) == 0, - ("%s: high 24 bits of crcptr are not zero", __func__)); - desc = ioat_op_generic(ioat, op, len, src, dst, callback_fn, callback_arg, flags & ~_DMA_CRC_FLAGS); if (desc == NULL) @@ -1374,8 +1341,8 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t ds if ((flags & DMA_CRC_INLINE) == 0) { nseg = -1; - error = _bus_dmamap_load_phys(ioat->data_crc_tag, - desc->crc_dmamap, crcptr, sizeof(uint32_t), 0, + error = _bus_dmamap_load_phys(ioat->data_tag, + desc->dst2_dmamap, crcptr, sizeof(uint32_t), 0, &seg, &nseg); if (error != 0) { ioat_log_message(0, "%s: _bus_dmamap_load_phys" @@ -1416,8 +1383,6 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bu KASSERT((ioat->capabilities & IOAT_DMACAP_CRC) != 0, ("%s: device lacks CRC capability", __func__)); - KASSERT((src & (0xffffffull << 40)) == 0, - ("%s: high 24 bits of src are not zero", __func__)); teststore = (flags & _DMA_CRC_TESTSTORE); KASSERT(teststore != _DMA_CRC_TESTSTORE, ("%s: TEST and STORE invalid", __func__)); @@ -1437,10 +1402,6 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bu break; } - KASSERT((flags & DMA_CRC_INLINE) != 0 || - (crcptr & (0xffffffull << 40)) == 0, - ("%s: high 24 bits of crcptr are not zero", __func__)); - desc = ioat_op_generic(ioat, op, len, src, 0, callback_fn, callback_arg, flags & ~_DMA_CRC_FLAGS); if (desc == NULL) @@ -1450,8 +1411,8 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bu if ((flags & DMA_CRC_INLINE) == 0) { nseg = -1; - error = _bus_dmamap_load_phys(ioat->data_crc_tag, - desc->crc_dmamap, crcptr, sizeof(uint32_t), 0, + error = _bus_dmamap_load_phys(ioat->data_tag, + desc->dst2_dmamap, crcptr, sizeof(uint32_t), 0, &seg, &nseg); if (error != 0) { ioat_log_message(0, "%s: _bus_dmamap_load_phys" @@ -1488,8 +1449,6 @@ ioat_blockfill(bus_dmaengine_t dmaengine, bus_addr_t d KASSERT((ioat->capabilities & IOAT_DMACAP_BFILL) != 0, ("%s: device lacks BFILL capability", __func__)); - KASSERT((dst & (0xffffull << 48)) == 0, - ("%s: high 16 bits of crcptr are not zero", __func__)); desc = ioat_op_generic(ioat, IOAT_OP_FILL, len, 0, dst, callback_fn, callback_arg, flags); Modified: head/sys/dev/ioat/ioat_internal.h ============================================================================== --- head/sys/dev/ioat/ioat_internal.h Fri Nov 15 21:55:41 2019 (r354751) +++ head/sys/dev/ioat/ioat_internal.h Fri Nov 15 22:47:59 2019 (r354752) @@ -418,7 +418,6 @@ struct ioat_descriptor { bus_dmamap_t dst_dmamap; bus_dmamap_t src2_dmamap; bus_dmamap_t dst2_dmamap; - bus_dmamap_t crc_dmamap; }; /* Unused by this driver at this time. */ @@ -465,7 +464,6 @@ struct ioat_softc { bus_dmamap_t hw_desc_map; bus_dma_tag_t data_tag; - bus_dma_tag_t data_crc_tag; bus_dma_tag_t comp_update_tag; bus_dmamap_t comp_update_map; From owner-svn-src-head@freebsd.org Fri Nov 15 23:01:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7E861B2D35; Fri, 15 Nov 2019 23:01:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FDNj4y90z3P7F; Fri, 15 Nov 2019 23:01:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DC8E200D7; Fri, 15 Nov 2019 23:01:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFN19Px043481; Fri, 15 Nov 2019 23:01:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFN1901043480; Fri, 15 Nov 2019 23:01:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911152301.xAFN1901043480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 15 Nov 2019 23:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354753 - head/sys/dev/ioat X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ioat X-SVN-Commit-Revision: 354753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 23:01:09 -0000 Author: mav Date: Fri Nov 15 23:01:09 2019 New Revision: 354753 URL: https://svnweb.freebsd.org/changeset/base/354753 Log: Initialize *comp_update with valid value. I've noticed that sometimes with enabled DMAR initial write from device to this address is somehow getting delayed, triggering assertion due to zero default being invalid. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Fri Nov 15 22:47:59 2019 (r354752) +++ head/sys/dev/ioat/ioat.c Fri Nov 15 23:01:09 2019 (r354753) @@ -642,10 +642,9 @@ ioat3_attach(device_t device) dma_hw_desc->next = RING_PHYS_ADDR(ioat, i + 1); } - ioat->head = 0; - ioat->tail = 0; - ioat->last_seen = 0; - *ioat->comp_update = 0; + ioat->tail = ioat->head = 0; + *ioat->comp_update = ioat->last_seen = + RING_PHYS_ADDR(ioat, ioat->tail - 1); return (0); } @@ -1751,8 +1750,8 @@ ioat_reset_hw(struct ioat_softc *ioat) * at zero as well. */ ioat->tail = ioat->head = 0; - ioat->last_seen = 0; - *ioat->comp_update = 0; + *ioat->comp_update = ioat->last_seen = + RING_PHYS_ADDR(ioat, ioat->tail - 1); ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN); ioat_write_chancmp(ioat, ioat->comp_update_bus_addr); From owner-svn-src-head@freebsd.org Fri Nov 15 23:01:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5209F1B2F48; Fri, 15 Nov 2019 23:01:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FDPN1YLLz3PX0; Fri, 15 Nov 2019 23:01:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 184B12010B; Fri, 15 Nov 2019 23:01:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFN1hxu046426; Fri, 15 Nov 2019 23:01:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFN1hBM046422; Fri, 15 Nov 2019 23:01:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911152301.xAFN1hBM046422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 15 Nov 2019 23:01:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354754 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Commit-Revision: 354754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 23:01:44 -0000 Author: jhb Date: Fri Nov 15 23:01:43 2019 New Revision: 354754 URL: https://svnweb.freebsd.org/changeset/base/354754 Log: Use a sv_copyout_auxargs hook in the Linux ELF ABIs. Reviewed by: emaste Tested on: amd64 (linux64 only), i386 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22356 Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm64/linux/linux_sysvec.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Fri Nov 15 23:01:09 2019 (r354753) +++ head/sys/amd64/linux/linux_sysvec.c Fri Nov 15 23:01:43 2019 (r354754) @@ -222,24 +222,17 @@ linux_set_syscall_retval(struct thread *td, int error) set_pcb_flags(td->td_pcb, PCB_FULL_IRET); } -static int -linux_fixup_elf(register_t **stack_base, struct image_params *imgp) +static void +linux_copyout_auxargs(struct image_params *imgp, u_long *base) { Elf_Auxargs *args; Elf_Auxinfo *argarray, *pos; - Elf_Addr *auxbase, *base; - struct ps_strings *arginfo; + u_long auxlen; struct proc *p; - int error, issetugid; + int issetugid; p = imgp->proc; - arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; - - KASSERT(curthread->td_proc == imgp->proc, - ("unsafe linux_fixup_elf(), should be curproc")); - base = (Elf64_Addr *)*stack_base; args = (Elf64_Auxargs *)imgp->auxargs; - auxbase = base + imgp->args->argc + 1 + imgp->args->envc + 1; argarray = pos = malloc(LINUX_AT_COUNT * sizeof(*pos), M_TEMP, M_WAITOK | M_ZERO); @@ -267,15 +260,23 @@ linux_fixup_elf(register_t **stack_base, struct image_ if (args->execfd != -1) AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY(pos, AT_NULL, 0); + free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); - error = copyout(argarray, auxbase, sizeof(*argarray) * LINUX_AT_COUNT); + auxlen = sizeof(*argarray) * (pos - argarray); + *base -= auxlen; + copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); - if (error != 0) - return (error); +} +static int +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) +{ + Elf_Addr *base; + + base = (Elf64_Addr *)*stack_base; base--; if (suword(base, (uint64_t)imgp->args->argc) == -1) return (EFAULT); @@ -327,27 +328,22 @@ linux_copyout_strings(struct image_params *imgp) copyout(canary, (void *)imgp->canary, sizeof(canary)); vectp = (char **)destp; - if (imgp->auxargs) { - /* - * Allocate room on the stack for the ELF auxargs - * array. It has LINUX_AT_COUNT entries. - */ - vectp -= howmany(LINUX_AT_COUNT * sizeof(Elf64_Auxinfo), - sizeof(*vectp)); - } /* - * Allocate room for the argv[] and env vectors including the - * terminating NULL pointers. - */ - vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; - - /* * Starting with 2.24, glibc depends on a 16-byte stack alignment. * One "long argc" will be prepended later. */ vectp = (char **)((((uintptr_t)vectp + 8) & ~0xF) - 8); + if (imgp->auxargs) + imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); + + /* + * Allocate room for the argv[] and env vectors including the + * terminating NULL pointers. + */ + vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; + /* vectp also becomes our initial stack base. */ stack_base = (register_t *)vectp; @@ -715,6 +711,7 @@ struct sysentvec elf_linux_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = linux_copyout_auxargs, .sv_copyout_strings = linux_copyout_strings, .sv_setregs = linux_exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Fri Nov 15 23:01:09 2019 (r354753) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Nov 15 23:01:43 2019 (r354754) @@ -185,22 +185,15 @@ linux_translate_traps(int signal, int trap_code) } } -static int -linux_fixup_elf(register_t **stack_base, struct image_params *imgp) +static void +linux_copyout_auxargs(struct image_params *imgp, u_long *base) { Elf32_Auxargs *args; Elf32_Auxinfo *argarray, *pos; - Elf32_Addr *auxbase, *base; - struct linux32_ps_strings *arginfo; - int error, issetugid; + u_long auxlen; + int issetugid; - arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - - KASSERT(curthread->td_proc == imgp->proc, - ("unsafe linux_fixup_elf(), should be curproc")); - base = (Elf32_Addr *)*stack_base; args = (Elf32_Auxargs *)imgp->auxargs; - auxbase = base + (imgp->args->argc + 1 + imgp->args->envc + 1); argarray = pos = malloc(LINUX_AT_COUNT * sizeof(*pos), M_TEMP, M_WAITOK | M_ZERO); @@ -244,12 +237,18 @@ linux_fixup_elf(register_t **stack_base, struct image_ imgp->auxargs = NULL; KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); - error = copyout(&argarray[0], auxbase, - sizeof(*argarray) * LINUX_AT_COUNT); + auxlen = sizeof(*argarray) * (pos - argarray); + *base -= auxlen; + copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); - if (error != 0) - return (error); +} +static int +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) +{ + Elf32_Addr *base; + + base = (Elf32_Addr *)*stack_base; base--; if (suword32(base, (uint32_t)imgp->args->argc) == -1) return (EFAULT); @@ -755,14 +754,8 @@ linux_copyout_strings(struct image_params *imgp) copyout(canary, (void *)imgp->canary, sizeof(canary)); vectp = (uint32_t *)destp; - if (imgp->auxargs) { - /* - * Allocate room on the stack for the ELF auxargs - * array. It has LINUX_AT_COUNT entries. - */ - vectp -= howmany(LINUX_AT_COUNT * sizeof(Elf32_Auxinfo), - sizeof(*vectp)); - } + if (imgp->auxargs) + imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); /* * Allocate room for the argv[] and env vectors including the @@ -875,6 +868,7 @@ struct sysentvec elf_linux_sysvec = { .sv_usrstack = LINUX32_USRSTACK, .sv_psstrings = LINUX32_PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = linux_copyout_auxargs, .sv_copyout_strings = linux_copyout_strings, .sv_setregs = linux_exec_setregs, .sv_fixlimit = linux32_fixlimit, Modified: head/sys/arm64/linux/linux_sysvec.c ============================================================================== --- head/sys/arm64/linux/linux_sysvec.c Fri Nov 15 23:01:09 2019 (r354753) +++ head/sys/arm64/linux/linux_sysvec.c Fri Nov 15 23:01:43 2019 (r354754) @@ -87,6 +87,7 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); /* DTrace probes */ LIN_SDT_PROBE_DEFINE2(sysvec, linux_translate_traps, todo, "int", "int"); LIN_SDT_PROBE_DEFINE0(sysvec, linux_exec_setregs, todo); +LIN_SDT_PROBE_DEFINE0(sysvec, linux_copyout_auxargs, todo); LIN_SDT_PROBE_DEFINE0(sysvec, linux_elf_fixup, todo); LIN_SDT_PROBE_DEFINE0(sysvec, linux_rt_sigreturn, todo); LIN_SDT_PROBE_DEFINE0(sysvec, linux_rt_sendsig, todo); @@ -140,26 +141,19 @@ linux_set_syscall_retval(struct thread *td, int error) cpu_set_syscall_retval(td, error); } -static int -linux_elf_fixup(register_t **stack_base, struct image_params *imgp) +static void +linux_copyout_auxargs(struct image_params *imgp, u_long *base) { Elf_Auxargs *args; Elf_Auxinfo *argarray, *pos; - Elf_Addr *auxbase, *base; - struct ps_strings *arginfo; + u_long auxlen; struct proc *p; - int error, issetugid; + int issetugid; - LIN_SDT_PROBE0(sysvec, linux_elf_fixup, todo); + LIN_SDT_PROBE0(sysvec, linux_copyout_auxargs, todo); p = imgp->proc; - arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; - KASSERT(curthread->td_proc == imgp->proc, - ("unsafe linux_elf_fixup(), should be curproc")); - base = (Elf64_Addr *)*stack_base; args = (Elf64_Auxargs *)imgp->auxargs; - /* Auxargs after argc, and NULL-terminated argv and envv lists. */ - auxbase = base + 1 + imgp->args->argc + 1 + imgp->args->envc + 1; argarray = pos = malloc(LINUX_AT_COUNT * sizeof(*pos), M_TEMP, M_WAITOK | M_ZERO); @@ -195,11 +189,18 @@ linux_elf_fixup(register_t **stack_base, struct image_ imgp->auxargs = NULL; KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); - error = copyout(argarray, auxbase, sizeof(*argarray) * LINUX_AT_COUNT); + auxlen = sizeof(*argarray) * (pos - argarray); + *base -= auxlen; + copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); - if (error != 0) - return (error); +} +static int +linux_elf_fixup(register_t **stack_base, struct image_params *imgp) +{ + + LIN_SDT_PROBE0(sysvec, linux_elf_fixup, todo); + return (0); } @@ -247,14 +248,8 @@ linux_copyout_strings(struct image_params *imgp) copyout(canary, (void *)imgp->canary, sizeof(canary)); vectp = (char **)destp; - if (imgp->auxargs) { - /* - * Allocate room on the stack for the ELF auxargs - * array. It has up to LINUX_AT_COUNT entries. - */ - vectp -= howmany(LINUX_AT_COUNT * sizeof(Elf64_Auxinfo), - sizeof(*vectp)); - } + if (imgp->auxargs) + imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); /* * Allocate room for argc and the argv[] and env vectors including the @@ -372,6 +367,7 @@ struct sysentvec elf_linux_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, /* XXX */ .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, + .sv_copyout_auxargs = linux_copyout_auxargs, .sv_copyout_strings = linux_copyout_strings, .sv_setregs = linux_exec_setregs, .sv_fixlimit = NULL, Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Fri Nov 15 23:01:09 2019 (r354753) +++ head/sys/i386/linux/linux_sysvec.c Fri Nov 15 23:01:43 2019 (r354754) @@ -188,25 +188,22 @@ linux_fixup(register_t **stack_base, struct image_para return (0); } -static int -linux_fixup_elf(register_t **stack_base, struct image_params *imgp) +static void +linux_copyout_auxargs(struct image_params *imgp, u_long *base) { struct proc *p; Elf32_Auxargs *args; Elf32_Auxinfo *argarray, *pos; - Elf32_Addr *auxbase, *uplatform; + Elf32_Addr *uplatform; struct ps_strings *arginfo; - int error, issetugid; + u_long auxlen; + int issetugid; - KASSERT(curthread->td_proc == imgp->proc, - ("unsafe linux_fixup_elf(), should be curproc")); - p = imgp->proc; issetugid = imgp->proc->p_flag & P_SUGID ? 1 : 0; arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szplatform); args = (Elf32_Auxargs *)imgp->auxargs; - auxbase = *stack_base + imgp->args->argc + 1 + imgp->args->envc + 1; argarray = pos = malloc(LINUX_AT_COUNT * sizeof(*pos), M_TEMP, M_WAITOK | M_ZERO); @@ -249,11 +246,16 @@ linux_fixup_elf(register_t **stack_base, struct image_ imgp->auxargs = NULL; KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); - error = copyout(argarray, auxbase, sizeof(*argarray) * LINUX_AT_COUNT); + auxlen = sizeof(*argarray) * (pos - argarray); + *base -= auxlen; + copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); - if (error != 0) - return (error); +} +static int +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) +{ + (*stack_base)--; if (suword(*stack_base, (register_t)imgp->args->argc) == -1) return (EFAULT); @@ -305,14 +307,8 @@ linux_copyout_strings(struct image_params *imgp) copyout(canary, (void *)imgp->canary, sizeof(canary)); vectp = (char **)destp; - if (imgp->auxargs) { - /* - * Allocate room on the stack for the ELF auxargs - * array. It has LINUX_AT_COUNT entries. - */ - vectp -= howmany(LINUX_AT_COUNT * sizeof(Elf32_Auxinfo), - sizeof(*vectp)); - } + if (imgp->auxargs) + imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); /* * Allocate room for the argv[] and env vectors including the @@ -851,6 +847,7 @@ struct sysentvec elf_linux_sysvec = { .sv_usrstack = LINUX_USRSTACK, .sv_psstrings = LINUX_PS_STRINGS, .sv_stackprot = VM_PROT_ALL, + .sv_copyout_auxargs = linux_copyout_auxargs, .sv_copyout_strings = linux_copyout_strings, .sv_setregs = linux_exec_setregs, .sv_fixlimit = NULL, From owner-svn-src-head@freebsd.org Fri Nov 15 23:12:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C7071B32F6; Fri, 15 Nov 2019 23:12:21 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FDdc4htGz4442; Fri, 15 Nov 2019 23:12:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34CB620409; Fri, 15 Nov 2019 23:12:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFNCKdZ054553; Fri, 15 Nov 2019 23:12:20 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFNCJdc054552; Fri, 15 Nov 2019 23:12:19 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911152312.xAFNCJdc054552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 15 Nov 2019 23:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354755 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 23:12:21 -0000 Author: bz Date: Fri Nov 15 23:12:19 2019 New Revision: 354755 URL: https://svnweb.freebsd.org/changeset/base/354755 Log: if_llatbl: change htable_unlink_entry() to early exist if no work to do Adjust the logic in htable_unlink_entry() to the one in htable_link_entry() saving a block indent and making it more clear in which case we do not do any work. No functional change. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/net/if_llatbl.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Fri Nov 15 23:01:43 2019 (r354754) +++ head/sys/net/if_llatbl.c Fri Nov 15 23:12:19 2019 (r354755) @@ -177,15 +177,16 @@ static void htable_unlink_entry(struct llentry *lle) { - if ((lle->la_flags & LLE_LINKED) != 0) { - IF_AFDATA_WLOCK_ASSERT(lle->lle_tbl->llt_ifp); - CK_LIST_REMOVE(lle, lle_next); - lle->la_flags &= ~(LLE_VALID | LLE_LINKED); + if ((lle->la_flags & LLE_LINKED) == 0) + return; + + IF_AFDATA_WLOCK_ASSERT(lle->lle_tbl->llt_ifp); + CK_LIST_REMOVE(lle, lle_next); + lle->la_flags &= ~(LLE_VALID | LLE_LINKED); #if 0 - lle->lle_tbl = NULL; - lle->lle_head = NULL; + lle->lle_tbl = NULL; + lle->lle_head = NULL; #endif - } } struct prefix_match_data { From owner-svn-src-head@freebsd.org Fri Nov 15 23:27:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30A031B387F; Fri, 15 Nov 2019 23:27:19 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FDyt53rGz4ZKg; Fri, 15 Nov 2019 23:27:18 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D590205EF; Fri, 15 Nov 2019 23:27:18 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFNRIqR061475; Fri, 15 Nov 2019 23:27:18 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFNRI5l061473; Fri, 15 Nov 2019 23:27:18 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911152327.xAFNRI5l061473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 15 Nov 2019 23:27:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354756 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 354756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 23:27:19 -0000 Author: scottl Date: Fri Nov 15 23:27:17 2019 New Revision: 354756 URL: https://svnweb.freebsd.org/changeset/base/354756 Log: Create a new sysctl subtree, machdep.mitigations. Its purpose is to organize knobs and indicators for code that mitigates functional and security issues in the architecture/platform. Controls for regular operational policy should still go into places security, hw, kern, etc. The machdep root node is inherently architecture dependent, but mitigations tend to be architecture dependent as well. Some cases like Spectre do cross architectural boundaries, but the mitigation code for them tends to be architecture dependent anyways, and multiple architectures won't be active in the same image of the kernel. Many mitigation knobs already exist in the system, and they will be moved with compat naming in the future. Going forward, mitigations should collect in machdep.mitigations. Reviewed by: imp, brooks, rwatson, emaste, jhb Sponsored by: Intel Modified: head/sys/kern/kern_mib.c head/sys/sys/sysctl.h Modified: head/sys/kern/kern_mib.c ============================================================================== --- head/sys/kern/kern_mib.c Fri Nov 15 23:12:19 2019 (r354755) +++ head/sys/kern/kern_mib.c Fri Nov 15 23:27:17 2019 (r354756) @@ -78,6 +78,8 @@ SYSCTL_ROOT_NODE(CTL_HW, hw, CTLFLAG_RW, 0, "hardware"); SYSCTL_ROOT_NODE(CTL_MACHDEP, machdep, CTLFLAG_RW, 0, "machine dependent"); +SYSCTL_NODE(_machdep, OID_AUTO, mitigations, CTLFLAG_RW, 0, + "Machine dependent platform mitigations."); SYSCTL_ROOT_NODE(CTL_USER, user, CTLFLAG_RW, 0, "user-level"); SYSCTL_ROOT_NODE(CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0, Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Fri Nov 15 23:12:19 2019 (r354755) +++ head/sys/sys/sysctl.h Fri Nov 15 23:27:17 2019 (r354756) @@ -1094,6 +1094,7 @@ SYSCTL_DECL(_hw_bus); SYSCTL_DECL(_hw_bus_devices); SYSCTL_DECL(_hw_bus_info); SYSCTL_DECL(_machdep); +SYSCTL_DECL(_machdep_mitigations); SYSCTL_DECL(_user); SYSCTL_DECL(_compat); SYSCTL_DECL(_regression); From owner-svn-src-head@freebsd.org Sat Nov 16 00:02:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 879D01B440F; Sat, 16 Nov 2019 00:02:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FFld0yyRz3NVm; Sat, 16 Nov 2019 00:02:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04C9E20D5E; Sat, 16 Nov 2019 00:02:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAG02abo085379; Sat, 16 Nov 2019 00:02:36 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAG02aO6085378; Sat, 16 Nov 2019 00:02:36 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911160002.xAG02aO6085378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Nov 2019 00:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354757 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354757 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 00:02:37 -0000 Author: bz Date: Sat Nov 16 00:02:36 2019 New Revision: 354757 URL: https://svnweb.freebsd.org/changeset/base/354757 Log: nd6_rtr: Pull in the TAILQ_HEAD() as it is not needed outside nd6_rtr.c. Rename the TAILQ_HEAD() struct and the nd_defrouter variable from "nd_" to "nd6_" as they are not part of the RFC 3542 API which uses "ND_". Ideally I'd like to also rename the struct nd_defrouter {} to "nd6_*" but given that is used externally there is more work to do. No functional changes. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/nd6.h head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Fri Nov 15 23:27:17 2019 (r354756) +++ head/sys/netinet6/nd6.h Sat Nov 16 00:02:36 2019 (r354757) @@ -193,7 +193,6 @@ struct in6_ndifreq { (((MIN_RANDOM_FACTOR * (x >> 10)) + (arc4random() & \ ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000) -TAILQ_HEAD(nd_drhead, nd_defrouter); struct nd_defrouter { TAILQ_ENTRY(nd_defrouter) dr_entry; struct in6_addr rtaddr; Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Fri Nov 15 23:27:17 2019 (r354756) +++ head/sys/netinet6/nd6_rtr.c Sat Nov 16 00:02:36 2019 (r354757) @@ -92,8 +92,9 @@ static void in6_init_address_ltimes(struct nd_prefix * static int rt6_deleteroute(const struct rtentry *, void *); -VNET_DEFINE_STATIC(struct nd_drhead, nd_defrouter); -#define V_nd_defrouter VNET(nd_defrouter) +TAILQ_HEAD(nd6_drhead, nd_defrouter); +VNET_DEFINE_STATIC(struct nd6_drhead, nd6_defrouter); +#define V_nd6_defrouter VNET(nd6_defrouter) VNET_DECLARE(int, nd6_recalc_reachtm_interval); #define V_nd6_recalc_reachtm_interval VNET(nd6_recalc_reachtm_interval) @@ -141,12 +142,12 @@ defrouter_rele(struct nd_defrouter *dr) * caller-supplied queue. */ static void -defrouter_unlink(struct nd_defrouter *dr, struct nd_drhead *drq) +defrouter_unlink(struct nd_defrouter *dr, struct nd6_drhead *drq) { ND6_WLOCK_ASSERT(); - TAILQ_REMOVE(&V_nd_defrouter, dr, dr_entry); + TAILQ_REMOVE(&V_nd6_defrouter, dr, dr_entry); V_nd6_list_genid++; if (drq != NULL) TAILQ_INSERT_TAIL(drq, dr, dr_entry); @@ -270,7 +271,7 @@ defrtr_ipv6_only_ifp(struct ifnet *ifp) ipv6_only = true; ND6_RLOCK(); - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) if (dr->ifp == ifp && (dr->raflags & ND_RA_FLAG_IPV6_ONLY) == 0) ipv6_only = false; @@ -680,7 +681,7 @@ defrouter_lookup_locked(struct in6_addr *addr, struct struct nd_defrouter *dr; ND6_LOCK_ASSERT(); - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) if (dr->ifp == ifp && IN6_ARE_ADDR_EQUAL(addr, &dr->rtaddr)) { defrouter_ref(dr); return (dr); @@ -746,14 +747,14 @@ defrouter_reset(void) * current default router list and use that when deleting routes. */ ND6_RLOCK(); - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) count++; ND6_RUNLOCK(); dra = malloc(count * sizeof(*dra), M_TEMP, M_WAITOK | M_ZERO); ND6_RLOCK(); - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { if (i == count) break; defrouter_ref(dr); @@ -891,7 +892,7 @@ defrouter_select_fib(int fibnum) * Let's handle easy case (3) first: * If default router list is empty, there's nothing to be done. */ - if (TAILQ_EMPTY(&V_nd_defrouter)) { + if (TAILQ_EMPTY(&V_nd6_defrouter)) { ND6_RUNLOCK(); return; } @@ -902,7 +903,7 @@ defrouter_select_fib(int fibnum) * the ordering rule of the list described in defrtrlist_update(). */ selected_dr = installed_dr = NULL; - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { NET_EPOCH_ENTER(et); if (selected_dr == NULL && dr->ifp->if_fib == fibnum && (ln = nd6_lookup(&dr->rtaddr, 0, dr->ifp)) && @@ -941,12 +942,12 @@ defrouter_select_fib(int fibnum) if (selected_dr == NULL) { if (installed_dr == NULL || TAILQ_NEXT(installed_dr, dr_entry) == NULL) - dr = TAILQ_FIRST(&V_nd_defrouter); + dr = TAILQ_FIRST(&V_nd6_defrouter); else dr = TAILQ_NEXT(installed_dr, dr_entry); /* Ensure we select a router for this FIB. */ - TAILQ_FOREACH_FROM(dr, &V_nd_defrouter, dr_entry) { + TAILQ_FOREACH_FROM(dr, &V_nd6_defrouter, dr_entry) { if (dr->ifp->if_fib == fibnum) { selected_dr = dr; defrouter_ref(selected_dr); @@ -1084,7 +1085,7 @@ restart: * The preferred router may have changed, so relocate this * router. */ - TAILQ_REMOVE(&V_nd_defrouter, dr, dr_entry); + TAILQ_REMOVE(&V_nd6_defrouter, dr, dr_entry); n = dr; } else { n = malloc(sizeof(*n), M_IP6NDP, M_NOWAIT | M_ZERO); @@ -1105,14 +1106,14 @@ restart: */ /* insert at the end of the group */ - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { if (rtpref(n) > rtpref(dr)) break; } if (dr != NULL) TAILQ_INSERT_BEFORE(dr, n, dr_entry); else - TAILQ_INSERT_TAIL(&V_nd_defrouter, n, dr_entry); + TAILQ_INSERT_TAIL(&V_nd6_defrouter, n, dr_entry); V_nd6_list_genid++; ND6_WUNLOCK(); @@ -1750,7 +1751,7 @@ pfxlist_onlink_check(void) * that does not advertise any prefixes. */ if (pr == NULL) { - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { struct nd_prefix *pr0; LIST_FOREACH(pr0, &V_nd_prefix, ndpr_entry) { @@ -1761,7 +1762,7 @@ pfxlist_onlink_check(void) break; } } - if (pr != NULL || (!TAILQ_EMPTY(&V_nd_defrouter) && pfxrtr == NULL)) { + if (pr != NULL || (!TAILQ_EMPTY(&V_nd6_defrouter) && pfxrtr == NULL)) { /* * There is at least one prefix that has a reachable router, * or at least a router which probably does not advertise @@ -2550,7 +2551,7 @@ nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS) d.rtaddr.sin6_len = sizeof(d.rtaddr); ND6_RLOCK(); - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { d.rtaddr.sin6_addr = dr->rtaddr; error = sa6_recoverscope(&d.rtaddr); if (error != 0) @@ -2576,19 +2577,19 @@ bool nd6_defrouter_list_empty(void) { - return (TAILQ_EMPTY(&V_nd_defrouter)); + return (TAILQ_EMPTY(&V_nd6_defrouter)); } void nd6_defrouter_timer(void) { struct nd_defrouter *dr, *ndr; - struct nd_drhead drq; + struct nd6_drhead drq; TAILQ_INIT(&drq); ND6_WLOCK(); - TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) + TAILQ_FOREACH_SAFE(dr, &V_nd6_defrouter, dr_entry, ndr) if (dr->expire && dr->expire < time_uptime) defrouter_unlink(dr, &drq); ND6_WUNLOCK(); @@ -2608,18 +2609,18 @@ void nd6_defrouter_purge(struct ifnet *ifp) { struct nd_defrouter *dr, *ndr; - struct nd_drhead drq; + struct nd6_drhead drq; TAILQ_INIT(&drq); ND6_WLOCK(); - TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) { + TAILQ_FOREACH_SAFE(dr, &V_nd6_defrouter, dr_entry, ndr) { if (dr->installed) continue; if (dr->ifp == ifp) defrouter_unlink(dr, &drq); } - TAILQ_FOREACH_SAFE(dr, &V_nd_defrouter, dr_entry, ndr) { + TAILQ_FOREACH_SAFE(dr, &V_nd6_defrouter, dr_entry, ndr) { if (!dr->installed) continue; if (dr->ifp == ifp) @@ -2638,12 +2639,12 @@ void nd6_defrouter_flush_all(void) { struct nd_defrouter *dr; - struct nd_drhead drq; + struct nd6_drhead drq; TAILQ_INIT(&drq); ND6_WLOCK(); - while ((dr = TAILQ_FIRST(&V_nd_defrouter)) != NULL) + while ((dr = TAILQ_FIRST(&V_nd6_defrouter)) != NULL) defrouter_unlink(dr, &drq); ND6_WUNLOCK(); @@ -2657,5 +2658,5 @@ void nd6_defrouter_init(void) { - TAILQ_INIT(&V_nd_defrouter); + TAILQ_INIT(&V_nd6_defrouter); } From owner-svn-src-head@freebsd.org Sat Nov 16 00:17:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1FB91B4950; Sat, 16 Nov 2019 00:17:36 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FG4w5z80z425F; Sat, 16 Nov 2019 00:17:36 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D8A320F25; Sat, 16 Nov 2019 00:17:36 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAG0Ha1N091232; Sat, 16 Nov 2019 00:17:36 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAG0HZDL091229; Sat, 16 Nov 2019 00:17:35 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911160017.xAG0HZDL091229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Nov 2019 00:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354758 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354758 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 00:17:37 -0000 Author: bz Date: Sat Nov 16 00:17:35 2019 New Revision: 354758 URL: https://svnweb.freebsd.org/changeset/base/354758 Log: nd6: retire defrouter_select(), use _fib() variant. Burn bridges and replace the last two calls of defrouter_select() with defrouter_select_fib(). That allows us to retire defrouter_select() and make it more clear in the calling code that it applies to all FIBs. Sponsored by: Netflix Modified: head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sat Nov 16 00:02:36 2019 (r354757) +++ head/sys/netinet6/nd6.c Sat Nov 16 00:17:35 2019 (r354758) @@ -1746,7 +1746,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) case SIOCSNDFLUSH_IN6: /* XXX: the ioctl name is confusing... */ /* sync kernel routing table with the default router list */ defrouter_reset(); - defrouter_select(); + defrouter_select_fib(RT_ALL_FIBS); break; case SIOCSPFXFLUSH_IN6: { @@ -1786,7 +1786,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) defrouter_reset(); nd6_defrouter_flush_all(); - defrouter_select(); + defrouter_select_fib(RT_ALL_FIBS); break; } case SIOCGNBRINFO_IN6: Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Sat Nov 16 00:02:36 2019 (r354757) +++ head/sys/netinet6/nd6.h Sat Nov 16 00:17:35 2019 (r354758) @@ -405,7 +405,6 @@ struct nd_defrouter *defrouter_lookup(struct in6_addr struct nd_defrouter *defrouter_lookup_locked(struct in6_addr *, struct ifnet *); void defrouter_reset(void); void defrouter_select_fib(int fibnum); -void defrouter_select(void); void defrouter_rele(struct nd_defrouter *); bool defrouter_remove(struct in6_addr *, struct ifnet *); bool nd6_defrouter_list_empty(void); Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Sat Nov 16 00:02:36 2019 (r354757) +++ head/sys/netinet6/nd6_rtr.c Sat Nov 16 00:17:35 2019 (r354758) @@ -988,16 +988,6 @@ defrouter_select_fib(int fibnum) } /* - * Maintain old KPI for default router selection. - * If unspecified, we can re-select routers for all FIBs. - */ -void -defrouter_select(void) -{ - defrouter_select_fib(RT_ALL_FIBS); -} - -/* * for default router selection * regards router-preference field as a 2-bit signed integer */ From owner-svn-src-head@freebsd.org Sat Nov 16 00:26:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 682241B4C80; Sat, 16 Nov 2019 00:26:44 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FGHS1KXGz4BH5; Sat, 16 Nov 2019 00:26:44 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9319210DE; Sat, 16 Nov 2019 00:26:43 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAG0QheS097169; Sat, 16 Nov 2019 00:26:43 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAG0QhLZ097165; Sat, 16 Nov 2019 00:26:43 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911160026.xAG0QhLZ097165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sat, 16 Nov 2019 00:26:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354759 - in head/sys: amd64/amd64 dev/cpuctl x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys: amd64/amd64 dev/cpuctl x86/include x86/x86 X-SVN-Commit-Revision: 354759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 00:26:44 -0000 Author: scottl Date: Sat Nov 16 00:26:42 2019 New Revision: 354759 URL: https://svnweb.freebsd.org/changeset/base/354759 Log: TSX Asynchronous Abort mitigation for Intel CVE-2019-11135. This CVE has already been announced in FreeBSD SA-19:26.mcu. Mitigation for TAA involves either turning off TSX or turning on the VERW mitigation used for MDS. Some CPUs will also be self-mitigating for TAA and require no software workaround. Control knobs are: machdep.mitigations.taa.enable: 0 - no software mitigation is enabled 1 - attempt to disable TSX 2 - use the VERW mitigation 3 - automatically select the mitigation based on processor features. machdep.mitigations.taa.state: inactive - no mitigation is active/enabled TSX disable - TSX is disabled in the bare metal CPU as well as - any virtualized CPUs VERW - VERW instruction clears CPU buffers not vulnerable - The CPU has identified itself as not being vulnerable Nothing in the base FreeBSD system uses TSX. However, the instructions are straight-forward to add to custom applications and require no kernel support, so the mitigation is provided for users with untrusted applications and tenants. Reviewed by: emaste, imp, kib, scottph Sponsored by: Intel Differential Revision: 22374 Modified: head/sys/amd64/amd64/machdep.c head/sys/dev/cpuctl/cpuctl.c head/sys/x86/include/x86_var.h head/sys/x86/x86/cpu_machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sat Nov 16 00:17:35 2019 (r354758) +++ head/sys/amd64/amd64/machdep.c Sat Nov 16 00:26:42 2019 (r354759) @@ -1779,6 +1779,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TUNABLE_INT_FETCH("machdep.syscall_ret_l1d_flush", &syscall_ret_l1d_flush_mode); TUNABLE_INT_FETCH("hw.mds_disable", &hw_mds_disable); + TUNABLE_INT_FETCH("machdep.mitigations.taa.enable", &x86_taa_enable); finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ Modified: head/sys/dev/cpuctl/cpuctl.c ============================================================================== --- head/sys/dev/cpuctl/cpuctl.c Sat Nov 16 00:17:35 2019 (r354758) +++ head/sys/dev/cpuctl/cpuctl.c Sat Nov 16 00:26:42 2019 (r354759) @@ -546,6 +546,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td pmap_allow_2m_x_ept_recalculate(); #endif hw_mds_recalculate(); + x86_taa_recalculate(); printcpuinfo(); return (0); } Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Sat Nov 16 00:17:35 2019 (r354758) +++ head/sys/x86/include/x86_var.h Sat Nov 16 00:26:42 2019 (r354759) @@ -93,6 +93,7 @@ extern int pti; extern int hw_ibrs_active; extern int hw_mds_disable; extern int hw_ssb_active; +extern int x86_taa_enable; struct pcb; struct thread; @@ -136,6 +137,7 @@ void handle_ibrs_exit(void); void hw_ibrs_recalculate(void); void hw_mds_recalculate(void); void hw_ssb_recalculate(bool all_cpus); +void x86_taa_recalculate(void); void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); void nmi_call_kdb_smp(u_int type, struct trapframe *frame); void nmi_handle_intr(u_int type, struct trapframe *frame); Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Sat Nov 16 00:17:35 2019 (r354758) +++ head/sys/x86/x86/cpu_machdep.c Sat Nov 16 00:26:42 2019 (r354759) @@ -1135,6 +1135,202 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | "Microarchitectural Data Sampling Mitigation " "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); + +/* + * Intel Transactional Memory Asynchronous Abort Mitigation + * CVE-2019-11135 + */ +int x86_taa_enable; +int x86_taa_state; +enum { + TAA_NONE = 0, + TAA_TSX_DISABLE = 1, + TAA_VERW = 2, + TAA_AUTO = 3, + TAA_TAA_NO = 4 +}; + +static void +taa_set_one(bool enable) +{ + uint64_t v; + + v = rdmsr(MSR_IA32_TSX_CTRL); + if (enable) + v |= (uint64_t)(IA32_TSX_CTRL_RTM_DISABLE | + IA32_TSX_CTRL_TSX_CPUID_CLEAR); + else + v &= ~(uint64_t)(IA32_TSX_CTRL_RTM_DISABLE | + IA32_TSX_CTRL_TSX_CPUID_CLEAR); + + wrmsr(MSR_IA32_TSX_CTRL, v); +} + +static void +taa_set(bool enable, bool all) +{ + struct thread *td; + int bound_cpu, i, is_bound; + + if (all) { + td = curthread; + thread_lock(td); + is_bound = sched_is_bound(td); + bound_cpu = td->td_oncpu; + CPU_FOREACH(i) { + sched_bind(td, i); + taa_set_one(enable); + } + if (is_bound) + sched_bind(td, bound_cpu); + else + sched_unbind(td); + thread_unlock(td); + } else + taa_set_one(enable); +} + +void +x86_taa_recalculate(void) +{ + static int taa_saved_mds_disable = 0; + int taa_need = 0, taa_state = 0; + int mds_disable = 0, need_mds_recalc = 0; + + /* Check CPUID.07h.EBX.HLE and RTM for the presence of TSX */ + if ((cpu_stdext_feature & CPUID_STDEXT_HLE) == 0 || + (cpu_stdext_feature & CPUID_STDEXT_RTM) == 0) { + /* TSX is not present */ + x86_taa_state = 0; + return; + } + + /* Check to see what mitigation options the CPU gives us */ + if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TAA_NO) { + /* CPU is not suseptible to TAA */ + taa_need = TAA_NONE; + taa_state = TAA_TAA_NO; + } else if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TSX_CTRL) { + /* + * CPU can turn off TSX. This is the next best option + * if TAA_NO hardware mitigation isn't present + */ + taa_need = TAA_TSX_DISABLE; + } else { + /* No TSX/TAA specific remedies are available. */ + if (x86_taa_enable == TAA_TSX_DISABLE) { + if (bootverbose) + printf("TSX control not available\n"); + return; + } else + taa_need = TAA_VERW; + } + + /* Can we automatically take action, or are we being forced? */ + if (x86_taa_enable == TAA_AUTO) + taa_state = taa_need; + else + taa_state = x86_taa_enable; + + /* No state change, nothing to do */ + if (taa_state == x86_taa_state) { + if (bootverbose) + printf("No TSX change made\n"); + return; + } + + /* Does the MSR need to be turned on or off? */ + if (taa_state == TAA_TSX_DISABLE) + taa_set(true, true); + else if (x86_taa_state == TAA_TSX_DISABLE) + taa_set(false, true); + + /* Does MDS need to be set to turn on VERW? */ + if (taa_state == TAA_VERW) { + taa_saved_mds_disable = hw_mds_disable; + mds_disable = hw_mds_disable = 1; + need_mds_recalc = 1; + } else if (x86_taa_state == TAA_VERW) { + mds_disable = hw_mds_disable = taa_saved_mds_disable; + need_mds_recalc = 1; + } + if (need_mds_recalc) { + hw_mds_recalculate(); + if (mds_disable != hw_mds_disable) { + if (bootverbose) + printf("Cannot change MDS state for TAA\n"); + /* Don't update our state */ + return; + } + } + + x86_taa_state = taa_state; + return; +} + +static void +taa_recalculate_boot(void * arg __unused) +{ + + x86_taa_recalculate(); +} +SYSINIT(taa_recalc, SI_SUB_SMP, SI_ORDER_ANY, taa_recalculate_boot, NULL); + +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, taa, CTLFLAG_RW, 0, + "TSX Asynchronous Abort Mitigation"); + +static int +sysctl_taa_handler(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = x86_taa_enable; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (val < TAA_NONE || val > TAA_AUTO) + return (EINVAL); + x86_taa_enable = val; + x86_taa_recalculate(); + return (0); +} + +SYSCTL_PROC(_machdep_mitigations_taa, OID_AUTO, enable, CTLTYPE_INT | + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, + sysctl_taa_handler, "I", + "TAA Mitigation enablement control " + "(0 - off, 1 - disable TSX, 2 - VERW, 3 - on AUTO"); + +static int +sysctl_taa_state_handler(SYSCTL_HANDLER_ARGS) +{ + const char *state; + + switch (x86_taa_state) { + case TAA_NONE: + state = "inactive"; + break; + case TAA_TSX_DISABLE: + state = "TSX disabled"; + break; + case TAA_VERW: + state = "VERW"; + break; + case TAA_TAA_NO: + state = "Not vulnerable"; + break; + default: + state = "unknown"; + } + + return (SYSCTL_OUT(req, state, strlen(state))); +} + +SYSCTL_PROC(_machdep_mitigations_taa, OID_AUTO, state, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_taa_state_handler, "A", + "TAA Mitigation state"); + /* * Enable and restore kernel text write permissions. * Callers must ensure that disable_wp()/restore_wp() are executed From owner-svn-src-head@freebsd.org Sat Nov 16 01:25:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B4F61B5FD1; Sat, 16 Nov 2019 01:25:52 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FHbg6xGtz3JgG; Sat, 16 Nov 2019 01:25:51 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2E3821BA5; Sat, 16 Nov 2019 01:25:51 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAG1Pp6A032535; Sat, 16 Nov 2019 01:25:51 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAG1Pp9K032534; Sat, 16 Nov 2019 01:25:51 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911160125.xAG1Pp9K032534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sat, 16 Nov 2019 01:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354765 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 354765 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 01:25:52 -0000 Author: mhorne Date: Sat Nov 16 01:25:51 2019 New Revision: 354765 URL: https://svnweb.freebsd.org/changeset/base/354765 Log: RISC-V: busdma_bounce: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes RISC-V inherited this code from arm64, so implement the fix from r354712. See the revision for the full description. Submitted by: kevans (arm64 version) Modified: head/sys/riscv/riscv/busdma_bounce.c Modified: head/sys/riscv/riscv/busdma_bounce.c ============================================================================== --- head/sys/riscv/riscv/busdma_bounce.c Sat Nov 16 00:52:04 2019 (r354764) +++ head/sys/riscv/riscv/busdma_bounce.c Sat Nov 16 01:25:51 2019 (r354765) @@ -214,7 +214,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si if (ptoa(bz->total_bpages) < maxsize) { int pages; - pages = atop(maxsize) - bz->total_bpages; + pages = atop(round_page(maxsize)) - bz->total_bpages; /* Add pages to our bounce pool */ if (alloc_bounce_pages(newtag, pages) < pages) From owner-svn-src-head@freebsd.org Sat Nov 16 08:16:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5EA891BEB22; Sat, 16 Nov 2019 08:16:51 +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 47FSjt75HPz3QHK; Sat, 16 Nov 2019 08:16:50 +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 D6C3326877; Sat, 16 Nov 2019 08:16:50 +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 xAG8GooO075455; Sat, 16 Nov 2019 08:16:50 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAG8GofA075454; Sat, 16 Nov 2019 08:16:50 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911160816.xAG8GofA075454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 16 Nov 2019 08:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354766 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 354766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 08:16:51 -0000 Author: tsoome Date: Sat Nov 16 08:16:50 2019 New Revision: 354766 URL: https://svnweb.freebsd.org/changeset/base/354766 Log: loader: remove unused variable from efipart.c Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Sat Nov 16 01:25:51 2019 (r354765) +++ head/stand/efi/libefi/efipart.c Sat Nov 16 08:16:50 2019 (r354766) @@ -554,7 +554,7 @@ efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH static void efipart_hdinfo_add(pdinfo_t *hd, EFI_DEVICE_PATH *node) { - pdinfo_t *pd, *last; + pdinfo_t *last; if (efipart_hdinfo_add_node(hd, node)) return; From owner-svn-src-head@freebsd.org Sat Nov 16 10:46:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF1D01C1B30; Sat, 16 Nov 2019 10:46:14 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47FX2F0gHYz479J; Sat, 16 Nov 2019 10:46:12 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xAGAk9lG056746; Sat, 16 Nov 2019 02:46:09 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xAGAk96h056745; Sat, 16 Nov 2019 02:46:09 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201911161046.xAGAk96h056745@gndrsh.dnsmgr.net> Subject: Re: svn commit: r354714 - in head/sys: arm64/arm64 arm64/conf arm64/include conf In-Reply-To: <9e8c5e79c48f3f751723e96e5b3fb1b03a51c9c3.camel@freebsd.org> To: Ian Lepore Date: Sat, 16 Nov 2019 02:46:09 -0800 (PST) CC: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47FX2F0gHYz479J X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [0.52 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.59)[-0.590,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_SPAM_MEDIUM(0.17)[0.171,0]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 10:46:15 -0000 > On Thu, 2019-11-14 at 21:58 +0000, Justin Hibbits wrote: > > Author: jhibbits > > Date: Thu Nov 14 21:58:40 2019 > > New Revision: 354714 > > URL: https://svnweb.freebsd.org/changeset/base/354714 > > > > Log: > > Boot arm64 kernel using booti command from U-boot. > > > > [...] > > > > Added: head/sys/arm64/arm64/machdep_boot.c > > ===================================================================== > > ========= > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/arm64/arm64/machdep_boot.c Thu Nov 14 21:58:40 > > 2019 (r354714) > > @@ -0,0 +1,330 @@ > > +/*- > > + * Copyright (c) 2019 Juniper Networks, Inc > > + * Copyright (c) 2004 Olivier Houchard > > + * Copyright (c) 1994-1998 Mark Brinicombe. > > + * Copyright (c) 1994 Brini. > > + * All rights reserved. > > + * This copyright as formed is ambiguous as to who is asserting "All rights reserved", which is actually desired to not be asserted at all on new code. But given some of the dates on the above it is probalby important to preserve the assertion until the author can asked it to be removed. Proposed form: * Copyright (c) 2019 Juniper Networks, Inc All rights reserved. * Copyright (c) 2004 Olivier Houchard All rights reserved. * Copyright (c) 1994-1998 Mark Brinicombe. All rights reserved. * Copyright (c) 1994 Brini. All rights reserved. > > > > I think this copyright list should be pared down to just Olivier > (maybe?) and Juniper. The Brini lines are from when this code was part > of machdep.c that was imported from netbsd in the 2004 timeframe. That > import did not include any of the code that got copied into this new > arm64 file. The code to handle embedded dtb and parsing bootargs in > various ABI formats was all added much more recently, 2012-2014 time > frame. > > Warner should probably add himself to the copyrights though, I'm pretty > sure he's the one who wrote the various flavors of bootargs parsers. > > -- Ian > > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Nov 16 10:51:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AEAB51C1E43; Sat, 16 Nov 2019 10:51:15 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47FX8223Q5z4G1x; Sat, 16 Nov 2019 10:51:13 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xAGApCtW056768; Sat, 16 Nov 2019 02:51:12 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xAGApCnH056767; Sat, 16 Nov 2019 02:51:12 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201911161051.xAGApCnH056767@gndrsh.dnsmgr.net> Subject: Re: svn commit: r354708 - head/sys/netinet/cc In-Reply-To: <0a9e49e9-b81a-3367-2d7d-6d748e83f36d@FreeBSD.org> To: koobs@freebsd.org Date: Sat, 16 Nov 2019 02:51:12 -0800 (PST) CC: Michael Tuexen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47FX8223Q5z4G1x X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [0.02 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.13)[-0.129,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.79)[-0.791,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 10:51:15 -0000 > On 15/11/2019 3:28 am, Michael Tuexen wrote: > > Author: tuexen > > Date: Thu Nov 14 16:28:02 2019 > > New Revision: 354708 > > URL: https://svnweb.freebsd.org/changeset/base/354708 > > > > Log: > > For idle TCP sessions using the CUBIC congestio control, reset ssthresh > > to the higher of the previous ssthresh or 3/4 of the prior cwnd. > > > > Submitted by: Richard Scheffenegger > > Reviewed by: Cheng Cui > > Differential Revision: https://reviews.freebsd.org/D18982 > > > > Modified: > > head/sys/netinet/cc/cc_cubic.c > > Are stable/12,11 affected by this too? I am sitting here with Richard at IETF and the answer is yes, this is an oversight since the code came into FreeBSD, this commit should be merged to back to 11 and 12. > > Modified: head/sys/netinet/cc/cc_cubic.c > > ============================================================================== > > --- head/sys/netinet/cc/cc_cubic.c Thu Nov 14 15:10:01 2019 (r354707) > > +++ head/sys/netinet/cc/cc_cubic.c Thu Nov 14 16:28:02 2019 (r354708) > > @@ -78,6 +78,7 @@ static int cubic_mod_init(void); > > static void cubic_post_recovery(struct cc_var *ccv); > > static void cubic_record_rtt(struct cc_var *ccv); > > static void cubic_ssthresh_update(struct cc_var *ccv); > > +static void cubic_after_idle(struct cc_var *ccv); > > > > struct cubic { > > /* Cubic K in fixed point form with CUBIC_SHIFT worth of precision. */ > > @@ -112,6 +113,7 @@ struct cc_algo cubic_cc_algo = { > > .conn_init = cubic_conn_init, > > .mod_init = cubic_mod_init, > > .post_recovery = cubic_post_recovery, > > + .after_idle = cubic_after_idle, > > }; > > > > static void > > @@ -192,7 +194,24 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) > > } > > } > > > > +/* > > + * This is a Cubic specific implementation of after_idle. > > + * - Reset cwnd by calling New Reno implementation of after_idle. > > + * - Reset t_last_cong. > > + */ > > static void > > +cubic_after_idle(struct cc_var *ccv) > > +{ > > + struct cubic *cubic_data; > > + > > + cubic_data = ccv->cc_data; > > + > > + newreno_cc_algo.after_idle(ccv); > > + cubic_data->t_last_cong = ticks; > > +} > > + > > + > > +static void > > cubic_cb_destroy(struct cc_var *ccv) > > { > > free(ccv->cc_data, M_CUBIC); > > @@ -287,9 +306,6 @@ cubic_conn_init(struct cc_var *ccv) > > static int > > cubic_mod_init(void) > > { > > - > > - cubic_cc_algo.after_idle = newreno_cc_algo.after_idle; > > - > > return (0); > > } > > > > _______________________________________________ > > svn-src-head@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/svn-src-head > > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Nov 16 11:10:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00FBC1C25C4; Sat, 16 Nov 2019 11:10:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FXYs67kFz3KjM; Sat, 16 Nov 2019 11:10:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6FE6767; Sat, 16 Nov 2019 11:10:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGBA9ei077022; Sat, 16 Nov 2019 11:10:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGBA9EL077021; Sat, 16 Nov 2019 11:10:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201911161110.xAGBA9EL077021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 16 Nov 2019 11:10:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354771 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 354771 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 11:10:10 -0000 Author: tuexen Date: Sat Nov 16 11:10:09 2019 New Revision: 354771 URL: https://svnweb.freebsd.org/changeset/base/354771 Log: Revert https://svnweb.freebsd.org/changeset/base/354708 I used the wrong Differential Revision, so back it out and do it right in a follow-up commit. Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Sat Nov 16 11:01:56 2019 (r354770) +++ head/sys/netinet/cc/cc_cubic.c Sat Nov 16 11:10:09 2019 (r354771) @@ -78,7 +78,6 @@ static int cubic_mod_init(void); static void cubic_post_recovery(struct cc_var *ccv); static void cubic_record_rtt(struct cc_var *ccv); static void cubic_ssthresh_update(struct cc_var *ccv); -static void cubic_after_idle(struct cc_var *ccv); struct cubic { /* Cubic K in fixed point form with CUBIC_SHIFT worth of precision. */ @@ -113,7 +112,6 @@ struct cc_algo cubic_cc_algo = { .conn_init = cubic_conn_init, .mod_init = cubic_mod_init, .post_recovery = cubic_post_recovery, - .after_idle = cubic_after_idle, }; static void @@ -194,24 +192,7 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) } } -/* - * This is a Cubic specific implementation of after_idle. - * - Reset cwnd by calling New Reno implementation of after_idle. - * - Reset t_last_cong. - */ static void -cubic_after_idle(struct cc_var *ccv) -{ - struct cubic *cubic_data; - - cubic_data = ccv->cc_data; - - newreno_cc_algo.after_idle(ccv); - cubic_data->t_last_cong = ticks; -} - - -static void cubic_cb_destroy(struct cc_var *ccv) { free(ccv->cc_data, M_CUBIC); @@ -306,6 +287,9 @@ cubic_conn_init(struct cc_var *ccv) static int cubic_mod_init(void) { + + cubic_cc_algo.after_idle = newreno_cc_algo.after_idle; + return (0); } From owner-svn-src-head@freebsd.org Sat Nov 16 11:37:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1714A1C2BCE; Sat, 16 Nov 2019 11:37:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FY9L4gPyz3Bw1; Sat, 16 Nov 2019 11:37:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 844C4C97; Sat, 16 Nov 2019 11:37:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGBbQ9I094554; Sat, 16 Nov 2019 11:37:26 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGBbQ2G094553; Sat, 16 Nov 2019 11:37:26 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201911161137.xAGBbQ2G094553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 16 Nov 2019 11:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354772 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 354772 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 11:37:27 -0000 Author: tuexen Date: Sat Nov 16 11:37:26 2019 New Revision: 354772 URL: https://svnweb.freebsd.org/changeset/base/354772 Log: Implement a tCP CUBIC-specific after idle reaction. This patch addresses a very common case of frequent application stalls, where TCP runs idle and looses the state of the network. Submitted by: Richard Scheffenegger Reviewed by: Cheng Cui Differential Revision: https://reviews.freebsd.org/D18954 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Sat Nov 16 11:10:09 2019 (r354771) +++ head/sys/netinet/cc/cc_cubic.c Sat Nov 16 11:37:26 2019 (r354772) @@ -78,6 +78,7 @@ static int cubic_mod_init(void); static void cubic_post_recovery(struct cc_var *ccv); static void cubic_record_rtt(struct cc_var *ccv); static void cubic_ssthresh_update(struct cc_var *ccv); +static void cubic_after_idle(struct cc_var *ccv); struct cubic { /* Cubic K in fixed point form with CUBIC_SHIFT worth of precision. */ @@ -112,6 +113,7 @@ struct cc_algo cubic_cc_algo = { .conn_init = cubic_conn_init, .mod_init = cubic_mod_init, .post_recovery = cubic_post_recovery, + .after_idle = cubic_after_idle, }; static void @@ -192,7 +194,24 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) } } +/* + * This is a Cubic specific implementation of after_idle. + * - Reset cwnd by calling New Reno implementation of after_idle. + * - Reset t_last_cong. + */ static void +cubic_after_idle(struct cc_var *ccv) +{ + struct cubic *cubic_data; + + cubic_data = ccv->cc_data; + + newreno_cc_algo.after_idle(ccv); + cubic_data->t_last_cong = ticks; +} + + +static void cubic_cb_destroy(struct cc_var *ccv) { free(ccv->cc_data, M_CUBIC); @@ -287,9 +306,6 @@ cubic_conn_init(struct cc_var *ccv) static int cubic_mod_init(void) { - - cubic_cc_algo.after_idle = newreno_cc_algo.after_idle; - return (0); } From owner-svn-src-head@freebsd.org Sat Nov 16 11:57:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D6991C31C5; Sat, 16 Nov 2019 11:57:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FYc9030wz43W0; Sat, 16 Nov 2019 11:57:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6F51106A; Sat, 16 Nov 2019 11:57:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGBvCCx006097; Sat, 16 Nov 2019 11:57:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGBvCRm006096; Sat, 16 Nov 2019 11:57:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201911161157.xAGBvCRm006096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 16 Nov 2019 11:57:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354773 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 354773 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 11:57:13 -0000 Author: tuexen Date: Sat Nov 16 11:57:12 2019 New Revision: 354773 URL: https://svnweb.freebsd.org/changeset/base/354773 Log: Improve TCP CUBIC specific after idle reaction. The adjustments are inspired by the Linux stack, which has had a functionally equivalent implementation for more than a decade now. Submitted by: Richard Scheffenegger Reviewed by: Cheng Cui Differential Revision: https://reviews.freebsd.org/D18982 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Sat Nov 16 11:37:26 2019 (r354772) +++ head/sys/netinet/cc/cc_cubic.c Sat Nov 16 11:57:12 2019 (r354773) @@ -190,6 +190,8 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) if (cubic_data->num_cong_events == 0 && cubic_data->max_cwnd < CCV(ccv, snd_cwnd)) cubic_data->max_cwnd = CCV(ccv, snd_cwnd); + cubic_data->K = cubic_k(cubic_data->max_cwnd / + CCV(ccv, t_maxseg)); } } } @@ -205,6 +207,9 @@ cubic_after_idle(struct cc_var *ccv) struct cubic *cubic_data; cubic_data = ccv->cc_data; + + cubic_data->max_cwnd = ulmax(cubic_data->max_cwnd, CCV(ccv, snd_cwnd)); + cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg)); newreno_cc_algo.after_idle(ccv); cubic_data->t_last_cong = ticks; From owner-svn-src-head@freebsd.org Sat Nov 16 12:00:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 128F31C3609; Sat, 16 Nov 2019 12:00:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FYgq5Y9hz46dQ; Sat, 16 Nov 2019 12:00:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58CD2108D; Sat, 16 Nov 2019 12:00:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGC0NfQ006342; Sat, 16 Nov 2019 12:00:23 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGC0NqW006340; Sat, 16 Nov 2019 12:00:23 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201911161200.xAGC0NqW006340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 16 Nov 2019 12:00:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354774 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 354774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 12:00:24 -0000 Author: tuexen Date: Sat Nov 16 12:00:22 2019 New Revision: 354774 URL: https://svnweb.freebsd.org/changeset/base/354774 Log: Add boundary and overflow checks to the formulas used in the TCP CUBIC congestion control module. Submitted by: Richard Scheffenegger Reviewed by: rgrimes@ Differential Revision: https://reviews.freebsd.org/D19118 Modified: head/sys/netinet/cc/cc_cubic.c head/sys/netinet/cc/cc_cubic.h Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Sat Nov 16 11:57:12 2019 (r354773) +++ head/sys/netinet/cc/cc_cubic.c Sat Nov 16 12:00:22 2019 (r354774) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -140,7 +141,14 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) cubic_data->min_rtt_ticks == TCPTV_SRTTBASE) newreno_cc_algo.ack_received(ccv, type); else { - ticks_since_cong = ticks - cubic_data->t_last_cong; + if ((ticks_since_cong = + ticks - cubic_data->t_last_cong) < 0) { + /* + * dragging t_last_cong along + */ + ticks_since_cong = INT_MAX; + cubic_data->t_last_cong = ticks - INT_MAX; + } /* * The mean RTT is used to best reflect the equations in @@ -159,12 +167,14 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) ccv->flags &= ~CCF_ABC_SENTAWND; - if (w_cubic_next < w_tf) + if (w_cubic_next < w_tf) { /* * TCP-friendly region, follow tf * cwnd growth. */ - CCV(ccv, snd_cwnd) = w_tf; + if (CCV(ccv, snd_cwnd) < w_tf) + CCV(ccv, snd_cwnd) = ulmin(w_tf, INT_MAX); + } else if (CCV(ccv, snd_cwnd) < w_cubic_next) { /* @@ -172,12 +182,14 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) * cwnd growth. */ if (V_tcp_do_rfc3465) - CCV(ccv, snd_cwnd) = w_cubic_next; + CCV(ccv, snd_cwnd) = ulmin(w_cubic_next, + INT_MAX); else - CCV(ccv, snd_cwnd) += ((w_cubic_next - + CCV(ccv, snd_cwnd) += ulmax(1, + ((ulmin(w_cubic_next, INT_MAX) - CCV(ccv, snd_cwnd)) * CCV(ccv, t_maxseg)) / - CCV(ccv, snd_cwnd); + CCV(ccv, snd_cwnd)); } /* Modified: head/sys/netinet/cc/cc_cubic.h ============================================================================== --- head/sys/netinet/cc/cc_cubic.h Sat Nov 16 11:57:12 2019 (r354773) +++ head/sys/netinet/cc/cc_cubic.h Sat Nov 16 12:00:22 2019 (r354774) @@ -41,6 +41,8 @@ #ifndef _NETINET_CC_CUBIC_H_ #define _NETINET_CC_CUBIC_H_ +#include + /* Number of bits of precision for fixed point math calcs. */ #define CUBIC_SHIFT 8 @@ -70,6 +72,12 @@ /* Don't trust s_rtt until this many rtt samples have been taken. */ #define CUBIC_MIN_RTT_SAMPLES 8 +/* + * (2^21)^3 is long max. Dividing (2^63) by Cubic_C_factor + * and taking cube-root yields 448845 as the effective useful limit + */ +#define CUBED_ROOT_MAX_ULONG 448845 + /* Userland only bits. */ #ifndef _KERNEL @@ -172,8 +180,13 @@ cubic_cwnd(int ticks_since_cong, unsigned long wmax, u /* K is in fixed point form with CUBIC_SHIFT worth of precision. */ /* t - K, with CUBIC_SHIFT worth of precision. */ - cwnd = ((int64_t)(ticks_since_cong << CUBIC_SHIFT) - (K * hz)) / hz; + cwnd = (((int64_t)ticks_since_cong << CUBIC_SHIFT) - (K * hz)) / hz; + if (cwnd > CUBED_ROOT_MAX_ULONG) + return INT_MAX; + if (cwnd < -CUBED_ROOT_MAX_ULONG) + return 0; + /* (t - K)^3, with CUBIC_SHIFT^3 worth of precision. */ cwnd *= (cwnd * cwnd); @@ -183,9 +196,13 @@ cubic_cwnd(int ticks_since_cong, unsigned long wmax, u * CUBIC_SHIFT included in the value. 3 from the cubing of cwnd above, * and an extra from multiplying through by CUBIC_C_FACTOR. */ - cwnd = ((cwnd * CUBIC_C_FACTOR * smss) >> CUBIC_SHIFT_4) + wmax; - return ((unsigned long)cwnd); + cwnd = ((cwnd * CUBIC_C_FACTOR) >> CUBIC_SHIFT_4) * smss + wmax; + + /* + * for negative cwnd, limiting to zero as lower bound + */ + return (lmax(0,cwnd)); } /* @@ -223,8 +240,10 @@ tf_cwnd(int ticks_since_cong, int rtt_ticks, unsigned { /* Equation 4 of I-D. */ - return (((wmax * CUBIC_BETA) + (((THREE_X_PT3 * ticks_since_cong * - smss) << CUBIC_SHIFT) / TWO_SUB_PT3 / rtt_ticks)) >> CUBIC_SHIFT); + return (((wmax * CUBIC_BETA) + + (((THREE_X_PT3 * (unsigned long)ticks_since_cong * + (unsigned long)smss) << CUBIC_SHIFT) / (TWO_SUB_PT3 * rtt_ticks))) + >> CUBIC_SHIFT); } #endif /* _NETINET_CC_CUBIC_H_ */ From owner-svn-src-head@freebsd.org Sat Nov 16 12:12:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F3021C3F46; Sat, 16 Nov 2019 12:12:51 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FYyB5RqYz4Fl5; Sat, 16 Nov 2019 12:12:50 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from mb.fritz.box (ip4d16e760.dynamic.kabel-deutschland.de [77.22.231.96]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 36C32721E282F; Sat, 16 Nov 2019 13:12:46 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Subject: Re: svn commit: r354708 - head/sys/netinet/cc From: Michael Tuexen In-Reply-To: <201911161051.xAGApCnH056767@gndrsh.dnsmgr.net> Date: Sat, 16 Nov 2019 13:12:43 +0100 Cc: koobs@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <212A29FD-686A-4ED1-93B0-B7C2453F9812@freebsd.org> References: <201911161051.xAGApCnH056767@gndrsh.dnsmgr.net> To: rgrimes@freebsd.org X-Mailer: Apple Mail (2.3601.0.10) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 47FYyB5RqYz4Fl5 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.80 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.80)[-0.799,0]; ASN(0.00)[asn:680, ipnet:193.174.0.0/15, country:DE]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 12:12:51 -0000 > On 16. Nov 2019, at 11:51, Rodney W. Grimes = wrote: >=20 >> On 15/11/2019 3:28 am, Michael Tuexen wrote: >>> Author: tuexen >>> Date: Thu Nov 14 16:28:02 2019 >>> New Revision: 354708 >>> URL: https://svnweb.freebsd.org/changeset/base/354708 >>>=20 >>> Log: >>> For idle TCP sessions using the CUBIC congestio control, reset = ssthresh >>> to the higher of the previous ssthresh or 3/4 of the prior cwnd. >>>=20 >>> Submitted by: Richard Scheffenegger >>> Reviewed by: Cheng Cui >>> Differential Revision: https://reviews.freebsd.org/D18982 >>>=20 >>> Modified: >>> head/sys/netinet/cc/cc_cubic.c >>=20 >> Are stable/12,11 affected by this too? >=20 > I am sitting here with Richard at IETF and the answer is yes, > this is an oversight since the code came into FreeBSD, > this commit should be merged to back to 11 and 12. Hi Rod, do you suggest to MFC * https://svnweb.freebsd.org/changeset/base/354772 * https://svnweb.freebsd.org/changeset/base/354773 * https://svnweb.freebsd.org/changeset/base/354774 At the last transport telco we decided that the corresponding review are open for too long without an explicit approval, but the changes should go into the tree. So we agree that I commit it to head without a plan for MFCing. If you say the changes are good and they should be MFCed, I'll MFC them. Best regards Michael >=20 >>> Modified: head/sys/netinet/cc/cc_cubic.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/netinet/cc/cc_cubic.c Thu Nov 14 15:10:01 2019 = (r354707) >>> +++ head/sys/netinet/cc/cc_cubic.c Thu Nov 14 16:28:02 2019 = (r354708) >>> @@ -78,6 +78,7 @@ static int cubic_mod_init(void); >>> static void cubic_post_recovery(struct cc_var *ccv); >>> static void cubic_record_rtt(struct cc_var *ccv); >>> static void cubic_ssthresh_update(struct cc_var *ccv); >>> +static void cubic_after_idle(struct cc_var *ccv); >>>=20 >>> struct cubic { >>> /* Cubic K in fixed point form with CUBIC_SHIFT worth of = precision. */ >>> @@ -112,6 +113,7 @@ struct cc_algo cubic_cc_algo =3D { >>> .conn_init =3D cubic_conn_init, >>> .mod_init =3D cubic_mod_init, >>> .post_recovery =3D cubic_post_recovery, >>> + .after_idle =3D cubic_after_idle, >>> }; >>>=20 >>> static void >>> @@ -192,7 +194,24 @@ cubic_ack_received(struct cc_var *ccv, uint16_t = type) >>> } >>> } >>>=20 >>> +/* >>> + * This is a Cubic specific implementation of after_idle. >>> + * - Reset cwnd by calling New Reno implementation of after_idle. >>> + * - Reset t_last_cong. >>> + */ >>> static void >>> +cubic_after_idle(struct cc_var *ccv) >>> +{ >>> + struct cubic *cubic_data; >>> + >>> + cubic_data =3D ccv->cc_data; >>> + >>> + newreno_cc_algo.after_idle(ccv); >>> + cubic_data->t_last_cong =3D ticks; >>> +} >>> + >>> + >>> +static void >>> cubic_cb_destroy(struct cc_var *ccv) >>> { >>> free(ccv->cc_data, M_CUBIC); >>> @@ -287,9 +306,6 @@ cubic_conn_init(struct cc_var *ccv) >>> static int >>> cubic_mod_init(void) >>> { >>> - >>> - cubic_cc_algo.after_idle =3D newreno_cc_algo.after_idle; >>> - >>> return (0); >>> } >>>=20 >>> _______________________________________________ >>> svn-src-head@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/svn-src-head >>> To unsubscribe, send any mail to = "svn-src-head-unsubscribe@freebsd.org" >=20 > --=20 > Rod Grimes = rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Nov 16 12:33:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D5BC1C4841; Sat, 16 Nov 2019 12:33:16 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47FZPl6X7Rz3Kv9; Sat, 16 Nov 2019 12:33:15 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xAGCXCDl057444; Sat, 16 Nov 2019 04:33:12 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xAGCXCNt057443; Sat, 16 Nov 2019 04:33:12 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201911161233.xAGCXCNt057443@gndrsh.dnsmgr.net> Subject: Re: svn commit: r354708 - head/sys/netinet/cc In-Reply-To: <212A29FD-686A-4ED1-93B0-B7C2453F9812@freebsd.org> To: Michael Tuexen Date: Sat, 16 Nov 2019 04:33:12 -0800 (PST) CC: rgrimes@freebsd.org, koobs@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47FZPl6X7Rz3Kv9 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.97 / 15.00]; NEURAL_HAM_MEDIUM(-0.97)[-0.972,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 12:33:16 -0000 > > On 16. Nov 2019, at 11:51, Rodney W. Grimes wrote: > > > >> On 15/11/2019 3:28 am, Michael Tuexen wrote: > >>> Author: tuexen > >>> Date: Thu Nov 14 16:28:02 2019 > >>> New Revision: 354708 > >>> URL: https://svnweb.freebsd.org/changeset/base/354708 > >>> > >>> Log: > >>> For idle TCP sessions using the CUBIC congestio control, reset ssthresh > >>> to the higher of the previous ssthresh or 3/4 of the prior cwnd. > >>> > >>> Submitted by: Richard Scheffenegger > >>> Reviewed by: Cheng Cui > >>> Differential Revision: https://reviews.freebsd.org/D18982 > >>> > >>> Modified: > >>> head/sys/netinet/cc/cc_cubic.c > >> > >> Are stable/12,11 affected by this too? > > > > I am sitting here with Richard at IETF and the answer is yes, > > this is an oversight since the code came into FreeBSD, > > this commit should be merged to back to 11 and 12. > Hi Rod, > > do you suggest to MFC > > * https://svnweb.freebsd.org/changeset/base/354772 > * https://svnweb.freebsd.org/changeset/base/354773 > * https://svnweb.freebsd.org/changeset/base/354774 > > At the last transport telco we decided that the corresponding review are > open for too long without an explicit approval, but the changes should > go into the tree. So we agree that I commit it to head without a plan > for MFCing. > > If you say the changes are good and they should be MFCed, I'll MFC them. Lets bake them in head for 30 days or 4 weeks in the hopes that they get some testing. Given that these issues have been here for so long, and no one has reported any of these problems leads me to believe the code is simply unused and if we broke something it would not get found no mater how long we waited. > > Best regards > Michael > > > >>> Modified: head/sys/netinet/cc/cc_cubic.c > >>> ============================================================================== > >>> --- head/sys/netinet/cc/cc_cubic.c Thu Nov 14 15:10:01 2019 (r354707) > >>> +++ head/sys/netinet/cc/cc_cubic.c Thu Nov 14 16:28:02 2019 (r354708) > >>> @@ -78,6 +78,7 @@ static int cubic_mod_init(void); > >>> static void cubic_post_recovery(struct cc_var *ccv); > >>> static void cubic_record_rtt(struct cc_var *ccv); > >>> static void cubic_ssthresh_update(struct cc_var *ccv); > >>> +static void cubic_after_idle(struct cc_var *ccv); > >>> > >>> struct cubic { > >>> /* Cubic K in fixed point form with CUBIC_SHIFT worth of precision. */ > >>> @@ -112,6 +113,7 @@ struct cc_algo cubic_cc_algo = { > >>> .conn_init = cubic_conn_init, > >>> .mod_init = cubic_mod_init, > >>> .post_recovery = cubic_post_recovery, > >>> + .after_idle = cubic_after_idle, > >>> }; > >>> > >>> static void > >>> @@ -192,7 +194,24 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) > >>> } > >>> } > >>> > >>> +/* > >>> + * This is a Cubic specific implementation of after_idle. > >>> + * - Reset cwnd by calling New Reno implementation of after_idle. > >>> + * - Reset t_last_cong. > >>> + */ > >>> static void > >>> +cubic_after_idle(struct cc_var *ccv) > >>> +{ > >>> + struct cubic *cubic_data; > >>> + > >>> + cubic_data = ccv->cc_data; > >>> + > >>> + newreno_cc_algo.after_idle(ccv); > >>> + cubic_data->t_last_cong = ticks; > >>> +} > >>> + > >>> + > >>> +static void > >>> cubic_cb_destroy(struct cc_var *ccv) > >>> { > >>> free(ccv->cc_data, M_CUBIC); > >>> @@ -287,9 +306,6 @@ cubic_conn_init(struct cc_var *ccv) > >>> static int > >>> cubic_mod_init(void) > >>> { > >>> - > >>> - cubic_cc_algo.after_idle = newreno_cc_algo.after_idle; > >>> - > >>> return (0); > >>> } > >>> > >>> _______________________________________________ > >>> svn-src-head@freebsd.org mailing list > >>> https://lists.freebsd.org/mailman/listinfo/svn-src-head > >>> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > > > > -- > > Rod Grimes rgrimes@freebsd.org > > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Nov 16 13:56:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 245101C5F4B; Sat, 16 Nov 2019 13:56:23 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FcFf26PNz400S; Sat, 16 Nov 2019 13:56:22 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from mb.fritz.box (ip4d16e760.dynamic.kabel-deutschland.de [77.22.231.96]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 6BB47721E282F; Sat, 16 Nov 2019 14:56:17 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Subject: Re: svn commit: r354708 - head/sys/netinet/cc From: Michael Tuexen In-Reply-To: <201911161233.xAGCXCNt057443@gndrsh.dnsmgr.net> Date: Sat, 16 Nov 2019 14:56:14 +0100 Cc: koobs@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <2CA1817F-A637-4E9D-8E84-505A00EB127D@freebsd.org> References: <201911161233.xAGCXCNt057443@gndrsh.dnsmgr.net> To: rgrimes@freebsd.org X-Mailer: Apple Mail (2.3601.0.10) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 47FcFf26PNz400S X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.80 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.80)[-0.799,0]; ASN(0.00)[asn:680, ipnet:2001:638::/32, country:DE]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 13:56:23 -0000 > On 16. Nov 2019, at 13:33, Rodney W. Grimes = wrote: >=20 >>> On 16. Nov 2019, at 11:51, Rodney W. Grimes = wrote: >>>=20 >>>> On 15/11/2019 3:28 am, Michael Tuexen wrote: >>>>> Author: tuexen >>>>> Date: Thu Nov 14 16:28:02 2019 >>>>> New Revision: 354708 >>>>> URL: https://svnweb.freebsd.org/changeset/base/354708 >>>>>=20 >>>>> Log: >>>>> For idle TCP sessions using the CUBIC congestio control, reset = ssthresh >>>>> to the higher of the previous ssthresh or 3/4 of the prior cwnd. >>>>>=20 >>>>> Submitted by: Richard Scheffenegger >>>>> Reviewed by: Cheng Cui >>>>> Differential Revision: https://reviews.freebsd.org/D18982 >>>>>=20 >>>>> Modified: >>>>> head/sys/netinet/cc/cc_cubic.c >>>>=20 >>>> Are stable/12,11 affected by this too? >>>=20 >>> I am sitting here with Richard at IETF and the answer is yes, >>> this is an oversight since the code came into FreeBSD, >>> this commit should be merged to back to 11 and 12. >> Hi Rod, >>=20 >> do you suggest to MFC >>=20 >> * https://svnweb.freebsd.org/changeset/base/354772 >> * https://svnweb.freebsd.org/changeset/base/354773 >> * https://svnweb.freebsd.org/changeset/base/354774 >>=20 >> At the last transport telco we decided that the corresponding review = are >> open for too long without an explicit approval, but the changes = should >> go into the tree. So we agree that I commit it to head without a plan >> for MFCing. >>=20 >> If you say the changes are good and they should be MFCed, I'll MFC = them. >=20 > Lets bake them in head for 30 days or 4 weeks in the hopes that they = get some testing. OK. Best regards Michael > Given that these issues have been here for so long, and no one has = reported > any of these problems leads me to believe the code is simply unused = and > if we broke something it would not get found no mater how long we = waited. >=20 >>=20 >> Best regards >> Michael >>>=20 >>>>> Modified: head/sys/netinet/cc/cc_cubic.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/netinet/cc/cc_cubic.c Thu Nov 14 15:10:01 2019 = (r354707) >>>>> +++ head/sys/netinet/cc/cc_cubic.c Thu Nov 14 16:28:02 2019 = (r354708) >>>>> @@ -78,6 +78,7 @@ static int cubic_mod_init(void); >>>>> static void cubic_post_recovery(struct cc_var *ccv); >>>>> static void cubic_record_rtt(struct cc_var *ccv); >>>>> static void cubic_ssthresh_update(struct cc_var *ccv); >>>>> +static void cubic_after_idle(struct cc_var *ccv); >>>>>=20 >>>>> struct cubic { >>>>> /* Cubic K in fixed point form with CUBIC_SHIFT worth of = precision. */ >>>>> @@ -112,6 +113,7 @@ struct cc_algo cubic_cc_algo =3D { >>>>> .conn_init =3D cubic_conn_init, >>>>> .mod_init =3D cubic_mod_init, >>>>> .post_recovery =3D cubic_post_recovery, >>>>> + .after_idle =3D cubic_after_idle, >>>>> }; >>>>>=20 >>>>> static void >>>>> @@ -192,7 +194,24 @@ cubic_ack_received(struct cc_var *ccv, = uint16_t type) >>>>> } >>>>> } >>>>>=20 >>>>> +/* >>>>> + * This is a Cubic specific implementation of after_idle. >>>>> + * - Reset cwnd by calling New Reno implementation of = after_idle. >>>>> + * - Reset t_last_cong. >>>>> + */ >>>>> static void >>>>> +cubic_after_idle(struct cc_var *ccv) >>>>> +{ >>>>> + struct cubic *cubic_data; >>>>> + >>>>> + cubic_data =3D ccv->cc_data; >>>>> + >>>>> + newreno_cc_algo.after_idle(ccv); >>>>> + cubic_data->t_last_cong =3D ticks; >>>>> +} >>>>> + >>>>> + >>>>> +static void >>>>> cubic_cb_destroy(struct cc_var *ccv) >>>>> { >>>>> free(ccv->cc_data, M_CUBIC); >>>>> @@ -287,9 +306,6 @@ cubic_conn_init(struct cc_var *ccv) >>>>> static int >>>>> cubic_mod_init(void) >>>>> { >>>>> - >>>>> - cubic_cc_algo.after_idle =3D newreno_cc_algo.after_idle; >>>>> - >>>>> return (0); >>>>> } >>>>>=20 >>>>> _______________________________________________ >>>>> svn-src-head@freebsd.org mailing list >>>>> https://lists.freebsd.org/mailman/listinfo/svn-src-head >>>>> To unsubscribe, send any mail to = "svn-src-head-unsubscribe@freebsd.org" >>>=20 >>> --=20 >>> Rod Grimes = rgrimes@freebsd.org >>=20 >>=20 >>=20 >=20 > --=20 > Rod Grimes = rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Nov 16 16:27:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B1961A88C0; Sat, 16 Nov 2019 16:27:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Fgc41796z4nYb; Sat, 16 Nov 2019 16:27:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0955043C3; Sat, 16 Nov 2019 16:27:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGGRVXv070666; Sat, 16 Nov 2019 16:27:31 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGGRVMf070665; Sat, 16 Nov 2019 16:27:31 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911161627.xAGGRVMf070665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 16 Nov 2019 16:27:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354775 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 354775 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 16:27:32 -0000 Author: jhibbits Date: Sat Nov 16 16:27:31 2019 New Revision: 354775 URL: https://svnweb.freebsd.org/changeset/base/354775 Log: powerpcspe: Mark asm statement in spe_save_reg_high as clobbering memory Modern gcc errors that "'vec[0]' is used uninitialized in this function" without us telling it that vec is clobbered. Neither clang nor gcc 4.2.1 error on the existing construct. Submitted by: bdragon Modified: head/sys/powerpc/booke/spe.c Modified: head/sys/powerpc/booke/spe.c ============================================================================== --- head/sys/powerpc/booke/spe.c Sat Nov 16 12:00:22 2019 (r354774) +++ head/sys/powerpc/booke/spe.c Sat Nov 16 16:27:31 2019 (r354775) @@ -426,7 +426,7 @@ spe_save_reg_high(int reg) { uint32_t vec[2]; #define EVSTDW(n) case n: __asm __volatile ("evstdw %1,0(%0)" \ - :: "b"(vec), "n"(n)); break; + :: "b"(vec), "n"(n) : "memory"); break; switch (reg) { EVSTDW(0); EVSTDW(1); EVSTDW(2); EVSTDW(3); EVSTDW(4); EVSTDW(5); EVSTDW(6); EVSTDW(7); From owner-svn-src-head@freebsd.org Sat Nov 16 16:36:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E39B71A8E45; Sat, 16 Nov 2019 16:36:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FgpF5l7Sz3Ly7; Sat, 16 Nov 2019 16:36:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 701284596; Sat, 16 Nov 2019 16:36:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGGaLt3076424; Sat, 16 Nov 2019 16:36:21 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGGaL6e076423; Sat, 16 Nov 2019 16:36:21 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911161636.xAGGaL6e076423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 16 Nov 2019 16:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354776 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 354776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 16:36:22 -0000 Author: jhibbits Date: Sat Nov 16 16:36:20 2019 New Revision: 354776 URL: https://svnweb.freebsd.org/changeset/base/354776 Log: powerpcspe: Don't leak kernel registers in SPE dumps save_vec_int() for SPE saves off only the high word of the register, leaving the low word as "garbage", but really containing whatever was in the kernel register at the time. This leaks into core dumps, and in a near future commit also into ptrace. Instead, save the GPR in the low word in save_vec_nodrop(), which is used only for core dumps and ptrace. Modified: head/sys/powerpc/booke/spe.c Modified: head/sys/powerpc/booke/spe.c ============================================================================== --- head/sys/powerpc/booke/spe.c Sat Nov 16 16:27:31 2019 (r354775) +++ head/sys/powerpc/booke/spe.c Sat Nov 16 16:36:20 2019 (r354776) @@ -176,19 +176,28 @@ save_vec(struct thread *td) /* * Save SPE state without dropping ownership. This will only save state if - * the current vector-thread is `td'. + * the current vector-thread is `td'. This is used for taking core dumps, so + * don't leak kernel information; overwrite the low words of each vector with + * their real value, taken from the thread's trap frame, unconditionally. */ void save_vec_nodrop(struct thread *td) { struct thread *vtd; + struct pcb *pcb; + int i; vtd = PCPU_GET(vecthread); - if (td != vtd) { - return; + if (td == vtd) { + save_vec_int(td); } - save_vec_int(td); + pcb = td->td_pcb; + + for (i = 0; i < 32; i++) { + pcb->pcb_vec.vr[i][1] = + td->td_frame ? td->td_frame->fixreg[i] : 0; + } } From owner-svn-src-head@freebsd.org Sat Nov 16 16:39:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5E901A8FF0; Sat, 16 Nov 2019 16:39:11 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FgsW5Kzbz3Qlv; Sat, 16 Nov 2019 16:39:11 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 433734597; Sat, 16 Nov 2019 16:39:11 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGGdBxZ076583; Sat, 16 Nov 2019 16:39:11 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGGd9lR076573; Sat, 16 Nov 2019 16:39:09 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911161639.xAGGd9lR076573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 16 Nov 2019 16:39:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354777 - in head/sys/contrib/zstd: . contrib/gen_html contrib/pzstd contrib/seekable_format/examples doc doc/educational_decoder examples lib lib/common lib/compress lib/decompress lib... X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/contrib/zstd: . contrib/gen_html contrib/pzstd contrib/seekable_format/examples doc doc/educational_decoder examples lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuild... X-SVN-Commit-Revision: 354777 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 16:39:11 -0000 Author: cem Date: Sat Nov 16 16:39:08 2019 New Revision: 354777 URL: https://svnweb.freebsd.org/changeset/base/354777 Log: Update to Zstandard 1.4.4 The full release notes can be found on Github: https://github.com/facebook/zstd/releases/tag/v1.4.4 Notable changes in this release include improved decompression speed (about 10%). See the Github release notes for more details. MFC after: I'm not going to, but feel free Relnotes: yes Added: head/sys/contrib/zstd/lib/compress/zstd_cwksp.h - copied unchanged from r354774, vendor/zstd/dist/lib/compress/zstd_cwksp.h head/sys/contrib/zstd/tests/fuzz/dictionary_loader.c - copied unchanged from r354774, vendor/zstd/dist/tests/fuzz/dictionary_loader.c head/sys/contrib/zstd/tests/fuzz/fuzz_data_producer.c - copied unchanged from r354774, vendor/zstd/dist/tests/fuzz/fuzz_data_producer.c head/sys/contrib/zstd/tests/fuzz/fuzz_data_producer.h - copied unchanged from r354774, vendor/zstd/dist/tests/fuzz/fuzz_data_producer.h head/sys/contrib/zstd/tests/golden-compression/ - copied from r354774, vendor/zstd/dist/tests/golden-compression/ head/sys/contrib/zstd/tests/golden-decompression/ - copied from r354774, vendor/zstd/dist/tests/golden-decompression/ Deleted: head/sys/contrib/zstd/contrib/gen_html/.gitignore head/sys/contrib/zstd/contrib/pzstd/.gitignore head/sys/contrib/zstd/contrib/seekable_format/examples/.gitignore head/sys/contrib/zstd/examples/.gitignore head/sys/contrib/zstd/lib/.gitignore head/sys/contrib/zstd/programs/.gitignore head/sys/contrib/zstd/tests/.gitignore head/sys/contrib/zstd/tests/files/huffman-compressed-larger head/sys/contrib/zstd/zlibWrapper/.gitignore Modified: head/sys/contrib/zstd/CHANGELOG head/sys/contrib/zstd/Makefile head/sys/contrib/zstd/README.md head/sys/contrib/zstd/appveyor.yml head/sys/contrib/zstd/doc/educational_decoder/Makefile head/sys/contrib/zstd/doc/educational_decoder/harness.c head/sys/contrib/zstd/doc/educational_decoder/zstd_decompress.c head/sys/contrib/zstd/doc/educational_decoder/zstd_decompress.h head/sys/contrib/zstd/doc/zstd_compression_format.md head/sys/contrib/zstd/doc/zstd_manual.html head/sys/contrib/zstd/examples/streaming_compression.c head/sys/contrib/zstd/examples/streaming_decompression.c head/sys/contrib/zstd/lib/Makefile head/sys/contrib/zstd/lib/README.md head/sys/contrib/zstd/lib/common/bitstream.h head/sys/contrib/zstd/lib/common/compiler.h head/sys/contrib/zstd/lib/common/fse.h head/sys/contrib/zstd/lib/common/fse_decompress.c head/sys/contrib/zstd/lib/common/mem.h head/sys/contrib/zstd/lib/common/pool.c head/sys/contrib/zstd/lib/common/threading.c head/sys/contrib/zstd/lib/common/threading.h head/sys/contrib/zstd/lib/common/xxhash.c head/sys/contrib/zstd/lib/common/zstd_internal.h head/sys/contrib/zstd/lib/compress/zstd_compress.c head/sys/contrib/zstd/lib/compress/zstd_compress_internal.h head/sys/contrib/zstd/lib/compress/zstd_compress_literals.c head/sys/contrib/zstd/lib/compress/zstd_compress_literals.h head/sys/contrib/zstd/lib/compress/zstd_compress_sequences.c head/sys/contrib/zstd/lib/compress/zstd_compress_sequences.h head/sys/contrib/zstd/lib/compress/zstd_double_fast.c head/sys/contrib/zstd/lib/compress/zstd_fast.c head/sys/contrib/zstd/lib/compress/zstd_lazy.c head/sys/contrib/zstd/lib/compress/zstd_ldm.c head/sys/contrib/zstd/lib/compress/zstd_opt.c head/sys/contrib/zstd/lib/compress/zstdmt_compress.c head/sys/contrib/zstd/lib/decompress/huf_decompress.c head/sys/contrib/zstd/lib/decompress/zstd_decompress.c head/sys/contrib/zstd/lib/decompress/zstd_decompress_block.c head/sys/contrib/zstd/lib/deprecated/zbuff.h head/sys/contrib/zstd/lib/dictBuilder/cover.c head/sys/contrib/zstd/lib/dictBuilder/zdict.c head/sys/contrib/zstd/lib/legacy/zstd_v01.c head/sys/contrib/zstd/lib/legacy/zstd_v02.c head/sys/contrib/zstd/lib/legacy/zstd_v03.c head/sys/contrib/zstd/lib/legacy/zstd_v04.c head/sys/contrib/zstd/lib/legacy/zstd_v05.c head/sys/contrib/zstd/lib/legacy/zstd_v06.c head/sys/contrib/zstd/lib/legacy/zstd_v07.c head/sys/contrib/zstd/lib/libzstd.pc.in head/sys/contrib/zstd/lib/zstd.h head/sys/contrib/zstd/programs/README.md head/sys/contrib/zstd/programs/benchzstd.c head/sys/contrib/zstd/programs/benchzstd.h head/sys/contrib/zstd/programs/datagen.c head/sys/contrib/zstd/programs/dibio.c head/sys/contrib/zstd/programs/fileio.c head/sys/contrib/zstd/programs/fileio.h head/sys/contrib/zstd/programs/platform.h head/sys/contrib/zstd/programs/timefn.h head/sys/contrib/zstd/programs/util.c head/sys/contrib/zstd/programs/util.h head/sys/contrib/zstd/programs/zstd.1 head/sys/contrib/zstd/programs/zstd.1.md head/sys/contrib/zstd/programs/zstdcli.c head/sys/contrib/zstd/programs/zstdgrep.1 head/sys/contrib/zstd/programs/zstdless.1 head/sys/contrib/zstd/tests/Makefile head/sys/contrib/zstd/tests/decodecorpus.c head/sys/contrib/zstd/tests/fullbench.c head/sys/contrib/zstd/tests/fuzz/Makefile head/sys/contrib/zstd/tests/fuzz/README.md head/sys/contrib/zstd/tests/fuzz/block_decompress.c head/sys/contrib/zstd/tests/fuzz/block_round_trip.c head/sys/contrib/zstd/tests/fuzz/dictionary_decompress.c head/sys/contrib/zstd/tests/fuzz/dictionary_round_trip.c head/sys/contrib/zstd/tests/fuzz/fuzz.h head/sys/contrib/zstd/tests/fuzz/fuzz.py head/sys/contrib/zstd/tests/fuzz/fuzz_helpers.h head/sys/contrib/zstd/tests/fuzz/regression_driver.c head/sys/contrib/zstd/tests/fuzz/simple_compress.c head/sys/contrib/zstd/tests/fuzz/simple_decompress.c head/sys/contrib/zstd/tests/fuzz/simple_round_trip.c head/sys/contrib/zstd/tests/fuzz/stream_decompress.c head/sys/contrib/zstd/tests/fuzz/stream_round_trip.c head/sys/contrib/zstd/tests/fuzz/zstd_frame_info.c head/sys/contrib/zstd/tests/fuzz/zstd_helpers.c head/sys/contrib/zstd/tests/fuzz/zstd_helpers.h head/sys/contrib/zstd/tests/fuzzer.c head/sys/contrib/zstd/tests/playTests.sh head/sys/contrib/zstd/tests/poolTests.c head/sys/contrib/zstd/tests/regression/method.c head/sys/contrib/zstd/tests/regression/results.csv head/sys/contrib/zstd/tests/zbufftest.c head/sys/contrib/zstd/tests/zstreamtest.c head/sys/contrib/zstd/zlibWrapper/Makefile head/sys/contrib/zstd/zlibWrapper/examples/fitblk.c head/sys/contrib/zstd/zlibWrapper/examples/zwrapbench.c head/sys/contrib/zstd/zlibWrapper/gzclose.c head/sys/contrib/zstd/zlibWrapper/gzlib.c head/sys/contrib/zstd/zlibWrapper/gzread.c head/sys/contrib/zstd/zlibWrapper/gzwrite.c head/sys/contrib/zstd/zlibWrapper/zstd_zlibwrapper.c Directory Properties: head/sys/contrib/zstd/ (props changed) Modified: head/sys/contrib/zstd/CHANGELOG ============================================================================== --- head/sys/contrib/zstd/CHANGELOG Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/CHANGELOG Sat Nov 16 16:39:08 2019 (r354777) @@ -1,3 +1,34 @@ +v1.4.4 +perf: Improved decompression speed, by > 10%, by @terrelln +perf: Better compression speed when re-using a context, by @felixhandte +perf: Fix compression ratio when compressing large files with small dictionary, by @senhuang42 +perf: zstd reference encoder can generate RLE blocks, by @bimbashrestha +perf: minor generic speed optimization, by @davidbolvansky +api: new ability to extract sequences from the parser for analysis, by @bimbashrestha +api: fixed decoding of magic-less frames, by @terrelln +api: fixed ZSTD_initCStream_advanced() performance with fast modes, reported by @QrczakMK +cli: Named pipes support, by @bimbashrestha +cli: short tar's extension support, by @stokito +cli: command --output-dir-flat= , generates target files into requested directory, by @senhuang42 +cli: commands --stream-size=# and --size-hint=#, by @nmagerko +cli: command --exclude-compressed, by @shashank0791 +cli: faster `-t` test mode +cli: improved some error messages, by @vangyzen +cli: rare deadlock condition within dictionary builder, by @terrelln +build: single-file decoder with emscripten compilation script, by @cwoffenden +build: fixed zlibWrapper compilation on Visual Studio, reported by @bluenlive +build: fixed deprecation warning for certain gcc version, reported by @jasonma163 +build: fix compilation on old gcc versions, by @cemeyer +build: improved installation directories for cmake script, by Dmitri Shubin +pack: modified pkgconfig, for better integration into openwrt, requested by @neheb +misc: Improved documentation : ZSTD_CLEVEL, DYNAMIC_BMI2, ZSTD_CDict, function deprecation, zstd format +misc: fixed educational decoder : accept larger literals section, and removed UNALIGNED() macro + +v1.4.3 +bug: Fix Dictionary Compression Ratio Regression by @cyan4973 (#1709) +bug: Fix Buffer Overflow in legacy v0.3 decompression by @felixhandte (#1722) +build: Add support for IAR C/C++ Compiler for Arm by @joseph0918 (#1705) + v1.4.2 bug: Fix bug in zstd-0.5 decoder by @terrelln (#1696) bug: Fix seekable decompression in-memory API by @iburinoc (#1695) Modified: head/sys/contrib/zstd/Makefile ============================================================================== --- head/sys/contrib/zstd/Makefile Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/Makefile Sat Nov 16 16:39:08 2019 (r354777) @@ -69,6 +69,7 @@ test: MOREFLAGS += -g -DDEBUGLEVEL=$(DEBUGLEVEL) -Werr test: MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants $(MAKE) -C $(TESTDIR) $@ + ZSTD=../../programs/zstd $(MAKE) -C doc/educational_decoder test ## shortest: same as `make check` .PHONY: shortest @@ -99,8 +100,8 @@ man: contrib: lib $(MAKE) -C contrib/pzstd all $(MAKE) -C contrib/seekable_format/examples all - $(MAKE) -C contrib/adaptive-compression all $(MAKE) -C contrib/largeNbDicts all + cd contrib/single_file_decoder/ ; ./build_test.sh .PHONY: cleanTabs cleanTabs: @@ -116,7 +117,6 @@ clean: @$(MAKE) -C contrib/gen_html $@ > $(VOID) @$(MAKE) -C contrib/pzstd $@ > $(VOID) @$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID) - @$(MAKE) -C contrib/adaptive-compression $@ > $(VOID) @$(MAKE) -C contrib/largeNbDicts $@ > $(VOID) @$(RM) zstd$(EXT) zstdmt$(EXT) tmp* @$(RM) -r lz4 Modified: head/sys/contrib/zstd/README.md ============================================================================== --- head/sys/contrib/zstd/README.md Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/README.md Sat Nov 16 16:39:08 2019 (r354777) @@ -15,6 +15,7 @@ a list of known ports and bindings is provided on [Zst [![Build status][AppveyorDevBadge]][AppveyorLink] [![Build status][CircleDevBadge]][CircleLink] [![Build status][CirrusDevBadge]][CirrusLink] +[![Fuzzing Status][OSSFuzzBadge]][OSSFuzzLink] [travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite" [travisLink]: https://travis-ci.org/facebook/zstd @@ -24,6 +25,8 @@ a list of known ports and bindings is provided on [Zst [CircleLink]: https://circleci.com/gh/facebook/zstd [CirrusDevBadge]: https://api.cirrus-ci.com/github/facebook/zstd.svg?branch=dev [CirrusLink]: https://cirrus-ci.com/github/facebook/zstd +[OSSFuzzBadge]: https://oss-fuzz-build-logs.storage.googleapis.com/badges/zstd.svg +[OSSFuzzLink]: https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zstd ## Benchmarks Modified: head/sys/contrib/zstd/appveyor.yml ============================================================================== --- head/sys/contrib/zstd/appveyor.yml Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/appveyor.yml Sat Nov 16 16:39:08 2019 (r354777) @@ -1,3 +1,7 @@ +# Following tests are run _only_ on master branch +# To reproduce these tests, it's possible to push into a branch `appveyorTest` +# or a branch `visual*`, they will intentionnally trigger `master` tests + - version: 1.0.{build} branches: @@ -169,13 +173,16 @@ sh -e playTests.sh --test-large-data && fullbench.exe -i1 && fullbench.exe -i1 -P0 && - fuzzer_VS2008_%PLATFORM%_Release.exe %FUZZERTEST% && - fuzzer_VS2010_%PLATFORM%_Release.exe %FUZZERTEST% && fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% && fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% && fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% ) + +# The following tests are for regular pushes +# into `dev` or some feature branch +# There run less tests, for shorter feedback loop + - version: 1.0.{build} environment: @@ -248,4 +255,12 @@ MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe && COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\ + ) + + + test_script: + - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% + - if [%HOST%]==[mingw] ( + set "CC=%COMPILER%" && + make check ) Modified: head/sys/contrib/zstd/doc/educational_decoder/Makefile ============================================================================== --- head/sys/contrib/zstd/doc/educational_decoder/Makefile Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/doc/educational_decoder/Makefile Sat Nov 16 16:39:08 2019 (r354777) @@ -1,15 +1,33 @@ +# ################################################################ +# Copyright (c) 2016-present, Yann Collet, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +ZSTD ?= zstd # note: requires zstd installation on local system + +UNAME?= $(shell uname) +ifeq ($(UNAME), SunOS) +DIFF ?= gdiff +else +DIFF ?= diff +endif + HARNESS_FILES=*.c MULTITHREAD_LDFLAGS = -pthread DEBUGFLAGS= -g -DZSTD_DEBUG=1 CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR) -CFLAGS ?= -O3 +CFLAGS ?= -O2 CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef \ + -Wstrict-aliasing=1 -Wswitch-enum \ + -Wredundant-decls -Wstrict-prototypes -Wundef \ -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls + -std=c99 CFLAGS += $(DEBUGFLAGS) CFLAGS += $(MOREFLAGS) FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MULTITHREAD_LDFLAGS) @@ -18,17 +36,27 @@ harness: $(HARNESS_FILES) $(CC) $(FLAGS) $^ -o $@ clean: - @$(RM) -f harness - @$(RM) -rf harness.dSYM + @$(RM) harness + @$(RM) -rf harness.dSYM # MacOS specific test: harness - @zstd README.md -o tmp.zst + # + # Testing single-file decompression with educational decoder + # + @$(ZSTD) -f README.md -o tmp.zst @./harness tmp.zst tmp - @diff -s tmp README.md - @$(RM) -f tmp* - @zstd --train harness.c zstd_decompress.c zstd_decompress.h README.md - @zstd -D dictionary README.md -o tmp.zst + @$(DIFF) -s tmp README.md + @$(RM) tmp* + # + # Testing dictionary decompression with education decoder + # + # note : files are presented multiple for training, to reach minimum threshold + @$(ZSTD) --train harness.c zstd_decompress.c zstd_decompress.h README.md \ + harness.c zstd_decompress.c zstd_decompress.h README.md \ + harness.c zstd_decompress.c zstd_decompress.h README.md \ + -o dictionary + @$(ZSTD) -f README.md -D dictionary -o tmp.zst @./harness tmp.zst tmp dictionary - @diff -s tmp README.md - @$(RM) -f tmp* dictionary - @make clean + @$(DIFF) -s tmp README.md + @$(RM) tmp* dictionary + @$(MAKE) clean Modified: head/sys/contrib/zstd/doc/educational_decoder/harness.c ============================================================================== --- head/sys/contrib/zstd/doc/educational_decoder/harness.c Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/doc/educational_decoder/harness.c Sat Nov 16 16:39:08 2019 (r354777) @@ -21,88 +21,90 @@ typedef unsigned char u8; // Protect against allocating too much memory for output #define MAX_OUTPUT_SIZE ((size_t)1024 * 1024 * 1024) -u8 *input; -u8 *output; -u8 *dict; - -size_t read_file(const char *path, u8 **ptr) { - FILE *f = fopen(path, "rb"); +static size_t read_file(const char *path, u8 **ptr) +{ + FILE* const f = fopen(path, "rb"); if (!f) { - fprintf(stderr, "failed to open file %s\n", path); + fprintf(stderr, "failed to open file %s \n", path); exit(1); } fseek(f, 0L, SEEK_END); - size_t size = ftell(f); + size_t const size = (size_t)ftell(f); rewind(f); *ptr = malloc(size); if (!ptr) { - fprintf(stderr, "failed to allocate memory to hold %s\n", path); + fprintf(stderr, "failed to allocate memory to hold %s \n", path); exit(1); } - size_t pos = 0; - while (!feof(f)) { - size_t read = fread(&(*ptr)[pos], 1, size, f); - if (ferror(f)) { - fprintf(stderr, "error while reading file %s\n", path); - exit(1); - } - pos += read; + size_t const read = fread(*ptr, 1, size, f); + if (read != size) { /* must read everything in one pass */ + fprintf(stderr, "error while reading file %s \n", path); + exit(1); } fclose(f); - return pos; + return read; } -void write_file(const char *path, const u8 *ptr, size_t size) { - FILE *f = fopen(path, "wb"); +static void write_file(const char *path, const u8 *ptr, size_t size) +{ + FILE* const f = fopen(path, "wb"); + if (!f) { + fprintf(stderr, "failed to open file %s \n", path); + exit(1); + } size_t written = 0; while (written < size) { - written += fwrite(&ptr[written], 1, size, f); + written += fwrite(ptr+written, 1, size, f); if (ferror(f)) { fprintf(stderr, "error while writing file %s\n", path); exit(1); - } - } + } } fclose(f); } -int main(int argc, char **argv) { +int main(int argc, char **argv) +{ if (argc < 3) { - fprintf(stderr, "usage: %s [dictionary]\n", + fprintf(stderr, "usage: %s [dictionary] \n", argv[0]); return 1; } - size_t input_size = read_file(argv[1], &input); + u8* input; + size_t const input_size = read_file(argv[1], &input); + + u8* dict = NULL; size_t dict_size = 0; if (argc >= 4) { dict_size = read_file(argv[3], &dict); } - size_t decompressed_size = ZSTD_get_decompressed_size(input, input_size); - if (decompressed_size == (size_t)-1) { - decompressed_size = MAX_COMPRESSION_RATIO * input_size; + size_t out_capacity = ZSTD_get_decompressed_size(input, input_size); + if (out_capacity == (size_t)-1) { + out_capacity = MAX_COMPRESSION_RATIO * input_size; fprintf(stderr, "WARNING: Compressed data does not contain " "decompressed size, going to assume the compression " "ratio is at most %d (decompressed size of at most " - "%zu)\n", - MAX_COMPRESSION_RATIO, decompressed_size); + "%u) \n", + MAX_COMPRESSION_RATIO, (unsigned)out_capacity); } - if (decompressed_size > MAX_OUTPUT_SIZE) { + if (out_capacity > MAX_OUTPUT_SIZE) { fprintf(stderr, - "Required output size too large for this implementation\n"); + "Required output size too large for this implementation \n"); return 1; } - output = malloc(decompressed_size); + + u8* const output = malloc(out_capacity); if (!output) { - fprintf(stderr, "failed to allocate memory\n"); + fprintf(stderr, "failed to allocate memory \n"); return 1; } @@ -110,16 +112,17 @@ int main(int argc, char **argv) { if (dict) { parse_dictionary(parsed_dict, dict, dict_size); } - size_t decompressed = - ZSTD_decompress_with_dict(output, decompressed_size, - input, input_size, parsed_dict); + size_t const decompressed_size = + ZSTD_decompress_with_dict(output, out_capacity, + input, input_size, + parsed_dict); free_dictionary(parsed_dict); - write_file(argv[2], output, decompressed); + write_file(argv[2], output, decompressed_size); free(input); free(output); free(dict); - input = output = dict = NULL; + return 0; } Modified: head/sys/contrib/zstd/doc/educational_decoder/zstd_decompress.c ============================================================================== --- head/sys/contrib/zstd/doc/educational_decoder/zstd_decompress.c Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/doc/educational_decoder/zstd_decompress.c Sat Nov 16 16:39:08 2019 (r354777) @@ -395,7 +395,7 @@ size_t ZSTD_decompress_with_dict(void *const dst, cons /* this decoder assumes decompression of a single frame */ decode_frame(&out, &in, parsed_dict); - return out.ptr - (u8 *)dst; + return (size_t)(out.ptr - (u8 *)dst); } /******* FRAME DECODING ******************************************************/ @@ -416,7 +416,7 @@ static void decompress_data(frame_context_t *const ctx static void decode_frame(ostream_t *const out, istream_t *const in, const dictionary_t *const dict) { - const u32 magic_number = IO_read_bits(in, 32); + const u32 magic_number = (u32)IO_read_bits(in, 32); // Zstandard frame // // "Magic_Number @@ -497,7 +497,7 @@ static void parse_frame_header(frame_header_t *const h // 3 Reserved_bit // 2 Content_Checksum_flag // 1-0 Dictionary_ID_flag" - const u8 descriptor = IO_read_bits(in, 8); + const u8 descriptor = (u8)IO_read_bits(in, 8); // decode frame header descriptor into flags const u8 frame_content_size_flag = descriptor >> 6; @@ -521,7 +521,7 @@ static void parse_frame_header(frame_header_t *const h // // Bit numbers 7-3 2-0 // Field name Exponent Mantissa" - u8 window_descriptor = IO_read_bits(in, 8); + u8 window_descriptor = (u8)IO_read_bits(in, 8); u8 exponent = window_descriptor >> 3; u8 mantissa = window_descriptor & 7; @@ -541,7 +541,7 @@ static void parse_frame_header(frame_header_t *const h const int bytes_array[] = {0, 1, 2, 4}; const int bytes = bytes_array[dictionary_id_flag]; - header->dictionary_id = IO_read_bits(in, bytes * 8); + header->dictionary_id = (u32)IO_read_bits(in, bytes * 8); } else { header->dictionary_id = 0; } @@ -633,8 +633,8 @@ static void decompress_data(frame_context_t *const ctx // // The next 2 bits represent the Block_Type, while the remaining 21 bits // represent the Block_Size. Format is little-endian." - last_block = IO_read_bits(in, 1); - const int block_type = IO_read_bits(in, 2); + last_block = (int)IO_read_bits(in, 1); + const int block_type = (int)IO_read_bits(in, 2); const size_t block_len = IO_read_bits(in, 21); switch (block_type) { @@ -748,8 +748,8 @@ static size_t decode_literals(frame_context_t *const c // types" // // size_format takes between 1 and 2 bits - int block_type = IO_read_bits(in, 2); - int size_format = IO_read_bits(in, 2); + int block_type = (int)IO_read_bits(in, 2); + int size_format = (int)IO_read_bits(in, 2); if (block_type <= 1) { // Raw or RLE literals block @@ -833,6 +833,7 @@ static size_t decode_literals_compressed(frame_context // bits (0-1023)." num_streams = 1; // Fall through as it has the same size format + /* fallthrough */ case 1: // "4 streams. Both Compressed_Size and Regenerated_Size use 10 bits // (0-1023)." @@ -855,8 +856,7 @@ static size_t decode_literals_compressed(frame_context // Impossible IMPOSSIBLE(); } - if (regenerated_size > MAX_LITERALS_SIZE || - compressed_size >= regenerated_size) { + if (regenerated_size > MAX_LITERALS_SIZE) { CORRUPTION(); } @@ -1005,7 +1005,7 @@ static const i16 SEQ_MATCH_LENGTH_DEFAULT_DIST[53] = { static const u32 SEQ_LITERAL_LENGTH_BASELINES[36] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 28, 32, 40, - 48, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65538}; + 48, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536}; static const u8 SEQ_LITERAL_LENGTH_EXTRA_BITS[36] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; @@ -1021,7 +1021,7 @@ static const u8 SEQ_MATCH_LENGTH_EXTRA_BITS[53] = { 2, 2, 3, 3, 4, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; /// Offset decoding is simpler so we just need a maximum code value -static const u8 SEQ_MAX_CODES[3] = {35, -1, 52}; +static const u8 SEQ_MAX_CODES[3] = {35, (u8)-1, 52}; static void decompress_sequences(frame_context_t *const ctx, istream_t *const in, @@ -1132,7 +1132,7 @@ static void decompress_sequences(frame_context_t *cons // a single 1-bit and then fills the byte with 0-7 0 bits of padding." const int padding = 8 - highest_set_bit(src[len - 1]); // The offset starts at the end because FSE streams are read backwards - i64 bit_offset = len * 8 - padding; + i64 bit_offset = (i64)(len * 8 - (size_t)padding); // "The bitstream starts with initial state values, each using the required // number of bits in their respective accuracy, decoded previously from @@ -1409,7 +1409,7 @@ size_t ZSTD_get_decompressed_size(const void *src, con // get decompressed size from ZSTD frame header { - const u32 magic_number = IO_read_bits(&in, 32); + const u32 magic_number = (u32)IO_read_bits(&in, 32); if (magic_number == 0xFD2FB528U) { // ZSTD frame @@ -1418,7 +1418,7 @@ size_t ZSTD_get_decompressed_size(const void *src, con if (header.frame_content_size == 0 && !header.single_segment_flag) { // Content size not provided, we can't tell - return -1; + return (size_t)-1; } return header.frame_content_size; @@ -1529,7 +1529,7 @@ void free_dictionary(dictionary_t *const dict) { /******* END DICTIONARY PARSING ***********************************************/ /******* IO STREAM OPERATIONS *************************************************/ -#define UNALIGNED() ERROR("Attempting to operate on a non-byte aligned stream") + /// Reads `num` bits from a bitstream, and updates the internal offset static inline u64 IO_read_bits(istream_t *const in, const int num_bits) { if (num_bits > 64 || num_bits <= 0) { @@ -1608,7 +1608,7 @@ static inline const u8 *IO_get_read_ptr(istream_t *con INP_SIZE(); } if (in->bit_offset != 0) { - UNALIGNED(); + ERROR("Attempting to operate on a non-byte aligned stream"); } const u8 *const ptr = in->ptr; in->ptr += len; @@ -1634,7 +1634,7 @@ static inline void IO_advance_input(istream_t *const i INP_SIZE(); } if (in->bit_offset != 0) { - UNALIGNED(); + ERROR("Attempting to operate on a non-byte aligned stream"); } in->ptr += len; Modified: head/sys/contrib/zstd/doc/educational_decoder/zstd_decompress.h ============================================================================== --- head/sys/contrib/zstd/doc/educational_decoder/zstd_decompress.h Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/doc/educational_decoder/zstd_decompress.h Sat Nov 16 16:39:08 2019 (r354777) @@ -7,6 +7,8 @@ * in the COPYING file in the root directory of this source tree). */ +#include /* size_t */ + /******* EXPOSED TYPES ********************************************************/ /* * Contains the parsed contents of a dictionary @@ -39,7 +41,7 @@ size_t ZSTD_get_decompressed_size(const void *const sr * Return a valid dictionary_t pointer for use with dictionary initialization * or decompression */ -dictionary_t* create_dictionary(); +dictionary_t* create_dictionary(void); /* * Parse a provided dictionary blob for use in decompression Modified: head/sys/contrib/zstd/doc/zstd_compression_format.md ============================================================================== --- head/sys/contrib/zstd/doc/zstd_compression_format.md Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/doc/zstd_compression_format.md Sat Nov 16 16:39:08 2019 (r354777) @@ -16,7 +16,7 @@ Distribution of this document is unlimited. ### Version -0.3.2 (17/07/19) +0.3.4 (16/08/19) Introduction @@ -358,6 +358,7 @@ It may be followed by an optional `Content_Checksum` __`Block_Type`__ The next 2 bits represent the `Block_Type`. +`Block_Type` influences the meaning of `Block_Size`. There are 4 block types : | Value | 0 | 1 | 2 | 3 | @@ -384,9 +385,12 @@ There are 4 block types : __`Block_Size`__ The upper 21 bits of `Block_Header` represent the `Block_Size`. -`Block_Size` is the size of the block excluding the header. -A block can contain any number of bytes (even zero), up to -`Block_Maximum_Decompressed_Size`, which is the smallest of: +When `Block_Type` is `Compressed_Block` or `Raw_Block`, +`Block_Size` is the size of `Block_Content`, hence excluding `Block_Header`. +When `Block_Type` is `RLE_Block`, `Block_Content`’s size is always 1, +and `Block_Size` represents the number of times this byte must be repeated. +A block can contain and decompress into any number of bytes (even zero), +up to `Block_Maximum_Decompressed_Size`, which is the smallest of: - Window_Size - 128 KB @@ -1103,18 +1107,18 @@ It follows the following build rule : The table has a size of `Table_Size = 1 << Accuracy_Log`. Each cell describes the symbol decoded, -and instructions to get the next state. +and instructions to get the next state (`Number_of_Bits` and `Baseline`). Symbols are scanned in their natural order for "less than 1" probabilities. Symbols with this probability are being attributed a single cell, starting from the end of the table and retreating. These symbols define a full state reset, reading `Accuracy_Log` bits. -All remaining symbols are allocated in their natural order. -Starting from symbol `0` and table position `0`, +Then, all remaining symbols, sorted in natural order, are allocated cells. +Starting from symbol `0` (if it exists), and table position `0`, each symbol gets allocated as many cells as its probability. Cell allocation is spreaded, not linear : -each successor position follow this rule : +each successor position follows this rule : ``` position += (tableSize>>1) + (tableSize>>3) + 3; @@ -1126,40 +1130,41 @@ A position is skipped if already occupied by a "less t each position in the table, switching to the next symbol when enough states have been allocated to the current one. -The result is a list of state values. -Each state will decode the current symbol. +The process guarantees that the table is entirely filled. +Each cell corresponds to a state value, which contains the symbol being decoded. -To get the `Number_of_Bits` and `Baseline` required for next state, -it's first necessary to sort all states in their natural order. -The lower states will need 1 more bit than higher ones. +To add the `Number_of_Bits` and `Baseline` required to retrieve next state, +it's first necessary to sort all occurrences of each symbol in state order. +Lower states will need 1 more bit than higher ones. The process is repeated for each symbol. __Example__ : -Presuming a symbol has a probability of 5. -It receives 5 state values. States are sorted in natural order. +Presuming a symbol has a probability of 5, +it receives 5 cells, corresponding to 5 state values. +These state values are then sorted in natural order. -Next power of 2 is 8. -Space of probabilities is divided into 8 equal parts. -Presuming the `Accuracy_Log` is 7, it defines 128 states. +Next power of 2 after 5 is 8. +Space of probabilities must be divided into 8 equal parts. +Presuming the `Accuracy_Log` is 7, it defines a space of 128 states. Divided by 8, each share is 16 large. -In order to reach 8, 8-5=3 lowest states will count "double", -doubling the number of shares (32 in width), -requiring one more bit in the process. +In order to reach 8 shares, 8-5=3 lowest states will count "double", +doubling their shares (32 in width), hence requiring one more bit. Baseline is assigned starting from the higher states using fewer bits, -and proceeding naturally, then resuming at the first state, -each takes its allocated width from Baseline. +increasing at each state, then resuming at the first state, +each state takes its allocated width from Baseline. -| state order | 0 | 1 | 2 | 3 | 4 | -| ---------------- | ----- | ----- | ------ | ---- | ----- | -| width | 32 | 32 | 32 | 16 | 16 | -| `Number_of_Bits` | 5 | 5 | 5 | 4 | 4 | -| range number | 2 | 4 | 6 | 0 | 1 | -| `Baseline` | 32 | 64 | 96 | 0 | 16 | -| range | 32-63 | 64-95 | 96-127 | 0-15 | 16-31 | +| state value | 1 | 39 | 77 | 84 | 122 | +| state order | 0 | 1 | 2 | 3 | 4 | +| ---------------- | ----- | ----- | ------ | ---- | ------ | +| width | 32 | 32 | 32 | 16 | 16 | +| `Number_of_Bits` | 5 | 5 | 5 | 4 | 4 | +| range number | 2 | 4 | 6 | 0 | 1 | +| `Baseline` | 32 | 64 | 96 | 0 | 16 | +| range | 32-63 | 64-95 | 96-127 | 0-15 | 16-31 | -The next state is determined from current state +During decoding, the next state value is determined from current state value, by reading the required `Number_of_Bits`, and adding the specified `Baseline`. See [Appendix A] for the results of this process applied to the default distributions. @@ -1653,6 +1658,8 @@ or at least provide a meaningful error code explaining Version changes --------------- +- 0.3.4 : clarifications for FSE decoding table +- 0.3.3 : clarifications for field Block_Size - 0.3.2 : remove additional block size restriction on compressed blocks - 0.3.1 : minor clarification regarding offset history update rules - 0.3.0 : minor edits to match RFC8478 Modified: head/sys/contrib/zstd/doc/zstd_manual.html ============================================================================== --- head/sys/contrib/zstd/doc/zstd_manual.html Sat Nov 16 16:36:20 2019 (r354776) +++ head/sys/contrib/zstd/doc/zstd_manual.html Sat Nov 16 16:39:08 2019 (r354777) @@ -1,10 +1,10 @@ -zstd 1.4.2 Manual +zstd 1.4.4 Manual -

zstd 1.4.2 Manual

+

zstd 1.4.4 Manual


Contents

    @@ -27,10 +27,16 @@
  1. Advanced compression functions
  2. Advanced decompression functions
  3. Advanced streaming functions
  4. -
  5. Buffer-less and synchronous inner streaming functions
  6. -
  7. Buffer-less streaming compression (synchronous mode)
  8. -
  9. Buffer-less streaming decompression (synchronous mode)
  10. -
  11. Block level API
  12. +
  13. ! ZSTD_initCStream_usingDict() :
  14. +
  15. ! ZSTD_initCStream_advanced() :
  16. +
  17. ! ZSTD_initCStream_usingCDict() :
  18. +
  19. ! ZSTD_initCStream_usingCDict_advanced() :
  20. +
  21. This function is deprecated, and is equivalent to:
  22. +
  23. This function is deprecated, and is equivalent to:
  24. +
  25. Buffer-less and synchronous inner streaming functions
  26. +
  27. Buffer-less streaming compression (synchronous mode)
  28. +
  29. Buffer-less streaming decompression (synchronous mode)
  30. +
  31. Block level API

Introduction

@@ -157,9 +163,13 @@ size_t     ZSTD_freeCCtx(ZSTD_CCtx* cctx);
                          void* dst, size_t dstCapacity,
                    const void* src, size_t srcSize,
                          int compressionLevel);
-

Same as ZSTD_compress(), using an explicit ZSTD_CCtx - The function will compress at requested compression level, - ignoring any other parameter +

Same as ZSTD_compress(), using an explicit ZSTD_CCtx. + Important : in order to behave similarly to `ZSTD_compress()`, + this function compresses at requested compression level, + __ignoring any other parameter__ . + If any advanced parameter was set using the advanced API, + they will all be reset. Only `compressionLevel` remains. +


Decompression context

  When decompressing many times,
@@ -199,18 +209,26 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
 
     /* compression parameters
      * Note: When compressing with a ZSTD_CDict these parameters are superseded
-     * by the parameters used to construct the ZSTD_CDict. See ZSTD_CCtx_refCDict()
-     * for more info (superseded-by-cdict). */
-    ZSTD_c_compressionLevel=100, /* Update all compression parameters according to pre-defined cLevel table
+     * by the parameters used to construct the ZSTD_CDict.
+     * See ZSTD_CCtx_refCDict() for more info (superseded-by-cdict). */
+    ZSTD_c_compressionLevel=100, /* Set compression parameters according to pre-defined cLevel table.
+                              * Note that exact compression parameters are dynamically determined,
+                              * depending on both compression level and srcSize (when known).
                               * Default level is ZSTD_CLEVEL_DEFAULT==3.
                               * Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT.
                               * Note 1 : it's possible to pass a negative compression level.
-                              * Note 2 : setting a level sets all default values of other compression parameters */
+                              * Note 2 : setting a level resets all other compression parameters to default */
+    /* Advanced compression parameters :
+     * It's possible to pin down compression parameters to some specific values.
+     * In which case, these values are no longer dynamically selected by the compressor */
     ZSTD_c_windowLog=101,    /* Maximum allowed back-reference distance, expressed as power of 2.
+                              * This will set a memory budget for streaming decompression,
+                              * with larger values requiring more memory
+                              * and typically compressing more.
                               * Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.
                               * Special: value 0 means "use default windowLog".
                               * Note: Using a windowLog greater than ZSTD_WINDOWLOG_LIMIT_DEFAULT
-                              *       requires explicitly allowing such window size at decompression stage if using streaming. */
+                              *       requires explicitly allowing such size at streaming decompression stage. */
     ZSTD_c_hashLog=102,      /* Size of the initial probe table, as a power of 2.
                               * Resulting memory usage is (1 << (hashLog+2)).
                               * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
@@ -221,13 +239,13 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
                               * Resulting memory usage is (1 << (chainLog+2)).
                               * Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX.
                               * Larger tables result in better and slower compression.
-                              * This parameter is useless when using "fast" strategy.
+                              * This parameter is useless for "fast" strategy.
                               * It's still useful when using "dfast" strategy,
                               * in which case it defines a secondary probe table.
                               * Special: value 0 means "use default chainLog". */
     ZSTD_c_searchLog=104,    /* Number of search attempts, as a power of 2.
                               * More attempts result in better and slower compression.
-                              * This parameter is useless when using "fast" and "dFast" strategies.
+                              * This parameter is useless for "fast" and "dFast" strategies.
                               * Special: value 0 means "use default searchLog". */
     ZSTD_c_minMatch=105,     /* Minimum size of searched matches.
                               * Note that Zstandard can still find matches of smaller size,
@@ -282,7 +300,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
     ZSTD_c_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1)
                               * Content size must be known at the beginning of compression.
                               * This is automatically the case when using ZSTD_compress2(),
-                              * For streaming variants, content size must be provided with ZSTD_CCtx_setPledgedSrcSize() */
+                              * For streaming scenarios, content size must be provided with ZSTD_CCtx_setPledgedSrcSize() */
     ZSTD_c_checksumFlag=201, /* A 32-bits checksum of content is written at end of frame (default:0) */
     ZSTD_c_dictIDFlag=202,   /* When applicable, dictionary's ID is written into frame header (default:1) */
 
@@ -301,7 +319,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
                               * Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.
                               * 0 means default, which is dynamically determined based on compression parameters.
                               * Job size must be a minimum of overlap size, or 1 MB, whichever is largest.
-                              * The minimum size is automatically and transparently enforced */
+                              * The minimum size is automatically and transparently enforced. */
     ZSTD_c_overlapLog=402,   /* Control the overlap size, as a fraction of window size.
                               * The overlap size is an amount of data reloaded from previous job at the beginning of a new job.
                               * It helps preserve compression ratio, while each job is compressed in parallel.
@@ -324,6 +342,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
      * ZSTD_c_forceAttachDict
      * ZSTD_c_literalCompressionMode
      * ZSTD_c_targetCBlockSize
+     * ZSTD_c_srcSizeHint
      * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
      * note : never ever use experimentalParam? names directly;
      *        also, the enums values themselves are unstable and can still change.
@@ -334,6 +353,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
      ZSTD_c_experimentalParam4=1001,
      ZSTD_c_experimentalParam5=1002,
      ZSTD_c_experimentalParam6=1003,
+     ZSTD_c_experimentalParam7=1004
 } ZSTD_cParameter;
 

typedef struct {
@@ -672,12 +692,17 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
 
 
ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize,
                              int compressionLevel);
-

When compressing multiple messages / blocks using the same dictionary, it's recommended to load it only once. - ZSTD_createCDict() will create a digested dictionary, ready to start future compression operations without startup cost. +

When compressing multiple messages or blocks using the same dictionary, + it's recommended to digest the dictionary only once, since it's a costly operation. + ZSTD_createCDict() will create a state from digesting a dictionary. + The resulting state can be used for future compression operations with very limited startup cost. ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. - `dictBuffer` can be released after ZSTD_CDict creation, because its content is copied within CDict. - Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate `dictBuffer` content. - Note : A ZSTD_CDict can be created from an empty dictBuffer, but it is inefficient when used to compress small data. + @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict. + Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content. + Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer, + in which case the only thing that it transports is the @compressionLevel. + This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively, + expecting a ZSTD_CDict parameter with any data, including those without a known dictionary.


size_t      ZSTD_freeCDict(ZSTD_CDict* CDict);
@@ -794,7 +819,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
   Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.
            It's a CPU consuming operation, with non-negligible impact on latency.
            If there is a need to use the same prefix multiple times, consider loadDictionary instead.
-  Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dm_rawContent).
+  Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent).
            Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation. 
 


@@ -838,7 +863,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds); Note 2 : Prefix buffer is referenced. It **must** outlive decompression. Prefix buffer must remain unmodified up to the end of frame, reached when ZSTD_decompressStream() returns 0. - Note 3 : By default, the prefix is treated as raw content (ZSTD_dm_rawContent). + Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent). Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section) Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost. A full dictionary is more costly, as it requires building tables. @@ -865,6 +890,24 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
typedef struct {
+    unsigned int matchPos; /* Match pos in dst */
+    /* If seqDef.offset > 3, then this is seqDef.offset - 3
+     * If seqDef.offset < 3, then this is the corresponding repeat offset
+     * But if seqDef.offset < 3 and litLength == 0, this is the
+     *   repeat offset before the corresponding repeat offset
+     * And if seqDef.offset == 3 and litLength == 0, this is the
+     *   most recent repeat offset - 1
+     */
+    unsigned int offset;
+    unsigned int litLength; /* Literal length */
+    unsigned int matchLength; /* Match length */
+    /* 0 when seq not rep and seqDef.offset otherwise
+     * when litLength == 0 this will be <= 4, otherwise <= 3 like normal
+     */
+    unsigned int rep;
+} ZSTD_Sequence;
+

+
typedef struct {
     unsigned windowLog;       /**< largest match distance : larger == more compression, more memory needed during decompression */
     unsigned chainLog;        /**< fully searched segment : larger == more compression, slower, more memory (useless for fast) */
     unsigned hashLog;         /**< dispatch table : larger == faster, more memory */
@@ -893,21 +936,12 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
 

typedef enum {
     ZSTD_dlm_byCopy = 0,  /**< Copy dictionary content internally */
-    ZSTD_dlm_byRef = 1,   /**< Reference dictionary content -- the dictionary buffer must outlive its users. */
+    ZSTD_dlm_byRef = 1    /**< Reference dictionary content -- the dictionary buffer must outlive its users. */
 } ZSTD_dictLoadMethod_e;
 

typedef enum {
-    /* Opened question : should we have a format ZSTD_f_auto ?
-     * Today, it would mean exactly the same as ZSTD_f_zstd1.
-     * But, in the future, should several formats become supported,
-     * on the compression side, it would mean "default format".
-     * On the decompression side, it would mean "automatic format detection",
-     * so that ZSTD_f_zstd1 would mean "accept *only* zstd frames".
-     * Since meaning is a little different, another option could be to define different enums for compression and decompression.
-     * This question could be kept for later, when there are actually multiple formats to support,
-     * but there is also the question of pinning enum values, and pinning value `0` is especially important */
     ZSTD_f_zstd1 = 0,           /* zstd frame format, specified in zstd_compression_format.md (default) */
-    ZSTD_f_zstd1_magicless = 1, /* Variant of zstd frame format, without initial 4-bytes magic number.
+    ZSTD_f_zstd1_magicless = 1  /* Variant of zstd frame format, without initial 4-bytes magic number.
                                  * Useful to save 4 bytes per generated frame.
                                  * Decoder cannot recognise automatically this format, requiring this instruction. */
 } ZSTD_format_e;
@@ -918,7 +952,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
      * to evolve and should be considered only in the context of extremely
      * advanced performance tuning.
      *
-     * Zstd currently supports the use of a CDict in two ways:
+     * Zstd currently supports the use of a CDict in three ways:
      *
      * - The contents of the CDict can be copied into the working context. This
      *   means that the compression can search both the dictionary and input
@@ -934,6 +968,12 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
      *   working context's tables can be reused). For small inputs, this can be
      *   faster than copying the CDict's tables.
      *
+     * - The CDict's tables are not used at all, and instead we use the working
+     *   context alone to reload the dictionary and use params based on the source
+     *   size. See ZSTD_compress_insertDictionary() and ZSTD_compress_usingDict().
+     *   This method is effective when the dictionary sizes are very small relative
+     *   to the input size, and the input size is fairly large to begin with.
+     *
      * Zstd has a simple internal heuristic that selects which strategy to use
      * at the beginning of a compression. However, if experimentation shows that
      * Zstd is making poor choices, it is possible to override that choice with
@@ -942,6 +982,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
     ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */
     ZSTD_dictForceAttach   = 1, /* Never copy the dictionary. */
     ZSTD_dictForceCopy     = 2, /* Always copy the dictionary. */
+    ZSTD_dictForceLoad     = 3  /* Always reload the dictionary */
 } ZSTD_dictAttachPref_e;
 

typedef enum {
@@ -950,7 +991,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
                                *   levels will be compressed. */
   ZSTD_lcm_huffman = 1,       /**< Always attempt Huffman compression. Uncompressed literals will still be
                                *   emitted if Huffman compression is not profitable. */
-  ZSTD_lcm_uncompressed = 2,  /**< Always emit uncompressed literals. */
+  ZSTD_lcm_uncompressed = 2   /**< Always emit uncompressed literals. */
 } ZSTD_literalCompressionMode_e;
 

Frame size functions


@@ -999,20 +1040,38 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
            or an error code (if srcSize is too small) 
 


+
size_t ZSTD_getSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs,
+    size_t outSeqsSize, const void* src, size_t srcSize);
+

Extract sequences from the sequence store + zc can be used to insert custom compression params. + This function invokes ZSTD_compress2 + @return : number of sequences extracted + +


+

Memory management


 
 
size_t ZSTD_estimateCCtxSize(int compressionLevel);
 size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
 size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
 size_t ZSTD_estimateDCtxSize(void);
-

These functions make it possible to estimate memory usage - of a future {D,C}Ctx, before its creation. - ZSTD_estimateCCtxSize() will provide a budget large enough for any compression level up to selected one. - It will also consider src size to be arbitrarily "large", which is worst case. - If srcSize is known to always be small, ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation. - ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel. - ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1. - Note : CCtx size estimation is only correct for single-threaded compression. +

These functions make it possible to estimate memory usage of a future + {D,C}Ctx, before its creation. + + ZSTD_estimateCCtxSize() will provide a budget large enough for any + compression level up to selected one. Unlike ZSTD_estimateCStreamSize*(), + this estimate does not include space for a window buffer, so this estimate + is guaranteed to be enough for single-shot compressions, but not streaming + compressions. It will however assume the input may be arbitrarily large, + which is the worst case. If srcSize is known to always be small, + ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation. + ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with + ZSTD_getCParams() to create cParams from compressionLevel. + ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with + ZSTD_CCtxParams_setParameter(). + + Note: only single-threaded compression is supported. This function will + return an error code if ZSTD_c_nbWorkers is >= 1.


size_t ZSTD_estimateCStreamSize(int compressionLevel);
@@ -1085,7 +1144,8 @@ static ZSTD_customMem const ZSTD_defaultCMem = { NULL,
 

Create a digested dictionary for compression Dictionary content is just referenced, not duplicated. As a consequence, `dictBuffer` **must** outlive CDict, - and its content must remain unmodified throughout the lifetime of CDict. + and its content must remain unmodified throughout the lifetime of CDict. + note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef


ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
@@ -1116,7 +1176,9 @@ static ZSTD_customMem const ZSTD_defaultCMem = { NULL,
                         const void* src, size_t srcSize,
                         const void* dict,size_t dictSize,
                               ZSTD_parameters params);
-

Same as ZSTD_compress_usingDict(), with fine-tune control over compression parameters (by structure) +

Note : this function is now DEPRECATED. + It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters. + This prototype will be marked as deprecated and generate compilation warning on reaching v1.5.x


size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx,
@@ -1124,7 +1186,9 @@ static ZSTD_customMem const ZSTD_defaultCMem = { NULL,
                             const void* src, size_t srcSize,

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@freebsd.org  Sat Nov 16 18:24:29 2019
Return-Path: 
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E2FD1AB05F;
 Sat, 16 Nov 2019 18:24:29 +0000 (UTC)
 (envelope-from jhibbits@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 47FkC11trCz4R3V;
 Sat, 16 Nov 2019 18:24:29 +0000 (UTC)
 (envelope-from jhibbits@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E85C596F;
 Sat, 16 Nov 2019 18:24:29 +0000 (UTC)
 (envelope-from jhibbits@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGIOSmI041825;
 Sat, 16 Nov 2019 18:24:28 GMT (envelope-from jhibbits@FreeBSD.org)
Received: (from jhibbits@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGIOSeA041824;
 Sat, 16 Nov 2019 18:24:28 GMT (envelope-from jhibbits@FreeBSD.org)
Message-Id: <201911161824.xAGIOSeA041824@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to
 jhibbits@FreeBSD.org using -f
From: Justin Hibbits 
Date: Sat, 16 Nov 2019 18:24:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r354778 - head/usr.bin/gcore
X-SVN-Group: head
X-SVN-Commit-Author: jhibbits
X-SVN-Commit-Paths: head/usr.bin/gcore
X-SVN-Commit-Revision: 354778
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Sat, 16 Nov 2019 18:24:29 -0000

Author: jhibbits
Date: Sat Nov 16 18:24:28 2019
New Revision: 354778
URL: https://svnweb.freebsd.org/changeset/base/354778

Log:
  gcore: Don't add VSX notes on powerpcspe
  
  powerpcspe does not support VSX at all, but gets the 'VMX' notes for free,
  providing the SPE registers.

Modified:
  head/usr.bin/gcore/elfcore.c

Modified: head/usr.bin/gcore/elfcore.c
==============================================================================
--- head/usr.bin/gcore/elfcore.c	Sat Nov 16 16:39:08 2019	(r354777)
+++ head/usr.bin/gcore/elfcore.c	Sat Nov 16 18:24:28 2019	(r354778)
@@ -382,7 +382,9 @@ elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep
 #endif
 #if defined(__powerpc__)
 		elf_putnote(NT_PPC_VMX, elf_note_powerpc_vmx, tids + i, sb);
+#ifndef __SPE__
 		elf_putnote(NT_PPC_VSX, elf_note_powerpc_vsx, tids + i, sb);
+#endif
 #endif
 	}
 

From owner-svn-src-head@freebsd.org  Sat Nov 16 19:12:18 2019
Return-Path: 
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEC541AC2C4;
 Sat, 16 Nov 2019 19:12:18 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 47FlGB3kyLz3DsG;
 Sat, 16 Nov 2019 19:12:18 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5787B624A;
 Sat, 16 Nov 2019 19:12:18 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGJCIJL071309;
 Sat, 16 Nov 2019 19:12:18 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGJCHp4071307;
 Sat, 16 Nov 2019 19:12:17 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201911161912.xAGJCHp4071307@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers 
Date: Sat, 16 Nov 2019 19:12:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r354779 - head/sys/conf
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/sys/conf
X-SVN-Commit-Revision: 354779
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Sat, 16 Nov 2019 19:12:18 -0000

Author: asomers
Date: Sat Nov 16 19:12:17 2019
New Revision: 354779
URL: https://svnweb.freebsd.org/changeset/base/354779

Log:
  Actually hook CAM_IO_STATS up to the build
  
  It's still disabled by default, but now it can be enabled with config(5) and
  it will be build in LINT.
  
  Reviewed by:	imp
  MFC after:	1 week
  Sponsored by:	Axcient
  Differential Revision:	https://reviews.freebsd.org/D22383

Modified:
  head/sys/conf/NOTES
  head/sys/conf/options

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Sat Nov 16 18:24:28 2019	(r354778)
+++ head/sys/conf/NOTES	Sat Nov 16 19:12:17 2019	(r354779)
@@ -1353,6 +1353,7 @@ device		ctl		#CAM Target Layer
 # CAM_DEBUG_TARGET	Limit debugging to the given target.
 # CAM_DEBUG_LUN		Limit debugging to the given lun.
 # CAM_DEBUG_DELAY	Delay in us after printing each debug line.
+# CAM_IO_STATS		Publish additional CAM device statics by sysctl
 #
 # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds
 # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions
@@ -1374,6 +1375,7 @@ options 	SCSI_NO_SENSE_STRINGS
 options 	SCSI_NO_OP_STRINGS
 options 	SCSI_DELAY=5000	# Be pessimistic about Joe SCSI device
 options 	CAM_IOSCHED_DYNAMIC
+options		CAM_IO_STATS
 options		CAM_TEST_FAILURE
 
 # Options for the CAM CDROM driver:

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Sat Nov 16 18:24:28 2019	(r354778)
+++ head/sys/conf/options	Sat Nov 16 19:12:17 2019	(r354779)
@@ -349,6 +349,7 @@ CAM_DEBUG_LUN		opt_cam.h
 CAM_DEBUG_FLAGS		opt_cam.h
 CAM_BOOT_DELAY		opt_cam.h
 CAM_IOSCHED_DYNAMIC	opt_cam.h
+CAM_IO_STATS		opt_cam.h
 CAM_TEST_FAILURE	opt_cam.h
 SCSI_DELAY		opt_scsi.h
 SCSI_NO_SENSE_STRINGS	opt_scsi.h

From owner-svn-src-head@freebsd.org  Sat Nov 16 20:33:47 2019
Return-Path: 
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AFE01ADA56;
 Sat, 16 Nov 2019 20:33:47 +0000 (UTC)
 (envelope-from bdragon@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 47Fn4B6cc9z4Pf5;
 Sat, 16 Nov 2019 20:33:46 +0000 (UTC)
 (envelope-from bdragon@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C21FD70D0;
 Sat, 16 Nov 2019 20:33:46 +0000 (UTC)
 (envelope-from bdragon@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAGKXkR7018807;
 Sat, 16 Nov 2019 20:33:46 GMT (envelope-from bdragon@FreeBSD.org)
Received: (from bdragon@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGKXkte018805;
 Sat, 16 Nov 2019 20:33:46 GMT (envelope-from bdragon@FreeBSD.org)
Message-Id: <201911162033.xAGKXkte018805@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bdragon set sender to
 bdragon@FreeBSD.org using -f
From: Brandon Bergren 
Date: Sat, 16 Nov 2019 20:33:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r354780 - head/lib/libc/powerpc64/gen
X-SVN-Group: head
X-SVN-Commit-Author: bdragon
X-SVN-Commit-Paths: head/lib/libc/powerpc64/gen
X-SVN-Commit-Revision: 354780
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Sat, 16 Nov 2019 20:33:47 -0000

Author: bdragon
Date: Sat Nov 16 20:33:46 2019
New Revision: 354780
URL: https://svnweb.freebsd.org/changeset/base/354780

Log:
  [PowerPC] Fix *context on ELFv2
  
  Due to ELFv1 specific code in _ctx_start.S and makecontext.c, userspace
  context switching was completely broken on ELFv2.
  
  With this change, we now pass the libthr test suite.
  
  Approved by: jhibbits (mentor)
  Differential Revision: https://reviews.freebsd.org/D22421

Modified:
  head/lib/libc/powerpc64/gen/_ctx_start.S
  head/lib/libc/powerpc64/gen/makecontext.c

Modified: head/lib/libc/powerpc64/gen/_ctx_start.S
==============================================================================
--- head/lib/libc/powerpc64/gen/_ctx_start.S	Sat Nov 16 19:12:17 2019	(r354779)
+++ head/lib/libc/powerpc64/gen/_ctx_start.S	Sat Nov 16 20:33:46 2019	(r354780)
@@ -32,8 +32,14 @@
 	.globl  CNAME(abort)
 
  ENTRY(_ctx_start)
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
+	/* Load values from function descriptor */
 	ld	%r2,8(%r14)
 	ld	%r14,0(%r14)
+#else
+	/* Load global entry point */
+	mr	%r12,%r14
+#endif
 	mtlr	%r14
 	blrl			/* branch to start function */
 	mr	%r3,%r15	/* pass pointer to ucontext as argument */

Modified: head/lib/libc/powerpc64/gen/makecontext.c
==============================================================================
--- head/lib/libc/powerpc64/gen/makecontext.c	Sat Nov 16 19:12:17 2019	(r354779)
+++ head/lib/libc/powerpc64/gen/makecontext.c	Sat Nov 16 20:33:46 2019	(r354780)
@@ -113,7 +113,12 @@ __makecontext(ucontext_t *ucp, void (*start)(void), in
 	 * Use caller-saved regs 14/15 to hold params that _ctx_start
 	 * will use to invoke the user-supplied func
 	 */
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
+	/* Cast to ensure this is treated as a function descriptor. */
 	mc->mc_srr0 = *(uintptr_t *)_ctx_start;
+#else
+	mc->mc_srr0 = (uintptr_t) _ctx_start;
+#endif
 	mc->mc_gpr[1] = (uintptr_t) sp;		/* new stack pointer */
 	mc->mc_gpr[14] = (uintptr_t) start;	/* r14 <- start */
 	mc->mc_gpr[15] = (uintptr_t) ucp;	/* r15 <- ucp */