From owner-dev-commits-src-main@freebsd.org Mon Aug 16 04:28:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E1F8066BD70; Mon, 16 Aug 2021 04:28:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gp1Pk5mpmz589B; Mon, 16 Aug 2021 04:28:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE23522BD1; Mon, 16 Aug 2021 04:28:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17G4Sgag092617; Mon, 16 Aug 2021 04:28:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17G4SgWS092616; Mon, 16 Aug 2021 04:28:42 GMT (envelope-from git) Date: Mon, 16 Aug 2021 04:28:42 GMT Message-Id: <202108160428.17G4SgWS092616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 59d1661cd8b0 - main - tpm_tis: Improve interrupt allocation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 59d1661cd8b02d13bc697e9dc0ff97844e719d9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 04:28:43 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=59d1661cd8b02d13bc697e9dc0ff97844e719d9b commit 59d1661cd8b02d13bc697e9dc0ff97844e719d9b Author: Kornel Duleba AuthorDate: 2021-08-16 04:26:50 +0000 Commit: Wojciech Macek CommitDate: 2021-08-16 04:28:33 +0000 tpm_tis: Improve interrupt allocation Validate the irq received from ACPI. Test if it works by sending a simple command and checking if the interrupt handler was executed. Internal buffer allocation was moved away from common code to tis and crb parts - in order to test the interrupt we need to have it allocated early. Obtained from: Semihalf Differential revision: https://reviews.freebsd.org/D31395 --- sys/dev/tpm/tpm20.c | 3 -- sys/dev/tpm/tpm20.h | 2 + sys/dev/tpm/tpm_crb.c | 11 +++-- sys/dev/tpm/tpm_tis.c | 119 ++++++++++++++++++++++++++++---------------------- 4 files changed, 77 insertions(+), 58 deletions(-) diff --git a/sys/dev/tpm/tpm20.c b/sys/dev/tpm/tpm20.c index eeddad85009d..68a30cfb51dd 100644 --- a/sys/dev/tpm/tpm20.c +++ b/sys/dev/tpm/tpm20.c @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); */ #define TPM_HARVEST_INTERVAL 10000000 -MALLOC_DECLARE(M_TPM20); MALLOC_DEFINE(M_TPM20, "tpm_buffer", "buffer for tpm 2.0 driver"); static void tpm20_discard_buffer(void *arg); @@ -191,8 +190,6 @@ tpm20_init(struct tpm_sc *sc) struct make_dev_args args; int result; - sc->buf = malloc(TPM_BUFSIZE, M_TPM20, M_WAITOK); - sx_init(&sc->dev_lock, "TPM driver lock"); cv_init(&sc->buf_cv, "TPM buffer cv"); callout_init(&sc->discard_buffer_callout, 1); #ifdef TPM_HARVEST diff --git a/sys/dev/tpm/tpm20.h b/sys/dev/tpm/tpm20.h index bafbd93dc136..6911ca0cb6fe 100644 --- a/sys/dev/tpm/tpm20.h +++ b/sys/dev/tpm/tpm20.h @@ -100,6 +100,8 @@ __FBSDID("$FreeBSD$"); #define TPM2_START_METHOD_CRB 7 #define TPM2_START_METHOD_CRB_ACPI 8 +MALLOC_DECLARE(M_TPM20); + struct tpm_sc { device_t dev; diff --git a/sys/dev/tpm/tpm_crb.c b/sys/dev/tpm/tpm_crb.c index 5345be261d16..d45b714bffc4 100644 --- a/sys/dev/tpm/tpm_crb.c +++ b/sys/dev/tpm/tpm_crb.c @@ -155,18 +155,21 @@ tpmcrb_attach(device_t dev) crb_sc = device_get_softc(dev); sc = &crb_sc->base; handle = acpi_get_handle(dev); - sc->dev = dev; + sx_init(&sc->dev_lock, "TPM driver lock"); + sc->buf = malloc(TPM_BUFSIZE, M_TPM20, M_WAITOK); + sc->mem_rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, RF_ACTIVE); - if (sc->mem_res == NULL) + if (sc->mem_res == NULL) { + tpmcrb_detach(dev); return (ENXIO); + } if(!tpmcrb_request_locality(sc, 0)) { - bus_release_resource(dev, SYS_RES_MEMORY, - sc->mem_rid, sc->mem_res); + tpmcrb_detach(dev); return (ENXIO); } diff --git a/sys/dev/tpm/tpm_tis.c b/sys/dev/tpm/tpm_tis.c index 132d238d42bd..02779f2bf2f2 100644 --- a/sys/dev/tpm/tpm_tis.c +++ b/sys/dev/tpm/tpm_tis.c @@ -82,8 +82,7 @@ static int tpmtis_detach(device_t dev); static void tpmtis_intr_handler(void *arg); -static ACPI_STATUS tpmtis_get_SIRQ_channel(ACPI_RESOURCE *res, void *arg); -static bool tpmtis_setup_intr(struct tpm_sc *sc); +static void tpmtis_setup_intr(struct tpm_sc *sc); static bool tpmtis_read_bytes(struct tpm_sc *sc, size_t count, uint8_t *buf); static bool tpmtis_write_bytes(struct tpm_sc *sc, size_t count, uint8_t *buf); @@ -126,30 +125,35 @@ tpmtis_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; + sc->transmit = tpmtis_transmit; + sc->intr_type = -1; + + sx_init(&sc->dev_lock, "TPM driver lock"); + sc->buf = malloc(TPM_BUFSIZE, M_TPM20, M_WAITOK); sc->mem_rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, RF_ACTIVE); - if (sc->mem_res == NULL) + if (sc->mem_res == NULL) { + tpmtis_detach(dev); return (ENXIO); + } sc->irq_rid = 0; sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, RF_ACTIVE | RF_SHAREABLE); - if (sc->irq_res != NULL) { - if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, - NULL, tpmtis_intr_handler, sc, &sc->intr_cookie)) - sc->interrupts = false; - else - sc->interrupts = tpmtis_setup_intr(sc); - } else { - sc->interrupts = false; + if (sc->irq_res == NULL) + goto skip_irq; + + result = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, tpmtis_intr_handler, sc, &sc->intr_cookie); + if (result != 0) { + bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq_res); + goto skip_irq; } + tpmtis_setup_intr(sc); - sc->intr_type = -1; - - sc->transmit = tpmtis_transmit; - +skip_irq: result = tpm20_init(sc); if (result != 0) tpmtis_detach(dev); @@ -179,55 +183,63 @@ tpmtis_detach(device_t dev) return (0); } -static ACPI_STATUS -tpmtis_get_SIRQ_channel(ACPI_RESOURCE *res, void *arg) +/* + * Test if the advertisted interrupt actually works. + * This sends a simple command. (GetRandom) + * Interrupts are then enabled in the handler. + */ +static void +tpmtis_test_intr(struct tpm_sc *sc) { - struct tpm_sc *sc; - uint8_t channel; - - sc = (struct tpm_sc *)arg; - - switch (res->Type) { - case ACPI_RESOURCE_TYPE_IRQ: - channel = res->Data.Irq.Interrupts[0]; - break; - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - channel = res->Data.ExtendedIrq.Interrupts[0]; - break; - default: - return (AE_OK); - } - - WR1(sc, TPM_INT_VECTOR, channel); - return (AE_OK); + uint8_t cmd[] = { + 0x80, 0x01, /* TPM_ST_NO_SESSIONS tag*/ + 0x00, 0x00, 0x00, 0x0c, /* cmd length */ + 0x00, 0x00, 0x01, 0x7b, /* cmd TPM_CC_GetRandom */ + 0x00, 0x01 /* number of bytes requested */ + }; + + sx_xlock(&sc->dev_lock); + memcpy(sc->buf, cmd, sizeof(cmd)); + tpmtis_transmit(sc, sizeof(cmd)); + sc->pending_data_length = 0; + sx_xunlock(&sc->dev_lock); } -static bool +static void tpmtis_setup_intr(struct tpm_sc *sc) { - ACPI_STATUS status; - ACPI_HANDLE handle; - uint32_t irq_mask; + uint32_t reg; + uint8_t irq; + + irq = bus_get_resource_start(sc->dev, SYS_RES_IRQ, sc->irq_rid); - handle = acpi_get_handle(sc->dev); + /* + * SIRQ has to be between 1 - 15. + * I found a system with ACPI table that reported a value of 0x2d. + * An attempt to use such value resulted in an interrupt storm. + */ + if (irq == 0 || irq > 0xF) + return; if(!tpmtis_request_locality(sc, 0)) - return (false); + sc->interrupts = false; + + WR1(sc, TPM_INT_VECTOR, irq); + + /* Clear all pending interrupts. */ + reg = RD4(sc, TPM_INT_STS); + WR4(sc, TPM_INT_STS, reg); - irq_mask = RD4(sc, TPM_INT_ENABLE); - irq_mask |= TPM_INT_ENABLE_GLOBAL_ENABLE | + reg = RD4(sc, TPM_INT_ENABLE); + reg |= TPM_INT_ENABLE_GLOBAL_ENABLE | TPM_INT_ENABLE_DATA_AVAIL | TPM_INT_ENABLE_LOC_CHANGE | TPM_INT_ENABLE_CMD_RDY | TPM_INT_ENABLE_STS_VALID; - WR4(sc, TPM_INT_ENABLE, irq_mask); - - status = AcpiWalkResources(handle, "_CRS", - tpmtis_get_SIRQ_channel, (void *)sc); + WR4(sc, TPM_INT_ENABLE, reg); tpmtis_relinquish_locality(sc); - - return (ACPI_SUCCESS(status)); + tpmtis_test_intr(sc); } static void @@ -240,8 +252,13 @@ tpmtis_intr_handler(void *arg) status = RD4(sc, TPM_INT_STS); WR4(sc, TPM_INT_STS, status); - if (sc->intr_type != -1 && sc->intr_type & status) - wakeup(sc); + + /* Check for stray interrupts. */ + if (sc->intr_type == -1 || (sc->intr_type & status) == 0) + return; + + sc->interrupts = true; + wakeup(sc); } static bool From owner-dev-commits-src-main@freebsd.org Mon Aug 16 06:08:18 2021 Return-Path: Delivered-To: dev-commits-src-main@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 CC81366D165; Mon, 16 Aug 2021 06:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gp3cf4xQ1z3GTW; Mon, 16 Aug 2021 06:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82E6524050; Mon, 16 Aug 2021 06:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17G68IfS029084; Mon, 16 Aug 2021 06:08:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17G68IJk029083; Mon, 16 Aug 2021 06:08:18 GMT (envelope-from git) Date: Mon, 16 Aug 2021 06:08:18 GMT Message-Id: <202108160608.17G68IJk029083@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 239aebee61b8 - main - domain: give domains a chance to probe for availability MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 239aebee61b85d9a050d09a37fce2c2df8f36fc1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 06:08:18 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=239aebee61b85d9a050d09a37fce2c2df8f36fc1 commit 239aebee61b85d9a050d09a37fce2c2df8f36fc1 Author: Kyle Evans AuthorDate: 2020-06-26 02:17:47 +0000 Commit: Kyle Evans CommitDate: 2021-08-16 05:59:56 +0000 domain: give domains a chance to probe for availability This gives any given domain a chance to indicate that it's not actually supported on the current system. If dom_probe isn't supplied, we assume the domain is universally applicable as most of them are. Keeping fully-initialized and registered domains around that physically can't work on a large majority of FreeBSD deployments is sub-optimal and leads to errors that aren't consistent with the reality of why the socket can't be created (e.g. ESOCKTNOSUPPORT) because such scenario has to be caught upon pru_attach, at which point kicking back the more-appropriate EAFNOSUPPORT would seem weird. The initial consumer of this will be hvsock, which is only available on HyperV guests. Reviewed by: cem (earlier version), bcr (manpages) Differential Revision: https://reviews.freebsd.org/D25062 --- share/man/man9/Makefile | 1 + share/man/man9/domain.9 | 32 +++++++++++++++++++++++++++++--- sys/kern/uipc_domain.c | 9 +++++++++ sys/sys/domain.h | 5 +++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 47c642319049..d7d26419b042 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1011,6 +1011,7 @@ MLINKS+=dnv.9 dnvlist.9 \ dnv.9 dnvlist_take_string.9 MLINKS+=domain.9 DOMAIN_SET.9 \ domain.9 domain_add.9 \ + domain.9 domain_init.9 \ domain.9 pfctlinput.9 \ domain.9 pffinddomain.9 \ domain.9 pffindproto.9 \ diff --git a/share/man/man9/domain.9 b/share/man/man9/domain.9 index e8f97253a1d4..03e83edfc14b 100644 --- a/share/man/man9/domain.9 +++ b/share/man/man9/domain.9 @@ -31,6 +31,7 @@ .Os .Sh NAME .Nm domain_add , +.Nm domain_init , .Nm pfctlinput , .Nm pffinddomain , .Nm pffindproto , @@ -45,6 +46,8 @@ .Ft void .Fn domain_add "void *data" .Ft void +.Fn domain_init "void *data" +.Ft void .Fn pfctlinput "int cmd" "struct sockaddr *sa" .Ft struct domain * .Fn pffinddomain "int family" @@ -65,8 +68,10 @@ and struct domain { int dom_family; /* AF_xxx */ char *dom_name; + int dom_flags; void (*dom_init) /* initialize domain data structures */ (void); + int (*dom_probe)(void); /* check for support (optional) */ void (*dom_destroy) /* cleanup structures / state */ (void); int (*dom_externalize) /* externalize access rights */ @@ -143,15 +148,36 @@ is not called directly, instead .Fn DOMAIN_SET is used. .Pp -If the new domain has defined an initialization routine, it is called by -.Fn domain_add ; +If the new domain has defined a probe routine, it is called first in +.Fn domain_add +to determine if the domain should be supported on the current system. +If the probe routine returns a non-0 value, then the domain will not be +marked as supported. +Unsupported domains do not proceed with the initialization process and are not +discoverable by +.Fn pffinddomain , +.Fn pffindtype , +or +.Fn pffindproto . +.Pp +.Fn domain_init +is called after +.Fn domain_add +during boot and for each +.Xr vnet 9 . +If the new domain has defined an initialization routine, it is called during +.Fn domain_init ; as well, each of the protocols within the domain that have defined an initialization routine will have theirs called. +Note that domain initialization cannot fail at this time. .Pp -Once a domain is added it cannot be unloaded. +Once a domain is added it cannot be completely unloaded. This is because there is no reference counting system in place to determine if there are any active references from sockets within that domain. +If the domain defines a +.Fn dom_destroy +routine, then it will be invoked during vnet teardown. .Pp .Fn pffinddomain finds a domain by family. diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 60e30eb1ae00..50d6c0a9d9f8 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -172,7 +172,11 @@ domain_init(void *arg) { struct domain *dp = arg; struct protosw *pr; + int flags; + flags = atomic_load_acq_int(&dp->dom_flags); + if ((flags & DOMF_SUPPORTED) == 0) + return; if (dp->dom_init) (*dp->dom_init)(); for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) @@ -200,6 +204,8 @@ vnet_domain_uninit(void *arg) { struct domain *dp = arg; + if ((atomic_load_acq_int(&dp->dom_flags) & DOMF_SUPPORTED) == 0) + return; if (dp->dom_destroy) (*dp->dom_destroy)(); } @@ -216,6 +222,9 @@ domain_add(void *data) struct domain *dp; dp = (struct domain *)data; + if (dp->dom_probe != NULL && (*dp->dom_probe)() != 0) + return; + atomic_set_rel_int(&dp->dom_flags, DOMF_SUPPORTED); mtx_lock(&dom_mtx); dp->dom_next = domains; domains = dp; diff --git a/sys/sys/domain.h b/sys/sys/domain.h index 3d17879f1ccd..a59f4e230a1d 100644 --- a/sys/sys/domain.h +++ b/sys/sys/domain.h @@ -50,8 +50,10 @@ struct rib_head; struct domain { int dom_family; /* AF_xxx */ char *dom_name; + int dom_flags; void (*dom_init) /* initialize domain data structures */ (void); + int (*dom_probe)(void); /* check for support (optional) */ void (*dom_destroy) /* cleanup structures / state */ (void); int (*dom_externalize) /* externalize access rights */ @@ -70,6 +72,9 @@ struct domain { /* af-dependent data on ifnet */ }; +/* dom_flags */ +#define DOMF_SUPPORTED 0x0001 /* System supports this domain. */ + #ifdef _KERNEL extern int domain_init_status; extern struct domain *domains; From owner-dev-commits-src-main@freebsd.org Mon Aug 16 06:08:19 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D454E66D9EE; Mon, 16 Aug 2021 06:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gp3cg53GJz3GM3; Mon, 16 Aug 2021 06:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EDD624417; Mon, 16 Aug 2021 06:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17G68JBH029108; Mon, 16 Aug 2021 06:08:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17G68J2o029107; Mon, 16 Aug 2021 06:08:19 GMT (envelope-from git) Date: Mon, 16 Aug 2021 06:08:19 GMT Message-Id: <202108160608.17G68J2o029107@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 625932c9aa2c - main - hvsock: fail the probe on non-HyperV machines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 625932c9aa2c9fc0d2fb7b10b838f40ca7d808fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 06:08:19 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=625932c9aa2c9fc0d2fb7b10b838f40ca7d808fc commit 625932c9aa2c9fc0d2fb7b10b838f40ca7d808fc Author: Kyle Evans AuthorDate: 2021-08-04 20:57:55 +0000 Commit: Kyle Evans CommitDate: 2021-08-16 05:59:56 +0000 hvsock: fail the probe on non-HyperV machines Differential Revision: https://reviews.freebsd.org/D25459 --- sys/dev/hyperv/hvsock/hv_sock.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/sys/dev/hyperv/hvsock/hv_sock.c b/sys/dev/hyperv/hvsock/hv_sock.c index 00e296fcd335..a920d1850c7d 100644 --- a/sys/dev/hyperv/hvsock/hv_sock.c +++ b/sys/dev/hyperv/hvsock/hv_sock.c @@ -74,6 +74,8 @@ SYSCTL_INT(_net_hvsock, OID_AUTO, hvs_dbg_level, CTLFLAG_RWTUN, &hvs_dbg_level, MALLOC_DEFINE(M_HVSOCK, "hyperv_socket", "hyperv socket control structures"); +static int hvs_dom_probe(void); + /* The MTU is 16KB per host side's design */ #define HVSOCK_MTU_SIZE (1024 * 16) #define HVSOCK_SEND_BUF_SZ (PAGE_SIZE - sizeof(struct vmpipe_proto_header)) @@ -124,6 +126,7 @@ static struct protosw hv_socket_protosw[] = { static struct domain hv_socket_domain = { .dom_family = AF_HYPERV, .dom_name = "hyperv", + .dom_probe = hvs_dom_probe, .dom_protosw = hv_socket_protosw, .dom_protoswNPROTOSW = &hv_socket_protosw[nitems(hv_socket_protosw)] }; @@ -323,6 +326,16 @@ hvs_trans_unlock(void) sx_xunlock(&hvs_trans_socks_sx); } +static int +hvs_dom_probe(void) +{ + + /* Don't even give us a chance to attach on non-HyperV. */ + if (vm_guest != VM_GUEST_HV) + return (ENXIO); + return (0); +} + void hvs_trans_init(void) { @@ -330,9 +343,6 @@ hvs_trans_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; - if (vm_guest != VM_GUEST_HV) - return; - HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: HyperV Socket hvs_trans_init called\n", __func__); @@ -355,9 +365,6 @@ hvs_trans_attach(struct socket *so, int proto, struct thread *td) { struct hvs_pcb *pcb = so2hvspcb(so); - if (vm_guest != VM_GUEST_HV) - return (ESOCKTNOSUPPORT); - HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: HyperV Socket hvs_trans_attach called\n", __func__); @@ -384,9 +391,6 @@ hvs_trans_detach(struct socket *so) { struct hvs_pcb *pcb; - if (vm_guest != VM_GUEST_HV) - return; - HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: HyperV Socket hvs_trans_detach called\n", __func__); @@ -604,9 +608,6 @@ hvs_trans_disconnect(struct socket *so) { struct hvs_pcb *pcb; - if (vm_guest != VM_GUEST_HV) - return (ESOCKTNOSUPPORT); - HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: HyperV Socket hvs_trans_disconnect called\n", __func__); @@ -934,9 +935,6 @@ hvs_trans_close(struct socket *so) { struct hvs_pcb *pcb; - if (vm_guest != VM_GUEST_HV) - return; - HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: HyperV Socket hvs_trans_close called\n", __func__); @@ -978,9 +976,6 @@ hvs_trans_abort(struct socket *so) { struct hvs_pcb *pcb = so2hvspcb(so); - if (vm_guest != VM_GUEST_HV) - return; - HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: HyperV Socket hvs_trans_abort called\n", __func__); From owner-dev-commits-src-main@freebsd.org Mon Aug 16 06:08:20 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E177366D9EF; Mon, 16 Aug 2021 06:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gp3ch5tXTz3GfN; Mon, 16 Aug 2021 06:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B188324259; Mon, 16 Aug 2021 06:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17G68K29029132; Mon, 16 Aug 2021 06:08:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17G68KXm029131; Mon, 16 Aug 2021 06:08:20 GMT (envelope-from git) Date: Mon, 16 Aug 2021 06:08:20 GMT Message-Id: <202108160608.17G68KXm029131@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 29e400e994ea - main - domain: make it safer to add domains post-domainfinalize MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29e400e994ea19cb90736ceeb67dff716671ff25 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 06:08:21 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=29e400e994ea19cb90736ceeb67dff716671ff25 commit 29e400e994ea19cb90736ceeb67dff716671ff25 Author: Kyle Evans AuthorDate: 2020-06-26 02:38:27 +0000 Commit: Kyle Evans CommitDate: 2021-08-16 05:59:56 +0000 domain: make it safer to add domains post-domainfinalize I can see two concerns for adding domains after domainfinalize: 1.) The slow/fast callouts have already been setup. 2.) Userland could create a socket while we're in the middle of initialization. We can address #1 fairly easily by tracking whether the domain's been initialized for at least the default vnet. There are still some concerns about the callbacks being invoked while a vnet is in the process of being created/destroyed, but this is a pre-existing issue that the callbacks must coordinate anyways. We should also address #2, but technically this has been an issue anyways because we don't assert on post-domainfinalize additions; we don't seem to hit it in practice. Future work can fix that up to make sure we don't find partially constructed domains, but care must be taken to make sure that at least, e.g., the usages of pffindproto in ip_input.c can still find them. Differential Revision: https://reviews.freebsd.org/D25459 --- sys/kern/uipc_domain.c | 27 ++++++++++++++++----------- sys/sys/domain.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 50d6c0a9d9f8..b6aefec9556a 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include /* @@ -177,6 +179,8 @@ domain_init(void *arg) flags = atomic_load_acq_int(&dp->dom_flags); if ((flags & DOMF_SUPPORTED) == 0) return; + KASSERT((flags & DOMF_INITED) == 0 || !IS_DEFAULT_VNET(curvnet), + ("Premature initialization of domain in non-default vnet")); if (dp->dom_init) (*dp->dom_init)(); for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) @@ -188,6 +192,8 @@ domain_init(void *arg) max_datalen = MHLEN - max_hdr; if (max_datalen < 1) panic("%s: max_datalen < 1", __func__); + if (IS_DEFAULT_VNET(curvnet)) + atomic_set_rel_int(&dp->dom_flags, DOMF_INITED); } #ifdef VIMAGE @@ -236,15 +242,6 @@ domain_add(void *data) if (domain_init_status < 1) printf("WARNING: attempt to domain_add(%s) before " "domaininit()\n", dp->dom_name); -#endif -#ifdef notyet - KASSERT(domain_init_status < 2, - ("attempt to domain_add(%s) after domainfinalize()", - dp->dom_name)); -#else - if (domain_init_status >= 2) - printf("WARNING: attempt to domain_add(%s) after " - "domainfinalize()\n", dp->dom_name); #endif mtx_unlock(&dom_mtx); } @@ -491,10 +488,14 @@ pfslowtimo(void *arg) struct protosw *pr; NET_EPOCH_ENTER(et); - for (dp = domains; dp; dp = dp->dom_next) + for (dp = domains; dp; dp = dp->dom_next) { + if ((atomic_load_int(&dp->dom_flags) & DOMF_INITED) == 0) + continue; + atomic_thread_fence_acq(); for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_slowtimo) (*pr->pr_slowtimo)(); + } NET_EPOCH_EXIT(et); callout_reset(&pfslow_callout, hz/2, pfslowtimo, NULL); } @@ -507,10 +508,14 @@ pffasttimo(void *arg) struct protosw *pr; NET_EPOCH_ENTER(et); - for (dp = domains; dp; dp = dp->dom_next) + for (dp = domains; dp; dp = dp->dom_next) { + if ((atomic_load_int(&dp->dom_flags) & DOMF_INITED) == 0) + continue; + atomic_thread_fence_acq(); for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_fasttimo) (*pr->pr_fasttimo)(); + } NET_EPOCH_EXIT(et); callout_reset(&pffast_callout, hz/5, pffasttimo, NULL); } diff --git a/sys/sys/domain.h b/sys/sys/domain.h index a59f4e230a1d..dc09c9786443 100644 --- a/sys/sys/domain.h +++ b/sys/sys/domain.h @@ -74,6 +74,7 @@ struct domain { /* dom_flags */ #define DOMF_SUPPORTED 0x0001 /* System supports this domain. */ +#define DOMF_INITED 0x0002 /* Initialized in the default vnet. */ #ifdef _KERNEL extern int domain_init_status; From owner-dev-commits-src-main@freebsd.org Mon Aug 16 09:36:36 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8EE43670F5D; Mon, 16 Aug 2021 09:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gp8F03bnSz3l4d; Mon, 16 Aug 2021 09:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6423D2730F; Mon, 16 Aug 2021 09:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17G9aa5Q011045; Mon, 16 Aug 2021 09:36:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17G9aajD011044; Mon, 16 Aug 2021 09:36:36 GMT (envelope-from git) Date: Mon, 16 Aug 2021 09:36:36 GMT Message-Id: <202108160936.17G9aajD011044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: cc1345056b11 - main - Add missing lex/yacc dependency for mkesdb/mkcsmapper bootstrap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc1345056b113d57f0c65b0ecf3e3d5da3f34276 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 09:36:36 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=cc1345056b113d57f0c65b0ecf3e3d5da3f34276 commit cc1345056b113d57f0c65b0ecf3e3d5da3f34276 Author: Alex Richardson AuthorDate: 2021-08-16 08:56:17 +0000 Commit: Alex Richardson CommitDate: 2021-08-16 08:57:33 +0000 Add missing lex/yacc dependency for mkesdb/mkcsmapper bootstrap This causes build failures on macOS where the build can end up invoking an incompatible m4 binary. Fxies: 2de949cf85d0 ("Remove mkcsmapper_static and mkesdb_static from build-tools") --- Makefile.inc1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 2c1f72085110..2b631c2311f0 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2361,6 +2361,8 @@ ${_bt}-usr.bin/localedef: ${_bt}-usr.bin/yacc ${_bt_lex_depend} .if ${MK_ICONV} != "no" _mkesdb= usr.bin/mkesdb _mkcsmapper= usr.bin/mkcsmapper +${_bt}-usr.bin/mkesdb: ${_bt}-usr.bin/yacc ${_bt_lex_depend} +${_bt}-usr.bin/mkcsmapper: ${_bt}-usr.bin/yacc ${_bt_lex_depend} .endif .if ${MK_KERBEROS} != "no" From owner-dev-commits-src-main@freebsd.org Mon Aug 16 10:56:14 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EDAD467220C; Mon, 16 Aug 2021 10:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpB0t6JWwz3nYH; Mon, 16 Aug 2021 10:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC1A91BE; Mon, 16 Aug 2021 10:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GAuECl017025; Mon, 16 Aug 2021 10:56:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GAuEsk017024; Mon, 16 Aug 2021 10:56:14 GMT (envelope-from git) Date: Mon, 16 Aug 2021 10:56:14 GMT Message-Id: <202108161056.17GAuEsk017024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e6c769620316 - main - rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6c76962031625d51fe4225ecfa15c85155eb13a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 10:56:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e6c76962031625d51fe4225ecfa15c85155eb13a commit e6c76962031625d51fe4225ecfa15c85155eb13a Author: Fangrui Song AuthorDate: 2021-08-14 16:56:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-16 10:55:34 +0000 rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0 For a Variant II architecture, the TP offset of a TLS symbol is st_value - tlsoffset + r_addend. tlsoffset is computed by either calculate_tls_offset or calculate_first_tls_offset. The return value of calculate_first_tls_offset is the smallest integer satisfying res >= size and (-res) % p_align = p_vaddr % p_align (= p_offset % p_align). (The formula is a bit contrived. The basic idea is to subtract the minimum integer from size + align - 1 so that the result ihas the expected remainder.) Reviewed by: kib MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31538 Differential revision: https://reviews.freebsd.org/D31541 --- libexec/rtld-elf/amd64/reloc.c | 27 ++++++++++++--------------- libexec/rtld-elf/i386/reloc.c | 27 ++++++++++++--------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c index 689b0d8635d4..508ae04a7448 100644 --- a/libexec/rtld-elf/amd64/reloc.c +++ b/libexec/rtld-elf/amd64/reloc.c @@ -548,29 +548,26 @@ __tls_get_addr(tls_index *ti) } size_t -calculate_first_tls_offset(size_t size, size_t align, size_t offset) +calculate_tls_offset(size_t prev_offset, size_t prev_size __unused, + size_t size, size_t align, size_t offset) { size_t res; - res = roundup(size, align); - offset &= align - 1; - if (offset != 0) - res += align - offset; - return (res); + /* + * res is the smallest integer satisfying res - prev_offset >= size + * and (-res) % p_align = p_vaddr % p_align (= p_offset % p_align). + */ + res = prev_offset + size + align - 1; + res -= (res + offset) & (align - 1); + return (res); } size_t -calculate_tls_offset(size_t prev_offset, size_t prev_size __unused, size_t size, - size_t align, size_t offset) +calculate_first_tls_offset(size_t size, size_t align, size_t offset) { - size_t res; - - res = roundup(prev_offset + size, align); - offset &= align - 1; - if (offset != 0) - res += align - offset; - return (res); + return (calculate_tls_offset(0, 0, size, align, offset)); } + size_t calculate_tls_end(size_t off, size_t size __unused) { diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index cab163b35e6a..69da93347bbb 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -539,29 +539,26 @@ __tls_get_addr(tls_index *ti) } size_t -calculate_first_tls_offset(size_t size, size_t align, size_t offset) +calculate_tls_offset(size_t prev_offset, size_t prev_size __unused, + size_t size, size_t align, size_t offset) { size_t res; - res = roundup(size, align); - offset &= align - 1; - if (offset != 0) - res += align - offset; - return (res); + /* + * res is the smallest integer satisfying res - prev_offset >= size + * and (-res) % p_align = p_vaddr % p_align (= p_offset % p_align). + */ + res = prev_offset + size + align - 1; + res -= (res + offset) & (align - 1); + return (res); } size_t -calculate_tls_offset(size_t prev_offset, size_t prev_size __unused, size_t size, - size_t align, size_t offset) +calculate_first_tls_offset(size_t size, size_t align, size_t offset) { - size_t res; - - res = roundup(prev_offset + size, align); - offset &= align - 1; - if (offset != 0) - res += align - offset; - return (res); + return (calculate_tls_offset(0, 0, size, align, offset)); } + size_t calculate_tls_end(size_t off, size_t size __unused) { From owner-dev-commits-src-main@freebsd.org Mon Aug 16 10:56:16 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0FD3567194B; Mon, 16 Aug 2021 10:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpB0v6xsMz3nqR; Mon, 16 Aug 2021 10:56:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D662F23B; Mon, 16 Aug 2021 10:56:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GAuFfN017049; Mon, 16 Aug 2021 10:56:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GAuFNC017048; Mon, 16 Aug 2021 10:56:15 GMT (envelope-from git) Date: Mon, 16 Aug 2021 10:56:15 GMT Message-Id: <202108161056.17GAuFNC017048@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 8f63fa78e84a - main - rtld: Remove calculate_tls_end MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8f63fa78e84afd23fa68c82eabfe64763c92d4f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 10:56:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8f63fa78e84afd23fa68c82eabfe64763c92d4f5 commit 8f63fa78e84afd23fa68c82eabfe64763c92d4f5 Author: Fangrui Song AuthorDate: 2021-08-14 17:02:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-16 10:55:35 +0000 rtld: Remove calculate_tls_end Variant I architectures use off and Variant II ones use size + off. Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libc handles it. Reviewed by: kib MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31539 Differential revision: https://reviews.freebsd.org/D31541 --- lib/libc/gen/tls.c | 8 -------- libexec/rtld-elf/aarch64/rtld_machdep.h | 2 +- libexec/rtld-elf/amd64/reloc.c | 6 ------ libexec/rtld-elf/amd64/rtld_machdep.h | 2 +- libexec/rtld-elf/arm/rtld_machdep.h | 2 +- libexec/rtld-elf/i386/reloc.c | 6 ------ libexec/rtld-elf/i386/rtld_machdep.h | 2 +- libexec/rtld-elf/mips/rtld_machdep.h | 2 +- libexec/rtld-elf/powerpc/rtld_machdep.h | 2 +- libexec/rtld-elf/powerpc64/rtld_machdep.h | 2 +- libexec/rtld-elf/riscv/rtld_machdep.h | 2 +- libexec/rtld-elf/rtld.c | 25 ++++++++++++++++--------- 12 files changed, 24 insertions(+), 37 deletions(-) diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 98915ef4ddf7..b5f5dfd4d315 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -81,14 +81,6 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); #error TLS_TCB_ALIGN undefined for target architecture #endif -#if defined(__aarch64__) || defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__riscv) -#define TLS_VARIANT_I -#endif -#if defined(__i386__) || defined(__amd64__) -#define TLS_VARIANT_II -#endif - #if defined(__mips__) || defined(__powerpc__) || defined(__riscv) #define DTV_OFFSET 0x8000 #else diff --git a/libexec/rtld-elf/aarch64/rtld_machdep.h b/libexec/rtld-elf/aarch64/rtld_machdep.h index bdd5620867ba..585689afe197 100644 --- a/libexec/rtld-elf/aarch64/rtld_machdep.h +++ b/libexec/rtld-elf/aarch64/rtld_machdep.h @@ -76,7 +76,6 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, round(16, align) #define calculate_tls_offset(prev_offset, prev_size, size, align, offset) \ round(prev_offset + prev_size, align) -#define calculate_tls_end(off, size) ((off) + (size)) #define calculate_tls_post_size(align) \ round(TLS_TCB_SIZE, align) - TLS_TCB_SIZE @@ -93,6 +92,7 @@ extern void *__tls_get_addr(tls_index *ti); #define md_abi_variant_hook(x) +#define TLS_VARIANT_I 1 #define TLS_DTV_OFFSET 0 #endif diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c index 508ae04a7448..1fec863c063b 100644 --- a/libexec/rtld-elf/amd64/reloc.c +++ b/libexec/rtld-elf/amd64/reloc.c @@ -567,9 +567,3 @@ calculate_first_tls_offset(size_t size, size_t align, size_t offset) { return (calculate_tls_offset(0, 0, size, align, offset)); } - -size_t -calculate_tls_end(size_t off, size_t size __unused) -{ - return (off); -} diff --git a/libexec/rtld-elf/amd64/rtld_machdep.h b/libexec/rtld-elf/amd64/rtld_machdep.h index 30c82dcb0625..baa926445006 100644 --- a/libexec/rtld-elf/amd64/rtld_machdep.h +++ b/libexec/rtld-elf/amd64/rtld_machdep.h @@ -73,10 +73,10 @@ void *__tls_get_addr(tls_index *ti) __exported; #define md_abi_variant_hook(x) +#define TLS_VARIANT_II 1 #define TLS_DTV_OFFSET 0 size_t calculate_first_tls_offset(size_t size, size_t align, size_t offset); size_t calculate_tls_offset(size_t prev_offset, size_t prev_size, size_t size, size_t align, size_t offset); -size_t calculate_tls_end(size_t off, size_t size); #endif diff --git a/libexec/rtld-elf/arm/rtld_machdep.h b/libexec/rtld-elf/arm/rtld_machdep.h index b333b1f153eb..d890cb377fa3 100644 --- a/libexec/rtld-elf/arm/rtld_machdep.h +++ b/libexec/rtld-elf/arm/rtld_machdep.h @@ -68,7 +68,6 @@ typedef struct { round(8, align) #define calculate_tls_offset(prev_offset, prev_size, size, align, offset) \ round(prev_offset + prev_size, align) -#define calculate_tls_end(off, size) ((off) + (size)) #define calculate_tls_post_size(align) \ round(TLS_TCB_SIZE, align) - TLS_TCB_SIZE @@ -86,6 +85,7 @@ extern void arm_abi_variant_hook(Elf_Auxinfo **); #define md_abi_variant_hook(x) #endif +#define TLS_VARIANT_I 1 #define TLS_DTV_OFFSET 0 #endif diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index 69da93347bbb..603a93a2338c 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -558,9 +558,3 @@ calculate_first_tls_offset(size_t size, size_t align, size_t offset) { return (calculate_tls_offset(0, 0, size, align, offset)); } - -size_t -calculate_tls_end(size_t off, size_t size __unused) -{ - return (off); -} diff --git a/libexec/rtld-elf/i386/rtld_machdep.h b/libexec/rtld-elf/i386/rtld_machdep.h index 78154a1992d4..33e7d95f966d 100644 --- a/libexec/rtld-elf/i386/rtld_machdep.h +++ b/libexec/rtld-elf/i386/rtld_machdep.h @@ -74,10 +74,10 @@ void *__tls_get_addr(tls_index *ti) __exported; #define md_abi_variant_hook(x) +#define TLS_VARIANT_II 1 #define TLS_DTV_OFFSET 0 size_t calculate_first_tls_offset(size_t size, size_t align, size_t offset); size_t calculate_tls_offset(size_t prev_offset, size_t prev_size, size_t size, size_t align, size_t offset); -size_t calculate_tls_end(size_t off, size_t size); #endif diff --git a/libexec/rtld-elf/mips/rtld_machdep.h b/libexec/rtld-elf/mips/rtld_machdep.h index 041a5d05f9a7..0cb56290152e 100644 --- a/libexec/rtld-elf/mips/rtld_machdep.h +++ b/libexec/rtld-elf/mips/rtld_machdep.h @@ -68,7 +68,6 @@ typedef struct { TLS_TCB_SIZE #define calculate_tls_offset(prev_offset, prev_size, size, align, offset) \ round(prev_offset + prev_size, align) -#define calculate_tls_end(off, size) ((off) + (size)) #define calculate_tls_post_size(align) 0 extern void *__tls_get_addr(tls_index *ti); @@ -78,6 +77,7 @@ extern void *__tls_get_addr(tls_index *ti); #define md_abi_variant_hook(x) +#define TLS_VARIANT_I 1 #define TLS_DTV_OFFSET 0 #endif diff --git a/libexec/rtld-elf/powerpc/rtld_machdep.h b/libexec/rtld-elf/powerpc/rtld_machdep.h index a35ac1f4ebf5..c98dc7d3acb5 100644 --- a/libexec/rtld-elf/powerpc/rtld_machdep.h +++ b/libexec/rtld-elf/powerpc/rtld_machdep.h @@ -73,6 +73,7 @@ void _rtld_powerpc_pltcall(void); * TLS */ +#define TLS_VARIANT_I 1 #define TLS_TP_OFFSET 0x7000 #define TLS_DTV_OFFSET 0x8000 #define TLS_TCB_SIZE 8 @@ -83,7 +84,6 @@ void _rtld_powerpc_pltcall(void); TLS_TCB_SIZE #define calculate_tls_offset(prev_offset, prev_size, size, align, offset) \ round(prev_offset + prev_size, align) -#define calculate_tls_end(off, size) ((off) + (size)) #define calculate_tls_post_size(align) 0 typedef struct { diff --git a/libexec/rtld-elf/powerpc64/rtld_machdep.h b/libexec/rtld-elf/powerpc64/rtld_machdep.h index 486f4ffe95bc..98bdbb33affe 100644 --- a/libexec/rtld-elf/powerpc64/rtld_machdep.h +++ b/libexec/rtld-elf/powerpc64/rtld_machdep.h @@ -65,6 +65,7 @@ extern u_long cpu_features2; /* r4 */ * TLS */ +#define TLS_VARIANT_I 1 #define TLS_TP_OFFSET 0x7000 #define TLS_DTV_OFFSET 0x8000 #define TLS_TCB_SIZE 16 @@ -75,7 +76,6 @@ extern u_long cpu_features2; /* r4 */ TLS_TCB_SIZE #define calculate_tls_offset(prev_offset, prev_size, size, align, offset) \ round(prev_offset + prev_size, align) -#define calculate_tls_end(off, size) ((off) + (size)) #define calculate_tls_post_size(align) 0 typedef struct { diff --git a/libexec/rtld-elf/riscv/rtld_machdep.h b/libexec/rtld-elf/riscv/rtld_machdep.h index 43349b4ab403..7a087ca2ab7c 100644 --- a/libexec/rtld-elf/riscv/rtld_machdep.h +++ b/libexec/rtld-elf/riscv/rtld_machdep.h @@ -82,6 +82,7 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, /* * TLS */ +#define TLS_VARIANT_I 1 #define TLS_TP_OFFSET 0x0 #define TLS_DTV_OFFSET 0x800 #define TLS_TCB_SIZE 16 @@ -92,7 +93,6 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, TLS_TCB_SIZE #define calculate_tls_offset(prev_offset, prev_size, size, align, offset) \ round(prev_offset + prev_size, align) -#define calculate_tls_end(off, size) ((off) + (size)) #define calculate_tls_post_size(align) 0 typedef struct { diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index eaad89339d07..23482e07fc5f 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -4939,8 +4939,7 @@ tls_get_addr_common(Elf_Addr **dtvp, int index, size_t offset) return (tls_get_addr_slow(dtvp, index, offset, false)); } -#if defined(__aarch64__) || defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__riscv) +#ifdef TLS_VARIANT_I /* * Return pointer to allocated TLS block @@ -5071,9 +5070,9 @@ free_tls(void *tcb, size_t tcbsize, size_t tcbalign __unused) free_aligned(get_tls_block_ptr(tcb, tcbsize)); } -#endif +#endif /* TLS_VARIANT_I */ -#if defined(__i386__) || defined(__amd64__) +#ifdef TLS_VARIANT_II /* * Allocate Static TLS using the Variant II method. @@ -5179,7 +5178,7 @@ free_tls(void *tls, size_t tcbsize __unused, size_t tcbalign) free((void*) dtv); } -#endif +#endif /* TLS_VARIANT_II */ /* * Allocate TLS block for module with given index. @@ -5227,6 +5226,11 @@ allocate_tls_offset(Obj_Entry *obj) off = calculate_tls_offset(tls_last_offset, tls_last_size, obj->tlssize, obj->tlsalign, obj->tlspoffset); + obj->tlsoffset = off; +#ifdef TLS_VARIANT_I + off += obj->tlssize; +#endif + /* * If we have already fixed the size of the static TLS block, we * must stay within that size. When allocating the static TLS, we @@ -5234,13 +5238,13 @@ allocate_tls_offset(Obj_Entry *obj) * loading modules which use static TLS. */ if (tls_static_space != 0) { - if (calculate_tls_end(off, obj->tlssize) > tls_static_space) + if (off > tls_static_space) return false; } else if (obj->tlsalign > tls_static_max_align) { tls_static_max_align = obj->tlsalign; } - tls_last_offset = obj->tlsoffset = off; + tls_last_offset = off; tls_last_size = obj->tlssize; obj->tls_done = true; @@ -5257,8 +5261,11 @@ free_tls_offset(Obj_Entry *obj) * simplistic workaround to allow libGL.so.1 to be loaded and * unloaded multiple times. */ - if (calculate_tls_end(obj->tlsoffset, obj->tlssize) - == calculate_tls_end(tls_last_offset, tls_last_size)) { + size_t off = obj->tlsoffset; +#ifdef TLS_VARIANT_I + off += obj->tlssize; +#endif + if (off == tls_last_offset) { tls_last_offset -= obj->tlssize; tls_last_size = 0; } From owner-dev-commits-src-main@freebsd.org Mon Aug 16 10:56:17 2021 Return-Path: Delivered-To: dev-commits-src-main@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 3FDB3671954; Mon, 16 Aug 2021 10:56:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpB0x0mQHz3nh2; Mon, 16 Aug 2021 10:56:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA68023C; Mon, 16 Aug 2021 10:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GAuGu0017073; Mon, 16 Aug 2021 10:56:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GAuG9B017072; Mon, 16 Aug 2021 10:56:16 GMT (envelope-from git) Date: Mon, 16 Aug 2021 10:56:16 GMT Message-Id: <202108161056.17GAuG9B017072@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 300e08933e80 - main - libc tls: use TLS_DTV_OFFSET defined by rtld.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 10:56:17 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e commit 300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e Author: Konstantin Belousov AuthorDate: 2021-08-15 02:14:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-16 10:55:35 +0000 libc tls: use TLS_DTV_OFFSET defined by rtld.h Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31541 --- lib/libc/gen/tls.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index b5f5dfd4d315..d90aac028b88 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -81,12 +81,6 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); #error TLS_TCB_ALIGN undefined for target architecture #endif -#if defined(__mips__) || defined(__powerpc__) || defined(__riscv) -#define DTV_OFFSET 0x8000 -#else -#define DTV_OFFSET 0 -#endif - #ifndef PIC static size_t libc_tls_static_space; @@ -289,7 +283,7 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) /* Adjust the DTV. */ dtv = tcb[0]; - dtv[2] = (Elf_Addr)(tls + DTV_OFFSET); + dtv[2] = (Elf_Addr)(tls + TLS_DTV_OFFSET); } else { dtv = __je_bootstrap_malloc(3 * sizeof(Elf_Addr)); if (dtv == NULL) { @@ -300,7 +294,7 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) tcb[0] = dtv; dtv[0] = 1; /* Generation. */ dtv[1] = 1; /* Segments count. */ - dtv[2] = (Elf_Addr)(tls + DTV_OFFSET); + dtv[2] = (Elf_Addr)(tls + TLS_DTV_OFFSET); if (libc_tls_init_size > 0) memcpy(tls, libc_tls_init, libc_tls_init_size); From owner-dev-commits-src-main@freebsd.org Mon Aug 16 10:56:18 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5BAF767195A; Mon, 16 Aug 2021 10:56:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpB0y1cVyz3nSh; Mon, 16 Aug 2021 10:56:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EAA123D; Mon, 16 Aug 2021 10:56:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GAuIxQ017097; Mon, 16 Aug 2021 10:56:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GAuI3q017096; Mon, 16 Aug 2021 10:56:18 GMT (envelope-from git) Date: Mon, 16 Aug 2021 10:56:18 GMT Message-Id: <202108161056.17GAuI3q017096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7da378f9de1a - main - rtld: Switch to the standard symbol lookup behavior if LD_DYNAMIC_WEAK is set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7da378f9de1a042ec0c81ba7ad39a392540d4721 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 10:56:18 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7da378f9de1a042ec0c81ba7ad39a392540d4721 commit 7da378f9de1a042ec0c81ba7ad39a392540d4721 Author: Fangrui Song AuthorDate: 2021-08-15 04:13:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-16 10:55:35 +0000 rtld: Switch to the standard symbol lookup behavior if LD_DYNAMIC_WEAK is set The current lookup prefers a strong definition to a STB_WEAK definition (similar to glibc pre-2.2 behavior) which does not conform to the ELF specification. The non-compliant behavior provoked https://reviews.llvm.org/D4418 which was intended to fix -shared-libasan but introduced new problems (and caused some sanitizer tests (e.g. test/asan/TestCases/interception_failure_test.cpp) to fail): sanitizer interceptors are STB_GLOBAL instead of STB_WEAK, so defining a second STB_GLOBAL interceptor can lead to a multiple definition linker error. For example, in a -fsanitize={address,memory,...} build, libc functions like malloc/free/strtol/... cannot be provided by user object files. See https://docs.freebsd.org/cgi/getmsg.cgi?fetch=16483939+0+archive/2014/freebsd-current/20140716.freebsd-current for discussions. This patch implements the ELF-compliant behavior when LD_DYNAMIC_WEAK is set. STB_WEAK wrestling in symbol lookups in `Search the dynamic linker itself` are untouched. Reviewed by: kib MFC after: 1 week Differential revision: https://reviews.freebsd.org/D26352 --- libexec/rtld-elf/rtld.1 | 20 +++++++++++++++++++- libexec/rtld-elf/rtld.c | 40 ++++++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 index 2d262f77aa13..8bc4cfade070 100644 --- a/libexec/rtld-elf/rtld.1 +++ b/libexec/rtld-elf/rtld.1 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2021 +.Dd August 15, 2021 .Dt RTLD 1 .Os .Sh NAME @@ -143,6 +143,24 @@ If set, .Nm will print a table containing all relocations before symbol binding and relocation. +.It Ev LD_DYNAMIC_WEAK +If set, use the ELF standard-compliant symbol lookup behavior: +resolve to the first found symbol definition. +.Pp +By default, +.Fx +provides the non-standard symbol lookup behavior: +when a weak symbol definition is found, remember the definition and +keep searching in the remaining shared objects for a non-weak definition. +If found, the non-weak definition is preferred, otherwise the remembered +weak definition is returned. +.Pp +Symbols exported by dynamic linker itself (see +.Xr dlfcn 3 ) +are always resolved using +.Fx +rules regardless of the presence of the variable. +This variable is unset for set-user-ID and set-group-ID programs. .It Ev LD_LIBMAP A library replacement list in the same format as .Xr libmap.conf 5 . diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 23482e07fc5f..61b823aaacf8 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -209,6 +209,8 @@ static bool dangerous_ld_env; /* True if environment variables have been bool ld_bind_not; /* Disable PLT update */ static char *ld_bind_now; /* Environment variable for immediate binding */ static char *ld_debug; /* Environment variable for debugging */ +static bool ld_dynamic_weak = true; /* True if non-weak definition overrides + weak definition */ static char *ld_library_path; /* Environment variable for search path */ static char *ld_library_dirs; /* Environment variable for library descriptors */ static char *ld_preload; /* Environment variable for libraries to @@ -583,7 +585,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) unsetenv(_LD("LIBMAP_DISABLE")) || unsetenv(_LD("BIND_NOT")) || unsetenv(_LD("DEBUG")) || unsetenv(_LD("ELF_HINTS_PATH")) || unsetenv(_LD("LOADFLTR")) || unsetenv(_LD("LIBRARY_PATH_RPATH")) || - unsetenv(_LD("PRELOAD_FDS"))) { + unsetenv(_LD("PRELOAD_FDS")) || unsetenv(_LD("DYNAMIC_WEAK"))) { _rtld_error("environment corrupt; aborting"); rtld_die(); } @@ -591,6 +593,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) ld_debug = getenv(_LD("DEBUG")); if (ld_bind_now == NULL) ld_bind_not = getenv(_LD("BIND_NOT")) != NULL; + ld_dynamic_weak = getenv(_LD("DYNAMIC_WEAK")) == NULL; libmap_disable = getenv(_LD("LIBMAP_DISABLE")) != NULL; libmap_override = getenv(_LD("LIBMAP")); ld_library_path = getenv(_LD("LIBRARY_PATH")); @@ -610,7 +613,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) } dangerous_ld_env = libmap_disable || (libmap_override != NULL) || (ld_library_path != NULL) || (ld_preload != NULL) || - (ld_elf_hints_path != NULL) || ld_loadfltr; + (ld_elf_hints_path != NULL) || ld_loadfltr || ld_dynamic_weak; ld_tracing = getenv(_LD("TRACE_LOADED_OBJECTS")); ld_utrace = getenv(_LD("UTRACE")); @@ -3673,11 +3676,12 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, continue; res = symlook_obj(&req, obj); if (res == 0) { - if (def == NULL || - ELF_ST_BIND(req.sym_out->st_info) != STB_WEAK) { + if (def == NULL || (ld_dynamic_weak && + ELF_ST_BIND(req.sym_out->st_info) != STB_WEAK)) { def = req.sym_out; defobj = req.defobj_out; - if (ELF_ST_BIND(def->st_info) != STB_WEAK) + if (!ld_dynamic_weak || + ELF_ST_BIND(def->st_info) != STB_WEAK) break; } } @@ -3686,6 +3690,8 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, * Search the dynamic linker itself, and possibly resolve the * symbol from there. This is how the application links to * dynamic linker services such as dlopen. + * Note that we ignore ld_dynamic_weak == false case, + * always overriding weak symbols by rtld definitions. */ if (def == NULL || ELF_ST_BIND(def->st_info) == STB_WEAK) { res = symlook_obj(&req, &obj_rtld); @@ -4288,10 +4294,10 @@ symlook_global(SymLook *req, DoneList *donelist) symlook_init_from_req(&req1, req); /* Search all objects loaded at program start up. */ - if (req->defobj_out == NULL || - ELF_ST_BIND(req->sym_out->st_info) == STB_WEAK) { + if (req->defobj_out == NULL || (ld_dynamic_weak && + ELF_ST_BIND(req->sym_out->st_info) == STB_WEAK)) { res = symlook_list(&req1, &list_main, donelist); - if (res == 0 && (req->defobj_out == NULL || + if (res == 0 && (!ld_dynamic_weak || req->defobj_out == NULL || ELF_ST_BIND(req1.sym_out->st_info) != STB_WEAK)) { req->sym_out = req1.sym_out; req->defobj_out = req1.defobj_out; @@ -4301,8 +4307,8 @@ symlook_global(SymLook *req, DoneList *donelist) /* Search all DAGs whose roots are RTLD_GLOBAL objects. */ STAILQ_FOREACH(elm, &list_global, link) { - if (req->defobj_out != NULL && - ELF_ST_BIND(req->sym_out->st_info) != STB_WEAK) + if (req->defobj_out != NULL && (!ld_dynamic_weak || + ELF_ST_BIND(req->sym_out->st_info) != STB_WEAK)) break; res = symlook_list(&req1, &elm->obj->dagmembers, donelist); if (res == 0 && (req->defobj_out == NULL || @@ -4351,8 +4357,8 @@ symlook_default(SymLook *req, const Obj_Entry *refobj) /* Search all dlopened DAGs containing the referencing object. */ STAILQ_FOREACH(elm, &refobj->dldags, link) { - if (req->sym_out != NULL && - ELF_ST_BIND(req->sym_out->st_info) != STB_WEAK) + if (req->sym_out != NULL && (!ld_dynamic_weak || + ELF_ST_BIND(req->sym_out->st_info) != STB_WEAK)) break; res = symlook_list(&req1, &elm->obj->dagmembers, &donelist); if (res == 0 && (req->sym_out == NULL || @@ -4397,10 +4403,11 @@ symlook_list(SymLook *req, const Objlist *objlist, DoneList *dlp) continue; symlook_init_from_req(&req1, req); if ((res = symlook_obj(&req1, elm->obj)) == 0) { - if (def == NULL || ELF_ST_BIND(req1.sym_out->st_info) != STB_WEAK) { + if (def == NULL || (ld_dynamic_weak && + ELF_ST_BIND(req1.sym_out->st_info) != STB_WEAK)) { def = req1.sym_out; defobj = req1.defobj_out; - if (ELF_ST_BIND(def->st_info) != STB_WEAK) + if (!ld_dynamic_weak || ELF_ST_BIND(def->st_info) != STB_WEAK) break; } } @@ -4435,10 +4442,11 @@ symlook_needed(SymLook *req, const Needed_Entry *needed, DoneList *dlp) if (n->obj == NULL || (res = symlook_list(&req1, &n->obj->dagmembers, dlp)) != 0) continue; - if (def == NULL || ELF_ST_BIND(req1.sym_out->st_info) != STB_WEAK) { + if (def == NULL || (ld_dynamic_weak && + ELF_ST_BIND(req1.sym_out->st_info) != STB_WEAK)) { def = req1.sym_out; defobj = req1.defobj_out; - if (ELF_ST_BIND(def->st_info) != STB_WEAK) + if (!ld_dynamic_weak || ELF_ST_BIND(def->st_info) != STB_WEAK) break; } } From owner-dev-commits-src-main@freebsd.org Mon Aug 16 14:09:15 2021 Return-Path: Delivered-To: dev-commits-src-main@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 16C036756A6; Mon, 16 Aug 2021 14:09:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpGHZ6y5Dz4XgB; Mon, 16 Aug 2021 14:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6C632869; Mon, 16 Aug 2021 14:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GE9E6F074011; Mon, 16 Aug 2021 14:09:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GE9EmQ074010; Mon, 16 Aug 2021 14:09:14 GMT (envelope-from git) Date: Mon, 16 Aug 2021 14:09:14 GMT Message-Id: <202108161409.17GE9EmQ074010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 81b895a95bda - main - pipe_paircreate(): do not leak pipepair memory on error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81b895a95bdab28897bf948f5265fad1f51f8aa2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 14:09:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=81b895a95bdab28897bf948f5265fad1f51f8aa2 commit 81b895a95bdab28897bf948f5265fad1f51f8aa2 Author: Konstantin Belousov AuthorDate: 2021-08-16 09:24:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-16 14:08:44 +0000 pipe_paircreate(): do not leak pipepair memory on error Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/sys_pipe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index d226543c0118..ee6ccbbad322 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -415,6 +415,7 @@ fail: #ifdef MAC mac_pipe_destroy(pp); #endif + uma_zfree(pipe_zone, pp); return (error); } From owner-dev-commits-src-main@freebsd.org Mon Aug 16 14:30:12 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5668D675C9B; Mon, 16 Aug 2021 14:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpGlm1lxpz4b4f; Mon, 16 Aug 2021 14:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2476330F3; Mon, 16 Aug 2021 14:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GEUCsj004876; Mon, 16 Aug 2021 14:30:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GEUCSL004871; Mon, 16 Aug 2021 14:30:12 GMT (envelope-from git) Date: Mon, 16 Aug 2021 14:30:12 GMT Message-Id: <202108161430.17GEUCSL004871@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b1a217a36918 - main - sys/cddl: remove extraneous semicolons MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1a217a369186dc45c7df7bde13a87868fd5b2c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 14:30:12 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b1a217a369186dc45c7df7bde13a87868fd5b2c8 commit b1a217a369186dc45c7df7bde13a87868fd5b2c8 Author: Ed Maste AuthorDate: 2021-08-16 14:29:44 +0000 Commit: Ed Maste CommitDate: 2021-08-16 14:29:44 +0000 sys/cddl: remove extraneous semicolons Fixes: 5a1b490d502e ("FreeBSD changes to vendor source.") Fixes: 91eaf3e1831d ("Custom DTrace kernel module...") MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 2 +- sys/cddl/dev/fbt/fbt.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index a59edb05e2b6..ad14482b80b5 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -14830,7 +14830,7 @@ static int dtrace_state_buffer(dtrace_state_t *state, dtrace_buffer_t *buf, int which) { dtrace_optval_t *opt = state->dts_options, size; - processorid_t cpu = 0;; + processorid_t cpu = 0; int flags = 0, rval, factor, divisor = 1; ASSERT(MUTEX_HELD(&dtrace_lock)); diff --git a/sys/cddl/dev/fbt/fbt.c b/sys/cddl/dev/fbt/fbt.c index 3bad4243c040..2137075e3831 100644 --- a/sys/cddl/dev/fbt/fbt.c +++ b/sys/cddl/dev/fbt/fbt.c @@ -367,7 +367,7 @@ fbt_resume(void *arg, dtrace_id_t id, void *parg) static int fbt_ctfoff_init(modctl_t *lf, linker_ctf_t *lc) { - const Elf_Sym *symp = lc->symtab;; + const Elf_Sym *symp = lc->symtab; const ctf_header_t *hp = (const ctf_header_t *) lc->ctftab; const uint8_t *ctfdata = lc->ctftab + sizeof(ctf_header_t); int i; @@ -799,7 +799,7 @@ fbt_array_info(linker_ctf_t *lc, ctf_id_t type, ctf_arinfo_t *arp) static const char * ctf_strptr(linker_ctf_t *lc, int name) { - const ctf_header_t *hp = (const ctf_header_t *) lc->ctftab;; + const ctf_header_t *hp = (const ctf_header_t *) lc->ctftab; const char *strp = ""; if (name < 0 || name >= hp->cth_strlen) From owner-dev-commits-src-main@freebsd.org Mon Aug 16 14:50:06 2021 Return-Path: Delivered-To: dev-commits-src-main@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 52CF16763C2; Mon, 16 Aug 2021 14:50:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpHBk1nJ1z4cPT; Mon, 16 Aug 2021 14:50:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21BF933A4; Mon, 16 Aug 2021 14:50:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GEo5aT029906; Mon, 16 Aug 2021 14:50:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GEo5bF029875; Mon, 16 Aug 2021 14:50:05 GMT (envelope-from git) Date: Mon, 16 Aug 2021 14:50:05 GMT Message-Id: <202108161450.17GEo5bF029875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: c3295781fd5d - main - bxe: tag files to skip clang-format formatting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3295781fd5d58b6de2a2e0360b0b67b94dde1ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 14:50:06 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c3295781fd5d58b6de2a2e0360b0b67b94dde1ff commit c3295781fd5d58b6de2a2e0360b0b67b94dde1ff Author: Ed Maste AuthorDate: 2020-06-25 00:42:10 +0000 Commit: Ed Maste CommitDate: 2021-08-16 14:48:44 +0000 bxe: tag files to skip clang-format formatting bxe contains three files which are sets of constants or other data, and might be auto-generated or have an upstream. They are rather large files and clang-format takes quite some time when run against them, so just skip formatting. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27806 --- sys/dev/bxe/57710_init_values.c | 2 +- sys/dev/bxe/57711_init_values.c | 2 +- sys/dev/bxe/57712_init_values.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/bxe/57710_init_values.c b/sys/dev/bxe/57710_init_values.c index 7824cfc641b0..cd3fa466e67d 100644 --- a/sys/dev/bxe/57710_init_values.c +++ b/sys/dev/bxe/57710_init_values.c @@ -28,7 +28,7 @@ #include __FBSDID("$FreeBSD$"); - +/* clang-format off */ /* * This file contains an array of operations needed to initialize the chip: diff --git a/sys/dev/bxe/57711_init_values.c b/sys/dev/bxe/57711_init_values.c index b6bec1d4b636..7d3b00e23fd9 100644 --- a/sys/dev/bxe/57711_init_values.c +++ b/sys/dev/bxe/57711_init_values.c @@ -28,7 +28,7 @@ #include __FBSDID("$FreeBSD$"); - +/* clang-format off */ /* * This file contains an array of operations needed to initialize the chip: diff --git a/sys/dev/bxe/57712_init_values.c b/sys/dev/bxe/57712_init_values.c index 9e730584dae9..393cf795c76a 100644 --- a/sys/dev/bxe/57712_init_values.c +++ b/sys/dev/bxe/57712_init_values.c @@ -28,7 +28,7 @@ #include __FBSDID("$FreeBSD$"); - +/* clang-format off */ /* * This file contains an array of operations needed to initialize the chip: From owner-dev-commits-src-main@freebsd.org Mon Aug 16 16:53:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 07FD565101C; Mon, 16 Aug 2021 16:53:38 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpKxF6tQMz4nxK; Mon, 16 Aug 2021 16:53:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.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 6A551482F; Mon, 16 Aug 2021 16:53:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 8f63fa78e84a - main - rtld: Remove calculate_tls_end To: Konstantin Belousov , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202108161056.17GAuFNC017048@gitrepo.freebsd.org> From: John Baldwin Message-ID: <36c06d31-503b-121b-ca58-ad3f99bda22b@FreeBSD.org> Date: Mon, 16 Aug 2021 09:53:35 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <202108161056.17GAuFNC017048@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 16:53:38 -0000 On 8/16/21 3:56 AM, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=8f63fa78e84afd23fa68c82eabfe64763c92d4f5 > > commit 8f63fa78e84afd23fa68c82eabfe64763c92d4f5 > Author: Fangrui Song > AuthorDate: 2021-08-14 17:02:09 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-08-16 10:55:35 +0000 > > rtld: Remove calculate_tls_end > > Variant I architectures use off and Variant II ones use size + off. > Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libc > handles it. > > Reviewed by: kib > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D31539 > Differential revision: https://reviews.freebsd.org/D31541 Would it make sense to have and move the TLS-related constants there? Right now we duplicate them in at least two places (libthr internal headers and libc/rtld). -- John Baldwin From owner-dev-commits-src-main@freebsd.org Mon Aug 16 16:57:59 2021 Return-Path: Delivered-To: dev-commits-src-main@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 75E956510BC; Mon, 16 Aug 2021 16:57: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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpL2H0nJ7z4nxx; Mon, 16 Aug 2021 16:57:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 17GGvpN1068953 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 16 Aug 2021 19:57:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 17GGvpN1068953 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 17GGvp26068952; Mon, 16 Aug 2021 19:57:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 16 Aug 2021 19:57:51 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 8f63fa78e84a - main - rtld: Remove calculate_tls_end Message-ID: References: <202108161056.17GAuFNC017048@gitrepo.freebsd.org> <36c06d31-503b-121b-ca58-ad3f99bda22b@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <36c06d31-503b-121b-ca58-ad3f99bda22b@FreeBSD.org> 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.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4GpL2H0nJ7z4nxx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 16:57:59 -0000 On Mon, Aug 16, 2021 at 09:53:35AM -0700, John Baldwin wrote: > On 8/16/21 3:56 AM, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=8f63fa78e84afd23fa68c82eabfe64763c92d4f5 > > > > commit 8f63fa78e84afd23fa68c82eabfe64763c92d4f5 > > Author: Fangrui Song > > AuthorDate: 2021-08-14 17:02:09 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-08-16 10:55:35 +0000 > > > > rtld: Remove calculate_tls_end > > Variant I architectures use off and Variant II ones use size + off. > > Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libc > > handles it. > > Reviewed by: kib > > MFC after: 1 week > > Differential revision: https://reviews.freebsd.org/D31539 > > Differential revision: https://reviews.freebsd.org/D31541 > > Would it make sense to have and move the TLS-related > constants there? Right now we duplicate them in at least two places > (libthr internal headers and libc/rtld). This is some slow progress. Before this commit, we have that in three places. Eventually yes, it should be consolidated. From owner-dev-commits-src-main@freebsd.org Mon Aug 16 17:01:28 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E255F65121B; Mon, 16 Aug 2021 17:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpL6J623Qz4p05; Mon, 16 Aug 2021 17:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6EF8536C; Mon, 16 Aug 2021 17:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GH1S7p014857; Mon, 16 Aug 2021 17:01:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GH1S1m014856; Mon, 16 Aug 2021 17:01:28 GMT (envelope-from git) Date: Mon, 16 Aug 2021 17:01:28 GMT Message-Id: <202108161701.17GH1S1m014856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: c1a540709a83 - main - Apply upstream lldb fix for unhandled Error causing abort MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c1a540709a83f810aa47380b946552ab20020374 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 17:01:29 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=c1a540709a83f810aa47380b946552ab20020374 commit c1a540709a83f810aa47380b946552ab20020374 Author: Dimitry Andric AuthorDate: 2021-08-16 16:56:41 +0000 Commit: Dimitry Andric CommitDate: 2021-08-16 16:57:24 +0000 Apply upstream lldb fix for unhandled Error causing abort Merge commit 5033f0793fe6 from llvm git (by Dimitry Andric): [lldb] Avoid unhandled Error in TypeSystemMap::GetTypeSystemForLanguage When assertions are turned off, the `llvm::Error` value created at the start of this function is overwritten using the move-assignment operator, but the success value is never checked. Whenever a TypeSystem cannot be found or created, this can lead to lldb core dumping with: Program aborted due to an unhandled Error: Error value was Success. (Note: Success values must still be checked prior to being destroyed). Fix this by not creating a `llvm::Error` value in advance, and directly returning the result of `llvm::make_error` instead, whenever an error is encountered. See also: and . Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D108088 Reported by: dmgk, ota@j.email.ne.jp PR: 253881, 257829 MFC after: 3 days --- .../llvm-project/lldb/source/Symbol/TypeSystem.cpp | 90 +++++++++------------- 1 file changed, 38 insertions(+), 52 deletions(-) diff --git a/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp b/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp index 2adf36fa8276..83161f32444c 100644 --- a/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp +++ b/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp @@ -224,62 +224,32 @@ void TypeSystemMap::ForEach(std::function const &callback) { llvm::Expected TypeSystemMap::GetTypeSystemForLanguage( lldb::LanguageType language, llvm::Optional create_callback) { - llvm::Error error = llvm::Error::success(); - assert(!error); // Check the success value when assertions are enabled std::lock_guard guard(m_mutex); - if (m_clear_in_progress) { - error = llvm::make_error( + if (m_clear_in_progress) + return llvm::make_error( "Unable to get TypeSystem because TypeSystemMap is being cleared", llvm::inconvertibleErrorCode()); - } else { - collection::iterator pos = m_map.find(language); - if (pos != m_map.end()) { - auto *type_system = pos->second.get(); - if (type_system) { - llvm::consumeError(std::move(error)); - return *type_system; - } - error = llvm::make_error( - "TypeSystem for language " + - llvm::StringRef(Language::GetNameForLanguageType(language)) + - " doesn't exist", - llvm::inconvertibleErrorCode()); - return std::move(error); - } - for (const auto &pair : m_map) { - if (pair.second && pair.second->SupportsLanguage(language)) { - // Add a new mapping for "language" to point to an already existing - // TypeSystem that supports this language - m_map[language] = pair.second; - if (pair.second.get()) { - llvm::consumeError(std::move(error)); - return *pair.second.get(); - } - error = llvm::make_error( - "TypeSystem for language " + - llvm::StringRef(Language::GetNameForLanguageType(language)) + - " doesn't exist", - llvm::inconvertibleErrorCode()); - return std::move(error); - } - } + collection::iterator pos = m_map.find(language); + if (pos != m_map.end()) { + auto *type_system = pos->second.get(); + if (type_system) + return *type_system; + return llvm::make_error( + "TypeSystem for language " + + llvm::StringRef(Language::GetNameForLanguageType(language)) + + " doesn't exist", + llvm::inconvertibleErrorCode()); + } - if (!create_callback) { - error = llvm::make_error( - "Unable to find type system for language " + - llvm::StringRef(Language::GetNameForLanguageType(language)), - llvm::inconvertibleErrorCode()); - } else { - // Cache even if we get a shared pointer that contains a null type system - // back - TypeSystemSP type_system_sp = (*create_callback)(); - m_map[language] = type_system_sp; - if (type_system_sp.get()) { - llvm::consumeError(std::move(error)); - return *type_system_sp.get(); - } - error = llvm::make_error( + for (const auto &pair : m_map) { + if (pair.second && pair.second->SupportsLanguage(language)) { + // Add a new mapping for "language" to point to an already existing + // TypeSystem that supports this language + m_map[language] = pair.second; + if (pair.second.get()) + return *pair.second.get(); + return llvm::make_error( "TypeSystem for language " + llvm::StringRef(Language::GetNameForLanguageType(language)) + " doesn't exist", @@ -287,7 +257,23 @@ llvm::Expected TypeSystemMap::GetTypeSystemForLanguage( } } - return std::move(error); + if (!create_callback) + return llvm::make_error( + "Unable to find type system for language " + + llvm::StringRef(Language::GetNameForLanguageType(language)), + llvm::inconvertibleErrorCode()); + + // Cache even if we get a shared pointer that contains a null type system + // back + TypeSystemSP type_system_sp = (*create_callback)(); + m_map[language] = type_system_sp; + if (type_system_sp.get()) + return *type_system_sp.get(); + return llvm::make_error( + "TypeSystem for language " + + llvm::StringRef(Language::GetNameForLanguageType(language)) + + " doesn't exist", + llvm::inconvertibleErrorCode()); } llvm::Expected From owner-dev-commits-src-main@freebsd.org Mon Aug 16 17:17:24 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E254065160D; Mon, 16 Aug 2021 17:17:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpLSh63xgz4qGn; Mon, 16 Aug 2021 17:17:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4299543A; Mon, 16 Aug 2021 17:17:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GHHOO4030321; Mon, 16 Aug 2021 17:17:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GHHOZS030320; Mon, 16 Aug 2021 17:17:24 GMT (envelope-from git) Date: Mon, 16 Aug 2021 17:17:24 GMT Message-Id: <202108161717.17GHHOZS030320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 8fa63f44e64e - main - ipfilter: remove doubled semicolons MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8fa63f44e64ebac444a4ac6451ac5e150cdcf8b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 17:17:24 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8fa63f44e64ebac444a4ac6451ac5e150cdcf8b1 commit 8fa63f44e64ebac444a4ac6451ac5e150cdcf8b1 Author: Ed Maste AuthorDate: 2021-08-16 17:16:23 +0000 Commit: Ed Maste CommitDate: 2021-08-16 17:16:42 +0000 ipfilter: remove doubled semicolons Local commit; ipfilter upstream is inactive. Discussed with: cy MFC after: 3 days --- sys/contrib/ipfilter/netinet/ip_frag.c | 2 +- sys/contrib/ipfilter/netinet/ip_state.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_frag.c b/sys/contrib/ipfilter/netinet/ip_frag.c index 93bcc2ed9415..4a2596e72563 100644 --- a/sys/contrib/ipfilter/netinet/ip_frag.c +++ b/sys/contrib/ipfilter/netinet/ip_frag.c @@ -1181,7 +1181,7 @@ ipf_frag_nat_next(softc, token, itp) ipftoken_t *token; ipfgeniter_t *itp; { - ipf_frag_softc_t *softf = softc->ipf_frag_soft;; + ipf_frag_softc_t *softf = softc->ipf_frag_soft; #ifdef USE_MUTEXES return ipf_frag_next(softc, token, itp, &softf->ipfr_natlist, diff --git a/sys/contrib/ipfilter/netinet/ip_state.c b/sys/contrib/ipfilter/netinet/ip_state.c index 0ebebb49297d..7918f34fe685 100644 --- a/sys/contrib/ipfilter/netinet/ip_state.c +++ b/sys/contrib/ipfilter/netinet/ip_state.c @@ -2855,8 +2855,8 @@ ipf_checkicmpmatchingstate(fin) tcp = (tcphdr_t *)((char *)oip + (IP_HL(oip) << 2)); - hv += tcp->th_dport;; - hv += tcp->th_sport;; + hv += tcp->th_dport; + hv += tcp->th_sport; hv = DOUBLE_HASH(hv); READ_ENTER(&softc->ipf_state); From owner-dev-commits-src-main@freebsd.org Mon Aug 16 17:24:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E83A0651A67; Mon, 16 Aug 2021 17:24:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpLcY5z7zz4qQG; Mon, 16 Aug 2021 17:24:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B558356A0; Mon, 16 Aug 2021 17:24:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GHODtM043189; Mon, 16 Aug 2021 17:24:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GHODFB043188; Mon, 16 Aug 2021 17:24:13 GMT (envelope-from git) Date: Mon, 16 Aug 2021 17:24:13 GMT Message-Id: <202108161724.17GHODFB043188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 69e8e8ea3d4b - main - e1000: always enable PCSD when RSS hashing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69e8e8ea3d4be9da6b5bc904a444b51958128ff5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 17:24:14 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=69e8e8ea3d4be9da6b5bc904a444b51958128ff5 commit 69e8e8ea3d4be9da6b5bc904a444b51958128ff5 Author: Kevin Bowling AuthorDate: 2021-08-16 17:17:34 +0000 Commit: Kevin Bowling CommitDate: 2021-08-16 17:24:01 +0000 e1000: always enable PCSD when RSS hashing To enable RSS hashing in the NIC, the PCSD bit must be set. By default, this is never set when RXCSUM is disabled - which causes problems higher up in the stack. While here improve the RXCSUM flag assignments when enabling or disabling IFCAP_RXCSUM. See also: https://lists.freebsd.org/pipermail/freebsd-current/2020-May/076148.html Reviewed by: markj, Franco Fichtner , Stephan de Wit Obtained from: OPNsense MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31501 Co-authored-by: Stephan de Wit Co-authored-by: Franco Fichtner --- sys/dev/e1000/e1000_82575.h | 3 +-- sys/dev/e1000/e1000_defines.h | 11 ++++++----- sys/dev/e1000/if_em.c | 44 ++++++++++++++++++++----------------------- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/sys/dev/e1000/e1000_82575.h b/sys/dev/e1000/e1000_82575.h index a96b25f4169d..36045556661b 100644 --- a/sys/dev/e1000/e1000_82575.h +++ b/sys/dev/e1000/e1000_82575.h @@ -143,13 +143,12 @@ struct e1000_adv_context_desc { #define E1000_TX_HEAD_WB_ENABLE 0x1 #define E1000_TX_SEQNUM_WB_ENABLE 0x2 -#define E1000_MRQC_ENABLE_RSS_4Q 0x00000002 +#define E1000_MRQC_ENABLE_RSS_MQ 0x00000002 #define E1000_MRQC_ENABLE_VMDQ 0x00000003 #define E1000_MRQC_ENABLE_VMDQ_RSS_2Q 0x00000005 #define E1000_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 #define E1000_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 #define E1000_MRQC_RSS_FIELD_IPV6_UDP_EX 0x01000000 -#define E1000_MRQC_ENABLE_RSS_8Q 0x00000002 #define E1000_VMRCTL_MIRROR_PORT_SHIFT 8 #define E1000_VMRCTL_MIRROR_DSTPORT_MASK (7 << \ diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index 722596b36e34..262b01dd5b64 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -428,11 +428,12 @@ #define E1000_SCTL_ENABLE_SERDES_LOOPBACK 0x0410 /* Receive Checksum Control */ -#define E1000_RXCSUM_IPOFL 0x00000100 /* IPv4 checksum offload */ -#define E1000_RXCSUM_TUOFL 0x00000200 /* TCP / UDP checksum offload */ -#define E1000_RXCSUM_CRCOFL 0x00000800 /* CRC32 offload enable */ -#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ -#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ +#define E1000_RXCSUM_IPOFL 0x00000100 /* IPv4 checksum offload */ +#define E1000_RXCSUM_TUOFL 0x00000200 /* TCP / UDP checksum offload */ +#define E1000_RXCSUM_IPV6OFL 0x00000400 /* lem(4) IPv6 checksum offload */ +#define E1000_RXCSUM_CRCOFL 0x00000800 /* CRC32 offload enable */ +#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ +#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ /* Header split receive */ #define E1000_RFCTL_NFSW_DIS 0x00000040 diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 33d5341ed8ce..3f748b6bcacd 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -2838,7 +2838,7 @@ igb_initialize_rss_mapping(struct adapter *adapter) * MRQC: Multiple Receive Queues Command * Set queuing to RSS control, number depends on the device. */ - mrqc = E1000_MRQC_ENABLE_RSS_8Q; + mrqc = E1000_MRQC_ENABLE_RSS_MQ; #ifdef RSS /* XXX ew typecasting */ @@ -3245,37 +3245,33 @@ em_initialize_receive_unit(if_ctx_t ctx) E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); } + /* Set up L3 and L4 csum Rx descriptor offloads */ rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); - if (if_getcapenable(ifp) & IFCAP_RXCSUM && - hw->mac.type >= e1000_82543) { - if (adapter->tx_num_queues > 1) { - if (hw->mac.type >= igb_mac_min) { - rxcsum |= E1000_RXCSUM_PCSD; - if (hw->mac.type != e1000_82575) - rxcsum |= E1000_RXCSUM_CRCOFL; - } else - rxcsum |= E1000_RXCSUM_TUOFL | - E1000_RXCSUM_IPOFL | - E1000_RXCSUM_PCSD; - } else { - if (hw->mac.type >= igb_mac_min) - rxcsum |= E1000_RXCSUM_IPPCSE; - else - rxcsum |= E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPOFL; - if (hw->mac.type > e1000_82575) - rxcsum |= E1000_RXCSUM_CRCOFL; - } - } else - rxcsum &= ~E1000_RXCSUM_TUOFL; - - E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); + if (scctx->isc_capenable & IFCAP_RXCSUM) { + rxcsum |= E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPOFL; + if (hw->mac.type > e1000_82575) + rxcsum |= E1000_RXCSUM_CRCOFL; + else if (hw->mac.type < em_mac_min && + scctx->isc_capenable & IFCAP_HWCSUM_IPV6) + rxcsum |= E1000_RXCSUM_IPV6OFL; + } else { + rxcsum &= ~(E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); + if (hw->mac.type > e1000_82575) + rxcsum &= ~E1000_RXCSUM_CRCOFL; + else if (hw->mac.type < em_mac_min) + rxcsum &= ~E1000_RXCSUM_IPV6OFL; + } if (adapter->rx_num_queues > 1) { + /* RSS hash needed in the Rx descriptor */ + rxcsum |= E1000_RXCSUM_PCSD; + if (hw->mac.type >= igb_mac_min) igb_initialize_rss_mapping(adapter); else em_initialize_rss_mapping(adapter); } + E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); /* * XXX TEMPORARY WORKAROUND: on some systems with 82573 From owner-dev-commits-src-main@freebsd.org Mon Aug 16 17:49:12 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E7EB5651E2E; Mon, 16 Aug 2021 17:49:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpM9N6Jwtz4rVC; Mon, 16 Aug 2021 17:49:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0F975A54; Mon, 16 Aug 2021 17:49:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GHnCI6070444; Mon, 16 Aug 2021 17:49:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GHnCSh070443; Mon, 16 Aug 2021 17:49:12 GMT (envelope-from git) Date: Mon, 16 Aug 2021 17:49:12 GMT Message-Id: <202108161749.17GHnCSh070443@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d16cb228c1a6 - main - ktls: Fix accounting for TLS 1.0 empty fragments. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d16cb228c1a62a9641ffb2f0bfcacc3bffec5db1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 17:49:13 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d16cb228c1a62a9641ffb2f0bfcacc3bffec5db1 commit d16cb228c1a62a9641ffb2f0bfcacc3bffec5db1 Author: John Baldwin AuthorDate: 2021-08-16 17:42:46 +0000 Commit: John Baldwin CommitDate: 2021-08-16 17:42:46 +0000 ktls: Fix accounting for TLS 1.0 empty fragments. TLS 1.0 empty fragment mbufs have no payload and thus m_epg_npgs is zero. However, these mbufs need to occupy a "unit" of space for the purposes of M_NOTREADY tracking similar to regular mbufs. Previously this was done for the page count returned from ktls_frame() and passed to ktls_enqueue() as well as the page count passed to pru_ready(). However, sbready() and mb_free_notready() only use m_epg_nrdy to determine the number of "units" of space in an M_EXT mbuf, so when a TLS 1.0 fragment was marked ready it would mark one unit of the next mbuf in the socket buffer as ready as well. To fix, set m_epg_nrdy to 1 for empty fragments. This actually simplifies the code as now only ktls_frame() has to handle TLS 1.0 fragments explicitly and the rest of the KTLS functions can just use m_epg_nrdy. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31536 --- sys/kern/uipc_ktls.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 79da902095b3..34b4b15153ce 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1633,12 +1633,12 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, int *enq_cnt, */ if (tls->mode == TCP_TLS_MODE_SW) { m->m_flags |= M_NOTREADY; - m->m_epg_nrdy = m->m_epg_npgs; if (__predict_false(tls_len == 0)) { /* TLS 1.0 empty fragment. */ - *enq_cnt += 1; + m->m_epg_nrdy = 1; } else - *enq_cnt += m->m_epg_npgs; + m->m_epg_nrdy = m->m_epg_npgs; + *enq_cnt += m->m_epg_nrdy; } } } @@ -2181,11 +2181,7 @@ ktls_encrypt(struct ktls_wq *wq, struct mbuf *top) break; } - if (__predict_false(m->m_epg_npgs == 0)) { - /* TLS 1.0 empty fragment. */ - npages++; - } else - npages += m->m_epg_npgs; + npages += m->m_epg_nrdy; /* * Drop a reference to the session now that it is no From owner-dev-commits-src-main@freebsd.org Mon Aug 16 19:18:05 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A6EDA6531AB; Mon, 16 Aug 2021 19:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpP7x3y9Jz3GCs; Mon, 16 Aug 2021 19:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D04670BE; Mon, 16 Aug 2021 19:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GJI5HX090141; Mon, 16 Aug 2021 19:18:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GJI53J090140; Mon, 16 Aug 2021 19:18:05 GMT (envelope-from git) Date: Mon, 16 Aug 2021 19:18:05 GMT Message-Id: <202108161918.17GJI53J090140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c4feb1ab0ae0 - main - sigtimedwait: Use a unique wait channel for sleeping MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4feb1ab0ae0c0e779af372e4c5f3b9e0d3e1388 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 19:18:05 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c4feb1ab0ae0c0e779af372e4c5f3b9e0d3e1388 commit c4feb1ab0ae0c0e779af372e4c5f3b9e0d3e1388 Author: Mark Johnston AuthorDate: 2021-08-16 17:15:25 +0000 Commit: Mark Johnston CommitDate: 2021-08-16 19:11:15 +0000 sigtimedwait: Use a unique wait channel for sleeping When a sigtimedwait(2) caller goes to sleep, it uses a wait channel of p->p_sigacts with the proc lock as the interlock. However, p_sigacts can be shared between processes if a child is created with rfork(RFSIGSHARE | RFPROC). Thus we can end up with two threads sleeping on the same wait channel using different locks, which is not permitted. Fix the problem simply by using a process-unique wait channel, following the example of sigsuspend. The actual wait channel value is irrelevant here, sleeping threads are awoken using sleepq_abort(). Reported by: syzbot+8c417afabadb50bb8827@syzkaller.appspotmail.com Reported by: syzbot+1d89fc2a9ef92ef64fa8@syzkaller.appspotmail.com Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31563 --- sys/kern/kern_sig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 4f6f424fb05d..d61812ad3043 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1341,7 +1341,8 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, ksiginfo_t *ksi, break; } - error = msleep(ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", timo); + error = msleep(&p->p_sigacts, &p->p_mtx, PPAUSE | PCATCH, + "sigwait", timo); /* The syscalls can not be restarted. */ if (error == ERESTART) From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:02:47 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7E2EE6544CA; Mon, 16 Aug 2021 21:02:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpRSl33FZz3QWc; Mon, 16 Aug 2021 21:02:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 516A0105DC; Mon, 16 Aug 2021 21:02:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GL2lWG036851; Mon, 16 Aug 2021 21:02:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GL2liG036850; Mon, 16 Aug 2021 21:02:47 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:02:47 GMT Message-Id: <202108162102.17GL2liG036850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 95add157e341 - main - hmt(4): Store Contact Count in separate variable. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95add157e341f2c1ce47eaa19b3c5771705ea20d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:02:47 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=95add157e341f2c1ce47eaa19b3c5771705ea20d commit 95add157e341f2c1ce47eaa19b3c5771705ea20d Author: Vladimir Kondratyev AuthorDate: 2021-08-16 20:11:36 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-08-16 20:11:36 +0000 hmt(4): Store Contact Count in separate variable. No functional changes. MFC after: 1 week --- sys/dev/hid/hmt.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c index fd50ea4de829..2eb02811a5a4 100644 --- a/sys/dev/hid/hmt.c +++ b/sys/dev/hid/hmt.c @@ -185,6 +185,7 @@ struct hmt_softc { device_t dev; enum hmt_type type; + int32_t cont_count_max; struct hid_absinfo ai[HMT_N_USAGES]; struct hid_location locs[MAX_MT_SLOTS][HMT_N_USAGES]; struct hid_location cont_count_loc; @@ -332,7 +333,7 @@ hmt_attach(device_t dev) * 'Contact Count Maximum' */ if (cont_count_max > 0) - sc->ai[HMT_SLOT].max = cont_count_max - 1; + sc->cont_count_max = cont_count_max; } else DPRINTF("hid_get_report error=%d\n", err); } else @@ -368,12 +369,19 @@ hmt_attach(device_t dev) } /* Cap contact count maximum to MAX_MT_SLOTS */ - if (sc->ai[HMT_SLOT].max >= MAX_MT_SLOTS) { + if (sc->cont_count_max > MAX_MT_SLOTS) { DPRINTF("Hardware reported %d contacts while only %d is " - "supported\n", (int)sc->ai[HMT_SLOT].max+1, MAX_MT_SLOTS); - sc->ai[HMT_SLOT].max = MAX_MT_SLOTS - 1; + "supported\n", sc->cont_count_max, MAX_MT_SLOTS); + sc->cont_count_max = MAX_MT_SLOTS; } + /* Set number of MT protocol type B slots */ + sc->ai[HMT_SLOT] = (struct hid_absinfo) { + .min = 0, + .max = sc->cont_count_max - 1, + .res = 0, + }; + if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps) sc->do_timestamps = true; #ifdef IICHID_SAMPLING @@ -445,7 +453,7 @@ hmt_attach(device_t dev) sc->is_clickpad ? ", click-pad" : ""); device_printf(sc->dev, "%d contacts with [%s%s%s%s%s] properties. Report range [%d:%d] - [%d:%d]\n", - (int)sc->ai[HMT_SLOT].max + 1, + (int)sc->cont_count_max, isset(sc->caps, HMT_IN_RANGE) ? "R" : "", isset(sc->caps, HMT_CONFIDENCE) ? "C" : "", isset(sc->caps, HMT_WIDTH) ? "W" : "", @@ -834,13 +842,6 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, if (cont_count_max < 1) cont_count_max = cont; - /* Set number of MT protocol type B slots */ - sc->ai[HMT_SLOT] = (struct hid_absinfo) { - .min = 0, - .max = cont_count_max - 1, - .res = 0, - }; - /* Report touch orientation if both width and height are supported */ if (isset(sc->caps, HMT_WIDTH) && isset(sc->caps, HMT_HEIGHT)) { setbit(sc->caps, HMT_ORIENTATION); @@ -857,6 +858,7 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, hid_feature, sc->thqa_cert_rid); sc->report_id = report_id; + sc->cont_count_max = cont_count_max; sc->nconts_per_report = cont; sc->has_int_button = has_int_button; From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:02:48 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E45796545DD; Mon, 16 Aug 2021 21:02:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpRSm4f1Tz3QWd; Mon, 16 Aug 2021 21:02:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7672A10B47; Mon, 16 Aug 2021 21:02:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GL2mn5036882; Mon, 16 Aug 2021 21:02:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GL2mUT036881; Mon, 16 Aug 2021 21:02:48 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:02:48 GMT Message-Id: <202108162102.17GL2mUT036881@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: e40fec4ec9a7 - main - evdev: Do not check maximal contact number for MT initialization MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e40fec4ec9a7a6625b3e332d4f856eb1d05f0def Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:02:49 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=e40fec4ec9a7a6625b3e332d4f856eb1d05f0def commit e40fec4ec9a7a6625b3e332d4f856eb1d05f0def Author: Vladimir Kondratyev AuthorDate: 2021-08-16 20:12:01 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-08-16 20:12:01 +0000 evdev: Do not check maximal contact number for MT initialization This allows singletouch devices which use multitouch protocols to work. Reported by: Mark Kane MFC after: 1 week --- sys/dev/evdev/evdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index 086ee36333dc..bc28ae0734f9 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -316,8 +316,7 @@ evdev_register_common(struct evdev_dev *evdev) } /* Initialize multitouch protocol type B states */ - if (bit_test(evdev->ev_abs_flags, ABS_MT_SLOT) && - evdev->ev_absinfo != NULL && MAXIMAL_MT_SLOT(evdev) > 0) + if (bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) evdev_mt_init(evdev); /* Estimate maximum report size */ From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:02:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C536B6548F2; Mon, 16 Aug 2021 21:02:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpRSn4szcz3QFn; Mon, 16 Aug 2021 21:02:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BE4510978; Mon, 16 Aug 2021 21:02:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GL2naB036906; Mon, 16 Aug 2021 21:02:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GL2nFE036905; Mon, 16 Aug 2021 21:02:49 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:02:49 GMT Message-Id: <202108162102.17GL2nFE036905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: be75951af1ec - main - hid: Add extra constant to units of measurement MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be75951af1ec2d69d34a8701700b9bfd2a50679e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:02:50 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=be75951af1ec2d69d34a8701700b9bfd2a50679e commit be75951af1ec2d69d34a8701700b9bfd2a50679e Author: Vladimir Kondratyev AuthorDate: 2021-08-16 20:13:24 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-08-16 20:13:24 +0000 hid: Add extra constant to units of measurement Some devices like eGalax touchscreens use value of 0x33 instead of 0x13 for inches as unit of measure. Reported by: Mark Kane MFC after: 1 week --- sys/dev/hid/hid.c | 1 + sys/dev/hid/hid.h | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c index 699bfa4a8bb3..f201182ac20f 100644 --- a/sys/dev/hid/hid.c +++ b/sys/dev/hid/hid.c @@ -856,6 +856,7 @@ hid_item_resolution(struct hid_item *hi) divisor = 10; break; case HUM_INCH: + case HUM_INCH_EGALAX: multiplier = 10; divisor = 254; break; diff --git a/sys/dev/hid/hid.h b/sys/dev/hid/hid.h index 37ab8c9cdf7e..f0311bae689c 100644 --- a/sys/dev/hid/hid.h +++ b/sys/dev/hid/hid.h @@ -185,6 +185,7 @@ #define HUM_CENTIMETER 0x11 #define HUM_RADIAN 0x12 #define HUM_INCH 0x13 +#define HUM_INCH_EGALAX 0x33 #define HUM_DEGREE 0x14 #if defined(_KERNEL) || defined(_STANDALONE) From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:02:51 2021 Return-Path: Delivered-To: dev-commits-src-main@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 564066546E1; Mon, 16 Aug 2021 21:02:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpRSq0tcMz3QFt; Mon, 16 Aug 2021 21:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF05910979; Mon, 16 Aug 2021 21:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GL2o6T036930; Mon, 16 Aug 2021 21:02:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GL2oJi036929; Mon, 16 Aug 2021 21:02:50 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:02:50 GMT Message-Id: <202108162102.17GL2oJi036929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: cb910670ac59 - main - hmt(4): Do not ignore constant usages in HID report descriptor parser MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb910670ac59e11808a629c8375c60200f909217 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:02:51 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=cb910670ac59e11808a629c8375c60200f909217 commit cb910670ac59e11808a629c8375c60200f909217 Author: Jack AuthorDate: 2021-08-16 20:17:41 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-08-16 20:24:05 +0000 hmt(4): Do not ignore constant usages in HID report descriptor parser This fixes hmt to work with MELF0411 1FD2:7012 touchscreen Obtained from: sysutils/iichid MFC after: 1 week --- sys/dev/hid/hmt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c index 2eb02811a5a4..d04db6954d00 100644 --- a/sys/dev/hid/hmt.c +++ b/sys/dev/hid/hmt.c @@ -676,8 +676,8 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, bool scan_time_found = false; bool has_int_button = false; -#define HMT_HI_ABSOLUTE(hi) \ - (((hi).flags & (HIO_CONST|HIO_VARIABLE|HIO_RELATIVE)) == HIO_VARIABLE) +#define HMT_HI_ABSOLUTE(hi) ((hi).nusages != 0 && \ + ((hi).flags & (HIO_VARIABLE | HIO_RELATIVE)) == HIO_VARIABLE) #define HUMS_THQA_CERT 0xC5 /* From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:02:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 F34B36545DF; Mon, 16 Aug 2021 21:02:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpRSs1GtQz3QG5; Mon, 16 Aug 2021 21:02:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0DAF10D3E; Mon, 16 Aug 2021 21:02:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GL2q2o036978; Mon, 16 Aug 2021 21:02:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GL2qU9036977; Mon, 16 Aug 2021 21:02:52 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:02:52 GMT Message-Id: <202108162102.17GL2qU9036977@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 9b2b5f42b4fe - main - ps4dshock(4): Fix touchpad width in HID report descriptor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b2b5f42b4fee7fdb6c7653829da71e9706f849b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:02:54 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=9b2b5f42b4fee7fdb6c7653829da71e9706f849b commit 9b2b5f42b4fee7fdb6c7653829da71e9706f849b Author: Vladimir Kondratyev AuthorDate: 2021-08-16 20:18:27 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-08-16 20:24:05 +0000 ps4dshock(4): Fix touchpad width in HID report descriptor MFC after: 1 week --- sys/dev/hid/ps4dshock.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/hid/ps4dshock.c b/sys/dev/hid/ps4dshock.c index a4afba254c03..afb74bc4b843 100644 --- a/sys/dev/hid/ps4dshock.c +++ b/sys/dev/hid/ps4dshock.c @@ -215,7 +215,7 @@ static const uint8_t ps4dshock_rdesc[] = { 0x55, 0x0E, /* Unit Exponent (-2) */ 0x65, 0x11, /* Unit (System: SI Linear, Length: Centimeter) */ 0x35, 0x00, /* Physical Minimum (0) */ - 0x46, 0x80, 0x02, /* Physical Maximum (640) */ + 0x46, 0xB8, 0x01, /* Physical Maximum (440) */ 0x26, 0x80, 0x07, /* Logical Maximum (1920) */ 0x75, 0x0C, /* Report Size (12) */ 0x81, 0x02, /* Input (Data,Var,Abs) */ @@ -244,7 +244,7 @@ static const uint8_t ps4dshock_rdesc[] = { 0x55, 0x0E, /* Unit Exponent (-2) */ 0x65, 0x11, /* Unit (System: SI Linear, Length: Centimeter) */ 0x35, 0x00, /* Physical Minimum (0) */ - 0x46, 0x80, 0x02, /* Physical Maximum (640) */ + 0x46, 0xB8, 0x01, /* Physical Maximum (440) */ 0x26, 0x80, 0x07, /* Logical Maximum (1920) */ 0x75, 0x0C, /* Report Size (12) */ 0x81, 0x02, /* Input (Data,Var,Abs) */ @@ -284,7 +284,7 @@ static const uint8_t ps4dshock_rdesc[] = { 0x55, 0x0E, /* Unit Exponent (-2) */ 0x65, 0x11, /* Unit (System: SI Linear, Length: Centimeter) */ 0x35, 0x00, /* Physical Minimum (0) */ - 0x46, 0x80, 0x02, /* Physical Maximum (640) */ + 0x46, 0xB8, 0x01, /* Physical Maximum (440) */ 0x26, 0x80, 0x07, /* Logical Maximum (1920) */ 0x75, 0x0C, /* Report Size (12) */ 0x81, 0x02, /* Input (Data,Var,Abs) */ @@ -313,7 +313,7 @@ static const uint8_t ps4dshock_rdesc[] = { 0x55, 0x0E, /* Unit Exponent (-2) */ 0x65, 0x11, /* Unit (System: SI Linear, Length: Centimeter) */ 0x35, 0x00, /* Physical Minimum (0) */ - 0x46, 0x80, 0x02, /* Physical Maximum (640) */ + 0x46, 0xB8, 0x01, /* Physical Maximum (440) */ 0x26, 0x80, 0x07, /* Logical Maximum (1920) */ 0x75, 0x0C, /* Report Size (12) */ 0x81, 0x02, /* Input (Data,Var,Abs) */ @@ -353,7 +353,7 @@ static const uint8_t ps4dshock_rdesc[] = { 0x55, 0x0E, /* Unit Exponent (-2) */ 0x65, 0x11, /* Unit (System: SI Linear, Length: Centimeter) */ 0x35, 0x00, /* Physical Minimum (0) */ - 0x46, 0x80, 0x02, /* Physical Maximum (640) */ + 0x46, 0xB8, 0x01, /* Physical Maximum (440) */ 0x26, 0x80, 0x07, /* Logical Maximum (1920) */ 0x75, 0x0C, /* Report Size (12) */ 0x81, 0x02, /* Input (Data,Var,Abs) */ @@ -382,7 +382,7 @@ static const uint8_t ps4dshock_rdesc[] = { 0x55, 0x0E, /* Unit Exponent (-2) */ 0x65, 0x11, /* Unit (System: SI Linear, Length: Centimeter) */ 0x35, 0x00, /* Physical Minimum (0) */ - 0x46, 0x80, 0x02, /* Physical Maximum (640) */ + 0x46, 0xB8, 0x01, /* Physical Maximum (440) */ 0x26, 0x80, 0x07, /* Logical Maximum (1920) */ 0x75, 0x0C, /* Report Size (12) */ 0x81, 0x02, /* Input (Data,Var,Abs) */ From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:02:54 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6BC1C6546ED; Mon, 16 Aug 2021 21:02:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpRSt1Xc6z3QPD; Mon, 16 Aug 2021 21:02:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1900E10A52; Mon, 16 Aug 2021 21:02:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GL2seA037008; Mon, 16 Aug 2021 21:02:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GL2rXN037007; Mon, 16 Aug 2021 21:02:53 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:02:53 GMT Message-Id: <202108162102.17GL2rXN037007@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 9b78891df13d - main - hms(4): Allow attachment to pointer top level collection. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b78891df13d12abaf8d0f0b0ca3e7d5f0e857e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:02:54 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=9b78891df13d12abaf8d0f0b0ca3e7d5f0e857e3 commit 9b78891df13d12abaf8d0f0b0ca3e7d5f0e857e3 Author: Vladimir Kondratyev AuthorDate: 2021-08-16 20:18:43 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-08-16 20:24:05 +0000 hms(4): Allow attachment to pointer top level collection. to be in line with Microsoft mouse driver [1] [1] https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/top-level-collections-opened-by-windows-for-system-use MFC after: 1 week --- sys/dev/hid/hms.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/hid/hms.c b/sys/dev/hid/hms.c index 014354c3acc3..e9923f55861f 100644 --- a/sys/dev/hid/hms.c +++ b/sys/dev/hid/hms.c @@ -109,6 +109,7 @@ static const struct hidmap_item hms_map_wheel_rev[] = { /* A match on these entries will load hms */ static const struct hid_device_id hms_devs[] = { + { HID_TLC(HUP_GENERIC_DESKTOP, HUG_POINTER) }, { HID_TLC(HUP_GENERIC_DESKTOP, HUG_MOUSE) }, }; From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:02:52 2021 Return-Path: Delivered-To: dev-commits-src-main@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 211F46547C1; Mon, 16 Aug 2021 21:02:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpRSq6xQ3z3QG1; Mon, 16 Aug 2021 21:02:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2C3E1083E; Mon, 16 Aug 2021 21:02:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GL2ptb036954; Mon, 16 Aug 2021 21:02:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GL2pjk036953; Mon, 16 Aug 2021 21:02:51 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:02:51 GMT Message-Id: <202108162102.17GL2pjk036953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 51b221611454 - main - hid: move proper hat switch handling from ps4dshock to hgame MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51b2216114546bb13b13002b29fb1263e600a0fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:02:52 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=51b2216114546bb13b13002b29fb1263e600a0fc commit 51b2216114546bb13b13002b29fb1263e600a0fc Author: Greg V AuthorDate: 2021-08-16 20:18:09 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-08-16 20:24:05 +0000 hid: move proper hat switch handling from ps4dshock to hgame Generic "DirectInput" HID gamepads need this handling too. Reviewed by: wulf MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31398 --- sys/dev/hid/hgame.c | 34 +++++++++++++++++++++++++++++++++- sys/dev/hid/hgame.h | 1 + sys/dev/hid/ps4dshock.c | 35 +++-------------------------------- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/sys/dev/hid/hgame.c b/sys/dev/hid/hgame.c index 545c72e76d93..97b1ac91960c 100644 --- a/sys/dev/hid/hgame.c +++ b/sys/dev/hid/hgame.c @@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$"); { HIDMAP_KEY_RANGE(HUP_BUTTON, number_from, number_to, code) } #define HGAME_MAP_ABS(usage, code) \ { HIDMAP_ABS(HUP_GENERIC_DESKTOP, HUG_##usage, code) } +#define HGAME_MAP_GCB(usage, callback) \ + { HIDMAP_ANY_CB(HUP_GENERIC_DESKTOP, HUG_##usage, callback) } #define HGAME_MAP_CRG(usage_from, usage_to, callback) \ { HIDMAP_ANY_CB_RANGE(HUP_GENERIC_DESKTOP, \ HUG_##usage_from, HUG_##usage_to, callback) } @@ -66,7 +68,7 @@ static const struct hidmap_item hgame_map[] = { HGAME_MAP_ABS(RX, ABS_RX), HGAME_MAP_ABS(RY, ABS_RY), HGAME_MAP_ABS(RZ, ABS_RZ), - HGAME_MAP_ABS(HAT_SWITCH, ABS_HAT0X), + HGAME_MAP_GCB(HAT_SWITCH, hgame_hat_switch_cb), HGAME_MAP_CRG(D_PAD_UP, D_PAD_LEFT, hgame_dpad_cb), HGAME_MAP_BRG(17, 57, BTN_TRIGGER_HAPPY), HGAME_FINALCB( hgame_final_cb), @@ -79,6 +81,36 @@ static const struct hid_device_id hgame_devs[] = { HID_DRIVER_INFO(HUG_GAME_PAD) }, }; +int +hgame_hat_switch_cb(HIDMAP_CB_ARGS) +{ + static const struct { int32_t x; int32_t y; } hat_switch_map[] = { + {0, -1}, {1, -1}, {1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, + {-1, -1},{0, 0} + }; + struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); + u_int idx; + + switch (HIDMAP_CB_GET_STATE()) { + case HIDMAP_CB_IS_ATTACHING: + evdev_support_event(evdev, EV_ABS); + evdev_support_abs(evdev, ABS_HAT0X, -1, 1, 0, 0, 0); + evdev_support_abs(evdev, ABS_HAT0Y, -1, 1, 0, 0, 0); + break; + + case HIDMAP_CB_IS_RUNNING: + idx = MIN(nitems(hat_switch_map) - 1, (u_int)ctx.data); + evdev_push_abs(evdev, ABS_HAT0X, hat_switch_map[idx].x); + evdev_push_abs(evdev, ABS_HAT0Y, hat_switch_map[idx].y); + break; + + default: + break; + } + + return (0); +} + /* * Emulate the hat switch report via the D-pad usages * found on XInput/XBox style devices diff --git a/sys/dev/hid/hgame.h b/sys/dev/hid/hgame.h index 32086ec4923c..702c65a4a4c1 100644 --- a/sys/dev/hid/hgame.h +++ b/sys/dev/hid/hgame.h @@ -31,6 +31,7 @@ #include +hidmap_cb_t hgame_hat_switch_cb; hidmap_cb_t hgame_dpad_cb; hidmap_cb_t hgame_final_cb; diff --git a/sys/dev/hid/ps4dshock.c b/sys/dev/hid/ps4dshock.c index eec26f808997..a4afba254c03 100644 --- a/sys/dev/hid/ps4dshock.c +++ b/sys/dev/hid/ps4dshock.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #define HID_DEBUG_VAR ps4dshock_debug +#include #include #include #include @@ -588,7 +589,6 @@ static const uint8_t ps4dshock_rdesc[] = { #define PS4DS_OUTPUT_REPORT5_SIZE 32 #define PS4DS_OUTPUT_REPORT11_SIZE 78 -static hidmap_cb_t ps4dshock_hat_switch_cb; static hidmap_cb_t ps4dshock_final_cb; static hidmap_cb_t ps4dsacc_data_cb; static hidmap_cb_t ps4dsacc_tstamp_cb; @@ -743,7 +743,7 @@ static const struct hidmap_item ps4dshock_map[] = { PS4DS_MAP_BTN(13, BTN_MODE), /* Click button is handled by touchpad driver */ /* PS4DS_MAP_BTN(14, BTN_LEFT), */ - PS4DS_MAP_GCB(HAT_SWITCH, ps4dshock_hat_switch_cb), + PS4DS_MAP_GCB(HAT_SWITCH, hgame_hat_switch_cb), PS4DS_FINALCB( ps4dshock_final_cb), }; static const struct hidmap_item ps4dsacc_map[] = { @@ -787,36 +787,6 @@ static const struct hid_device_id ps4dsmtp_devs[] = { HID_TLC(HUP_DIGITIZERS, HUD_TOUCHPAD) }, }; -static int -ps4dshock_hat_switch_cb(HIDMAP_CB_ARGS) -{ - static const struct { int32_t x; int32_t y; } hat_switch_map[] = { - {0, -1}, {1, -1}, {1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, - {-1, -1},{0, 0} - }; - struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); - u_int idx; - - switch (HIDMAP_CB_GET_STATE()) { - case HIDMAP_CB_IS_ATTACHING: - evdev_support_event(evdev, EV_ABS); - evdev_support_abs(evdev, ABS_HAT0X, -1, 1, 0, 0, 0); - evdev_support_abs(evdev, ABS_HAT0Y, -1, 1, 0, 0, 0); - break; - - case HIDMAP_CB_IS_RUNNING: - idx = MIN(nitems(hat_switch_map) - 1, (u_int)ctx.data); - evdev_push_abs(evdev, ABS_HAT0X, hat_switch_map[idx].x); - evdev_push_abs(evdev, ABS_HAT0Y, hat_switch_map[idx].y); - break; - - default: - break; - } - - return (0); -} - static int ps4dshock_final_cb(HIDMAP_CB_ARGS) { @@ -1414,6 +1384,7 @@ DRIVER_MODULE(ps4dshock, hidbus, ps4dshock_driver, ps4dshock_devclass, NULL, 0); MODULE_DEPEND(ps4dshock, hid, 1, 1, 1); MODULE_DEPEND(ps4dshock, hidbus, 1, 1, 1); MODULE_DEPEND(ps4dshock, hidmap, 1, 1, 1); +MODULE_DEPEND(ps4dshock, hgame, 1, 1, 1); MODULE_DEPEND(ps4dshock, evdev, 1, 1, 1); MODULE_VERSION(ps4dshock, 1); HID_PNP_INFO(ps4dshock_devs); From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:02:56 2021 Return-Path: Delivered-To: dev-commits-src-main@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 67A036547E8; Mon, 16 Aug 2021 21:02:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpRSv487qz3QRN; Mon, 16 Aug 2021 21:02:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40488105DD; Mon, 16 Aug 2021 21:02:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GL2tkU037032; Mon, 16 Aug 2021 21:02:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GL2ths037031; Mon, 16 Aug 2021 21:02:55 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:02:55 GMT Message-Id: <202108162102.17GL2ths037031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 14a4d6d01335 - main - bitstring(3): Add bitstring traversal macros. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 14a4d6d01335dd233023834e05897377cb70d52a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:02:56 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=14a4d6d01335dd233023834e05897377cb70d52a commit 14a4d6d01335dd233023834e05897377cb70d52a Author: Vladimir Kondratyev AuthorDate: 2021-08-16 20:18:58 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-08-16 20:24:05 +0000 bitstring(3): Add bitstring traversal macros. The macro bit_foreach() traverses all set bits in the bitstring in the forward direction, assigning each location in turn to variable. The macro bit_foreach_at() traverses all set bits in the bitstring in the forward direction at or after the zero-based bit index, assigning each location in turn to variable. The bit_foreach_unset() and bit_foreach_unset_at() macros which traverses unset bits are implemented for completeness. Reviewed by: asomers, dougm MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31469 --- share/man/man3/bitstring.3 | 46 ++++++++- sys/sys/bitstring.h | 16 ++++ tests/sys/sys/bitstring_test.c | 207 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 268 insertions(+), 1 deletion(-) diff --git a/share/man/man3/bitstring.3 b/share/man/man3/bitstring.3 index 20f5bae24d4d..e5be67a89e4f 100644 --- a/share/man/man3/bitstring.3 +++ b/share/man/man3/bitstring.3 @@ -58,7 +58,7 @@ .\" @(#)bitstring.3 8.1 (Berkeley) 7/19/93 .\" $FreeBSD$ .\" -.Dd November 18, 2019 +.Dd August 8, 2021 .Dt BITSTRING 3 .Os .Sh NAME @@ -106,6 +106,10 @@ .Fn bit_ffc_area_at "bitstr_t *name" "int start" "int nbits" "int size" "int *value" .Ft void .Fn bit_ffs_area_at "bitstr_t *name" "int start" "int nbits" "int size" "int *value" +.Fn bit_foreach "bitstr_t *name" "int nbits" "int var" +.Fn bit_foreach_at "bitstr_t *name" "int start" "int nbits" "int var" +.Fn bit_foreach_unset "bitstr_t *name" "int nbits" "int var" +.Fn bit_foreach_unset_at "bitstr_t *name" "int start" "int nbits" "int var" .Ft void .Fn bit_nclear "bitstr_t *name" "int start" "int stop" .Ft void @@ -327,6 +331,46 @@ bits referenced by at or after the zero-based bit index .Fa start . .Pp +The macro +.Fn bit_foreach +traverses all set bits in the array of +.Fa nbits +referenced by +.Fa name +in the forward direction, assigning each location in turn to +.Fa var . +.Pp +The macro +.Fn bit_foreach_at +traverses all set bits in the array of +.Fa nbits +referenced by +.Fa name +in the forward direction at or after the zero-based bit index +.Fa start , +assigning each location in turn to +.Fa var . +.Pp +The macro +.Fn bit_foreach_unset +traverses all unset bits in the array of +.Fa nbits +referenced by +.Fa name +in the forward direction, assigning each location in turn to +.Fa var . +.Pp +The macro +.Fn bit_foreach_unset_at +traverses all unset bits in the array of +.Fa nbits +referenced by +.Fa name +in the forward direction at or after the zero-based bit index +.Fa start , +assigning each location in turn to +.Fa var . +.Pp The arguments in bit string macros are evaluated only once and may safely have side effects. .Sh EXAMPLES diff --git a/sys/sys/bitstring.h b/sys/sys/bitstring.h index 97b841bbdda6..f898a2392be6 100644 --- a/sys/sys/bitstring.h +++ b/sys/sys/bitstring.h @@ -419,4 +419,20 @@ out: *_result = _value; } +/* Traverse all set bits, assigning each location in turn to iter */ +#define bit_foreach_at(_bitstr, _start, _nbits, _iter) \ + for (bit_ffs_at((_bitstr), (_start), (_nbits), &(_iter)); \ + (_iter) != -1; \ + bit_ffs_at((_bitstr), (_iter) + 1, (_nbits), &(_iter))) +#define bit_foreach(_bitstr, _nbits, _iter) \ + bit_foreach_at(_bitstr, /*start*/0, _nbits, _iter) + +/* Traverse all unset bits, assigning each location in turn to iter */ +#define bit_foreach_unset_at(_bitstr, _start, _nbits, _iter) \ + for (bit_ffc_at((_bitstr), (_start), (_nbits), &(_iter)); \ + (_iter) != -1; \ + bit_ffc_at((_bitstr), (_iter) + 1, (_nbits), &(_iter))) +#define bit_foreach_unset(_bitstr, _nbits, _iter) \ + bit_foreach_unset_at(_bitstr, /*start*/0, _nbits, _iter) + #endif /* _SYS_BITSTRING_H_ */ diff --git a/tests/sys/sys/bitstring_test.c b/tests/sys/sys/bitstring_test.c index 8fdc68ecf68e..c891a98645f8 100644 --- a/tests/sys/sys/bitstring_test.c +++ b/tests/sys/sys/bitstring_test.c @@ -601,6 +601,209 @@ BITSTRING_TC_DEFINE(bit_count) } +BITSTRING_TC_DEFINE(bit_foreach) +/* bitstr_t *bitstr, int nbits, const char *memloc */ +{ + int i, set_bit; + + /* Empty bitstr */ + memset(bitstr, 0x00, bitstr_size(nbits)); + bit_foreach (bitstr, nbits, set_bit) { + atf_tc_fail("bit_foreach_%d_%s_%s: Failed at location %d", + nbits, "clear", memloc, set_bit); + } + + /* Full bitstr */ + i = 0; + memset(bitstr, 0xFF, bitstr_size(nbits)); + bit_foreach(bitstr, nbits, set_bit) { + ATF_REQUIRE_MSG(set_bit == i, + "bit_foreach_%d_%s_%s: Failed on turn %d at location %d", + nbits, "set", memloc, i, set_bit); + i++; + } + ATF_REQUIRE_MSG(i == nbits, + "bit_foreach_%d_%s_%s: Invalid number of turns %d", + nbits, "set", memloc, i); + + /* Alternating bitstr, starts with 0 */ + i = 0; + memset(bitstr, 0xAA, bitstr_size(nbits)); + bit_foreach(bitstr, nbits, set_bit) { + ATF_REQUIRE_MSG(set_bit == i * 2 + 1, + "bit_foreach_%d_%s_%d_%s: " + "Failed on turn %d at location %d", + nbits, "alternating", 0, memloc, i, set_bit); + i++; + } + ATF_REQUIRE_MSG(i == nbits / 2, + "bit_foreach_%d_%s_%d_%s: Invalid number of turns %d", + nbits, "alternating", 0, memloc, i); + + /* Alternating bitstr, starts with 1 */ + i = 0; + memset(bitstr, 0x55, bitstr_size(nbits)); + bit_foreach(bitstr, nbits, set_bit) { + ATF_REQUIRE_MSG(set_bit == i * 2, + "bit_foreach_%d_%s_%d_%s: " + "Failed on turn %d at location %d", + nbits, "alternating", 1, memloc, i, set_bit); + i++; + } + ATF_REQUIRE_MSG(i == (nbits + 1) / 2, + "bit_foreach_%d_%s_%d_%s: Invalid number of turns %d", + nbits, "alternating", 1, memloc, i); +} + +BITSTRING_TC_DEFINE(bit_foreach_at) +/* bitstr_t *bitstr, int nbits, const char *memloc */ +{ + int i, s, e, set_bit; + + /* Invalid _start value */ + memset(bitstr, 0xFF, bitstr_size(nbits)); + bit_foreach_at(bitstr, nbits, nbits, set_bit) { + atf_tc_fail("bit_foreach_at_%d_%s_%s: Failed at location %d", + nbits, "invalid_start", memloc, set_bit); + } + + /* Varying start location */ + memset(bitstr, 0xAA, bitstr_size(nbits)); + for (s = 0; s < nbits; s++) { + i = 0; + bit_foreach_at(bitstr, s, nbits, set_bit) { + ATF_REQUIRE_MSG(set_bit == (i + s / 2) * 2 + 1, + "bit_foreach_at_%d_%s_%d_%s: " + "Failed on turn %d at location %d", + nbits, "vary_start", s, memloc, i, set_bit); + i++; + } + ATF_REQUIRE_MSG(i == nbits / 2 - s / 2, + "bit_foreach_at_%d_%s_%d_%s: Invalid number of turns %d", + nbits, "vary_start", s, memloc, i); + } + + /* Varying end location */ + memset(bitstr, 0xAA, bitstr_size(nbits)); + for (e = 0; e < nbits; e++) { + i = 0; + bit_foreach_at(bitstr, 0, e, set_bit) { + ATF_REQUIRE_MSG(set_bit == i * 2 + 1, + "bit_foreach_at_%d_%s_%d_%s: " + "Failed on turn %d at location %d", + nbits, "vary_end", e, memloc, i, set_bit); + i++; + } + ATF_REQUIRE_MSG(i == e / 2, + "bit_foreach_at_%d_%s_%d_%s: Invalid number of turns %d", + nbits, "vary_end", e, memloc, i); + } +} + +BITSTRING_TC_DEFINE(bit_foreach_unset) +/* bitstr_t *bitstr, int nbits, const char *memloc */ +{ + int i, unset_bit; + + /* Empty bitstr */ + i = 0; + memset(bitstr, 0, bitstr_size(nbits)); + bit_foreach_unset(bitstr, nbits, unset_bit) { + ATF_REQUIRE_MSG(unset_bit == i, + "bit_foreach_unset_%d_%s_%s: " + "Failed on turn %d at location %d", + nbits, "clear", memloc, i, unset_bit); + i++; + } + ATF_REQUIRE_MSG(i == nbits, + "bit_foreach_unset_%d_%s_%s: Invalid number of turns %d", + nbits, "set", memloc, i); + + /* Full bitstr */ + memset(bitstr, 0xFF, bitstr_size(nbits)); + bit_foreach_unset(bitstr, nbits, unset_bit) { + atf_tc_fail("bit_foreach_unset_%d_%s_%s: " + "Failed at location %d", + nbits, "set", memloc, unset_bit); + } + + /* Alternating bitstr, starts with 0 */ + i = 0; + memset(bitstr, 0xAA, bitstr_size(nbits)); + bit_foreach_unset(bitstr, nbits, unset_bit) { + ATF_REQUIRE_MSG(unset_bit == i * 2, + "bit_foreach_unset_%d_%s_%d_%s: " + "Failed on turn %d at location %d", + nbits, "alternating", 0, memloc, i, unset_bit); + i++; + } + ATF_REQUIRE_MSG(i == (nbits + 1) / 2, + "bit_foreach_unset_%d_%s_%d_%s: Invalid number of turns %d", + nbits, "alternating", 0, memloc, i); + + /* Alternating bitstr, starts with 1 */ + i = 0; + memset(bitstr, 0x55, bitstr_size(nbits)); + bit_foreach_unset(bitstr, nbits, unset_bit) { + ATF_REQUIRE_MSG(unset_bit == i * 2 + 1, + "bit_foreach_unset_%d_%s_%d_%s: " + "Failed on turn %d at location %d", + nbits, "alternating", 1, memloc, i, unset_bit); + i++; + } + ATF_REQUIRE_MSG(i == nbits / 2, + "bit_foreach_unset_%d_%s_%d_%s: Invalid number of turns %d", + nbits, "alternating", 1, memloc, i); +} + +BITSTRING_TC_DEFINE(bit_foreach_unset_at) +/* bitstr_t *bitstr, int nbits, const char *memloc */ +{ + int i, s, e, unset_bit; + + /* Invalid _start value */ + memset(bitstr, 0, bitstr_size(nbits)); + bit_foreach_unset_at(bitstr, nbits, nbits, unset_bit) { + atf_tc_fail("bit_foreach_unset_at_%d_%s_%s: " + "Failed at location %d", + nbits, "invalid_start", memloc, unset_bit); + } + + /* Varying start location */ + memset(bitstr, 0xAA, bitstr_size(nbits)); + for (s = 0; s < nbits; s++) { + i = 0; + bit_foreach_unset_at(bitstr, s, nbits, unset_bit) { + ATF_REQUIRE_MSG(unset_bit == (i + (s + 1) / 2) * 2, + "bit_foreach_unset_at_%d_%s_%d_%s: " + "Failed on turn %d at location %d", + nbits, "vary_start", s, memloc, i, unset_bit); + i++; + } + ATF_REQUIRE_MSG(i == (nbits + 1) / 2 - (s + 1) / 2, + "bit_foreach_unset_at_%d_%s_%d_%s: " + "Invalid number of turns %d", + nbits, "vary_start", s, memloc, i); + } + + /* Varying end location */ + memset(bitstr, 0xAA, bitstr_size(nbits)); + for (e = 0; e < nbits; e++) { + i = 0; + bit_foreach_unset_at(bitstr, 0, e, unset_bit) { + ATF_REQUIRE_MSG(unset_bit == i * 2, + "bit_foreach_unset_at_%d_%s_%d_%s: " + "Failed on turn %d at location %d", + nbits, "vary_end", e, memloc, i, unset_bit); + i++; + } + ATF_REQUIRE_MSG(i == (e + 1) / 2, + "bit_foreach_unset_at_%d_%s_%d_%s: " + "Invalid number of turns %d", + nbits, "vary_end", e, memloc, i); + } +} + ATF_TP_ADD_TCS(tp) { @@ -619,6 +822,10 @@ ATF_TP_ADD_TCS(tp) BITSTRING_TC_ADD(tp, bit_count); BITSTRING_TC_ADD(tp, bit_ffs_area_no_match); BITSTRING_TC_ADD(tp, bit_ffc_area_no_match); + BITSTRING_TC_ADD(tp, bit_foreach); + BITSTRING_TC_ADD(tp, bit_foreach_at); + BITSTRING_TC_ADD(tp, bit_foreach_unset); + BITSTRING_TC_ADD(tp, bit_foreach_unset_at); return (atf_no_error()); } From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:24:24 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4936865519B; Mon, 16 Aug 2021 21:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpRxh13mPz3jc8; Mon, 16 Aug 2021 21:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02C4311206; Mon, 16 Aug 2021 21:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GLONg4063157; Mon, 16 Aug 2021 21:24:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GLONqu063156; Mon, 16 Aug 2021 21:24:23 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:24:23 GMT Message-Id: <202108162124.17GLONqu063156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: d8aeab4b45a9 - main - Add gone_in(9) man page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d8aeab4b45a94b3e1ab4396235e4426747e310fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:24:24 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d8aeab4b45a94b3e1ab4396235e4426747e310fe commit d8aeab4b45a94b3e1ab4396235e4426747e310fe Author: Ed Maste AuthorDate: 2021-06-09 17:19:16 +0000 Commit: Ed Maste CommitDate: 2021-08-16 21:23:59 +0000 Add gone_in(9) man page Reviewed by: imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30703 --- share/man/man9/Makefile | 2 ++ share/man/man9/gone_in.9 | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index d7d26419b042..ac0451ece3fe 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -161,6 +161,7 @@ MAN= accept_filter.9 \ g_provider_by_name.9 \ groupmember.9 \ g_wither_geom.9 \ + gone_in.9 \ hardclock.9 \ hash.9 \ hashinit.9 \ @@ -1119,6 +1120,7 @@ MLINKS+=g_geom.9 g_destroy_geom.9 \ MLINKS+=g_provider.9 g_destroy_provider.9 \ g_provider.9 g_error_provider.9 \ g_provider.9 g_new_providerf.9 +MLINKS+=gone_in.9 gone_in_dev.9 MLINKS+=hash.9 hash32.9 \ hash.9 hash32_buf.9 \ hash.9 hash32_str.9 \ diff --git a/share/man/man9/gone_in.9 b/share/man/man9/gone_in.9 new file mode 100644 index 000000000000..b2474d610b24 --- /dev/null +++ b/share/man/man9/gone_in.9 @@ -0,0 +1,94 @@ +.\" Copyright (c) 2021 The FreeBSD Foundation +.\" +.\" This document was written by Ed Maste under sponsorhip from +.\" The FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 16, 2021 +.Dt GONE_IN 9 +.Os +.Sh NAME +.Nm gone_in , +.Nm gone_in_dev +.Nd deprecation notice functions +.Sh SYNOPSIS +.In sys/systm.h +.Ft void +.Fn gone_in "int major" "const char *msg" +.Ft void +.Fn gone_in_dev "device_t dev" "int major" "const char *msg" +.Sh DESCRIPTION +The +.Fn gone_in +functions are used to provide a notice that the kernel is using a driver or +some other functionality that is deprecated, and will be removed in a future +.Fx +release. +The notice is sent to the kernel +.Xr dmesg 8 +log and will appear on the console. +The +.Fa major +argument specifies the major version of the +.Fx +release that will remove the deprecated functionality. +.Pp +In releases before +.Fa major +the deprecation notice states +.Do +Deprecated code (to be removed in FreeBSD +.Fa major Ns ): +.Fa msg +.Dc . +In releases equal to and after +.Fa major +the notice states +.Do +Obsolete code will be removed soon: +.Fa msg +.Dc . +.Sh EXAMPLES +.Bd -literal -offset indent +void +sample_init(void) +{ + /* Initializaiton code omitted. */ + + gone_in(14, "Giant-locked filesystem"); +} + +int +example_driver_attach(struct example_driver_softc *sc) +{ + /* Attach code omitted. */ + + gone_in_dev(sc->dev, 14, "Giant-locked driver"); +} +.Ed +.Sh HISTORY +The +.Nm +functions first appeared in +.Fx 11 . From owner-dev-commits-src-main@freebsd.org Mon Aug 16 21:31:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C3F86655610; Mon, 16 Aug 2021 21:31:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpS5k58zTz3jvN; Mon, 16 Aug 2021 21:31:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F13A11129; Mon, 16 Aug 2021 21:31:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GLVMa7073549; Mon, 16 Aug 2021 21:31:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GLVMao073548; Mon, 16 Aug 2021 21:31:22 GMT (envelope-from git) Date: Mon, 16 Aug 2021 21:31:22 GMT Message-Id: <202108162131.17GLVMao073548@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 5f99ae56c919 - main - evdev: Use bit_foreach helper macro MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f99ae56c9196753ae162ad464c2969ad1a131b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 21:31:22 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=5f99ae56c9196753ae162ad464c2969ad1a131b6 commit 5f99ae56c9196753ae162ad464c2969ad1a131b6 Author: Vladimir Kondratyev AuthorDate: 2021-08-16 21:28:37 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-08-16 21:29:47 +0000 evdev: Use bit_foreach helper macro for traversing all bits set in the bitstring(9). While here move bit_change() definition to common header. MFC after: 1 week --- sys/dev/evdev/evdev.c | 25 ++++++------------------- sys/dev/evdev/evdev_private.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index bc28ae0734f9..597342a364af 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -93,15 +93,6 @@ static void evdev_start_repeat(struct evdev_dev *, uint16_t); static void evdev_stop_repeat(struct evdev_dev *); static int evdev_check_event(struct evdev_dev *, uint16_t, uint16_t, int32_t); -static inline void -bit_change(bitstr_t *bitstr, int bit, int value) -{ - if (value) - bit_set(bitstr, bit); - else - bit_clear(bitstr, bit); -} - struct evdev_dev * evdev_alloc(void) { @@ -908,20 +899,16 @@ evdev_restore_after_kdb(struct evdev_dev *evdev) EVDEV_LOCK_ASSERT(evdev); /* Report postponed leds */ - for (code = 0; code < LED_CNT; code++) - if (bit_test(evdev->ev_kdb_led_states, code)) - evdev_send_event(evdev, EV_LED, code, - !bit_test(evdev->ev_led_states, code)); + bit_foreach(evdev->ev_kdb_led_states, LED_CNT, code) + evdev_send_event(evdev, EV_LED, code, + !bit_test(evdev->ev_led_states, code)); bit_nclear(evdev->ev_kdb_led_states, 0, LED_MAX); /* Release stuck keys (CTRL + ALT + ESC) */ evdev_stop_repeat(evdev); - for (code = 0; code < KEY_CNT; code++) { - if (bit_test(evdev->ev_key_states, code)) { - evdev_send_event(evdev, EV_KEY, code, KEY_EVENT_UP); - evdev_send_event(evdev, EV_SYN, SYN_REPORT, 1); - } - } + bit_foreach(evdev->ev_key_states, KEY_CNT, code) + evdev_send_event(evdev, EV_KEY, code, KEY_EVENT_UP); + evdev_send_event(evdev, EV_SYN, SYN_REPORT, 1); } int diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h index 19636823b804..463f93847295 100644 --- a/sys/dev/evdev/evdev_private.h +++ b/sys/dev/evdev/evdev_private.h @@ -247,6 +247,16 @@ struct evdev_client (((client)->ec_buffer_ready + (client)->ec_buffer_size - \ (client)->ec_buffer_head) % (client)->ec_buffer_size) +/* bitstring(3) helper */ +static inline void +bit_change(bitstr_t *bitstr, int bit, int value) +{ + if (value) + bit_set(bitstr, bit); + else + bit_clear(bitstr, bit); +} + /* Input device interface: */ void evdev_send_event(struct evdev_dev *, uint16_t, uint16_t, int32_t); int evdev_inject_event(struct evdev_dev *, uint16_t, uint16_t, int32_t); From owner-dev-commits-src-main@freebsd.org Mon Aug 16 23:08:27 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9018A6571F0; Mon, 16 Aug 2021 23:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpVFl3PmNz3sMG; Mon, 16 Aug 2021 23:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D0B9124A9; Mon, 16 Aug 2021 23:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17GN8RQH097170; Mon, 16 Aug 2021 23:08:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GN8R1d097169; Mon, 16 Aug 2021 23:08:27 GMT (envelope-from git) Date: Mon, 16 Aug 2021 23:08:27 GMT Message-Id: <202108162308.17GN8R1d097169@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: cbfba56c45ab - main - routing: add IPv6 fib validation procedure. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cbfba56c45ab77303a3e25a82cf750043849760b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 23:08:27 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=cbfba56c45ab77303a3e25a82cf750043849760b commit cbfba56c45ab77303a3e25a82cf750043849760b Author: Alexander V. Chernikov AuthorDate: 2021-08-16 23:02:29 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-16 23:04:01 +0000 routing: add IPv6 fib validation procedure. Allow consistency validation of the inet6 fib based on rib data. Validation can be kicked off by loading test_lookup module and running sysctl net.route.test.run_inet6_scan=1 MFC after: 1 week --- sys/tests/fib_lookup/fib_lookup.c | 232 +++++++++++++++++++++++++++++++++++++- 1 file changed, 231 insertions(+), 1 deletion(-) diff --git a/sys/tests/fib_lookup/fib_lookup.c b/sys/tests/fib_lookup/fib_lookup.c index 55d2f3d4a4df..975644607409 100644 --- a/sys/tests/fib_lookup/fib_lookup.c +++ b/sys/tests/fib_lookup/fib_lookup.c @@ -319,7 +319,44 @@ cmp_dst(uint32_t fibnum, struct in_addr a) printf("[RT BUG] lookup for %s: RIB: %s/%d,nh=%u FIB: nh=%u\n", key_str, dst_str, plen, nhop_get_idx(nhop_select(rnd.rnd_nhop, 0)), - nhop_get_idx(nh_fib)); + nh_fib ? nhop_get_idx(nh_fib) : 0); + } + + return (false); +} + +static bool +cmp_dst6(uint32_t fibnum, const struct in6_addr *a) +{ + struct nhop_object *nh_fib; + struct rtentry *rt; + struct route_nhop_data rnd = {}; + + nh_fib = fib6_lookup(fibnum, a, 0, NHR_NONE, 0); + rt = fib6_lookup_rt(fibnum, a, 0, NHR_NONE, &rnd); + + if (nh_fib == NULL && rt == NULL) { + return (true); + } else if (nh_fib == nhop_select(rnd.rnd_nhop, 0)) { + return (true); + } + + struct in6_addr dst; + int plen; + uint32_t scopeid; + char key_str[INET6_ADDRSTRLEN], dst_str[INET6_ADDRSTRLEN]; + + inet_ntop(AF_INET6, a, key_str, sizeof(key_str)); + if (rnd.rnd_nhop == NULL) { + printf("[RT BUG] lookup for %s: RIB: ENOENT FIB: nh=%u\n", + key_str, nhop_get_idx(nh_fib)); + } else { + rt_get_inet6_prefix_plen(rt, &dst, &plen, &scopeid); + inet_ntop(AF_INET6, &dst, dst_str, sizeof(dst_str)); + printf("[RT BUG] lookup for %s: RIB: %s/%d,nh=%u FIB: nh=%u\n", + key_str, dst_str, plen, + nhop_get_idx(nhop_select(rnd.rnd_nhop, 0)), + nh_fib ? nhop_get_idx(nh_fib) : 0); } return (false); @@ -519,6 +556,199 @@ SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet_scan, CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, run_test_inet_scan, "I", "Execute fib4_lookup scan tests"); +struct inet6_array { + uint32_t alloc_items; + uint32_t num_items; + uint32_t rnh_prefixes; + int error; + struct in6_addr *arr; +}; + +static bool +safe_add(uint32_t *v, uint32_t inc) +{ + if (*v < (UINT32_MAX - inc)) { + *v += inc; + return (true); + } else { + *v -= (UINT32_MAX - inc + 1); + return (false); + } +} + +static bool +safe_dec(uint32_t *v, uint32_t inc) +{ + if (*v >= inc) { + *v -= inc; + return (true); + } else { + *v += (UINT32_MAX - inc + 1); + return (false); + } +} + +static void +inc_prefix6(struct in6_addr *addr, int inc) +{ + for (int i = 0; i < 4; i++) { + uint32_t v = ntohl(addr->s6_addr32[3 - i]); + bool ret = safe_add(&v, inc); + addr->s6_addr32[3 - i] = htonl(v); + if (ret) + return; + inc = 1; + } +} + +static void +dec_prefix6(struct in6_addr *addr, int dec) +{ + for (int i = 0; i < 4; i++) { + uint32_t v = ntohl(addr->s6_addr32[3 - i]); + bool ret = safe_dec(&v, dec); + addr->s6_addr32[3 - i] = htonl(v); + if (ret) + return; + dec = 1; + } +} + +static void +ipv6_writemask(struct in6_addr *addr6, uint8_t mask) +{ + uint32_t *cp; + + for (cp = (uint32_t *)addr6; mask >= 32; mask -= 32) + *cp++ = 0xFFFFFFFF; + if (mask > 0) + *cp = htonl(mask ? ~((1 << (32 - mask)) - 1) : 0); +} + +/* + * For each prefix, add the following records to the lookup array: + * * prefix-1, prefix, prefix + 1, prefix_end, prefix_end + 1 + */ +static int +add_prefix6(struct rtentry *rt, void *_data) +{ + struct inet6_array *pa = (struct inet6_array *)_data; + struct in6_addr addr, naddr; + int plen; + uint32_t scopeid; + + pa->rnh_prefixes++; + + if (pa->num_items + 5 >= pa->alloc_items) { + if (pa->error == 0) + pa->error = ENOSPC; + return (0); + } + + rt_get_inet6_prefix_plen(rt, &addr, &plen, &scopeid); + + pa->arr[pa->num_items++] = addr; + if (!IN6_ARE_ADDR_EQUAL(&addr, &in6addr_any)) { + naddr = addr; + dec_prefix6(&naddr, 1); + pa->arr[pa->num_items++] = naddr; + naddr = addr; + inc_prefix6(&naddr, 1); + pa->arr[pa->num_items++] = naddr; + + /* assume mask != 0 */ + struct in6_addr mask6; + ipv6_writemask(&mask6, plen); + naddr = addr; + for (int i = 0; i < 3; i++) + naddr.s6_addr32[i] = htonl(ntohl(naddr.s6_addr32[i]) | ~ntohl(mask6.s6_addr32[i])); + + pa->arr[pa->num_items++] = naddr; + inc_prefix6(&naddr, 1); + pa->arr[pa->num_items++] = naddr; + } + + return (0); +} + +static bool +prepare_list6(uint32_t fibnum, struct inet6_array *pa) +{ + struct rib_head *rh; + + rh = rt_tables_get_rnh(fibnum, AF_INET6); + + uint32_t num_prefixes = rh->rnh_prefixes; + bzero(pa, sizeof(struct inet6_array)); + pa->alloc_items = (num_prefixes + 10) * 5; + pa->arr = mallocarray(pa->alloc_items, sizeof(struct in6_addr), + M_TEMP, M_ZERO | M_WAITOK); + + rib_walk(fibnum, AF_INET6, false, add_prefix6, pa); + + if (pa->error != 0) { + printf("prefixes: old: %u, current: %u, walked: %u, allocated: %u\n", + num_prefixes, rh->rnh_prefixes, pa->rnh_prefixes, pa->alloc_items); + } + + return (pa->error == 0); +} + +static int +run_test_inet6_scan(SYSCTL_HANDLER_ARGS) +{ + struct epoch_tracker et; + + int count = 0; + int error = sysctl_handle_int(oidp, &count, 0, req); + if (error != 0) + return (error); + + if (count == 0) + return (0); + + struct inet6_array pa = {}; + uint32_t fibnum = curthread->td_proc->p_fibnum; + + if (!prepare_list6(fibnum, &pa)) + return (pa.error); + + struct timespec ts_pre, ts_post; + int64_t total_diff = 1; + uint64_t total_packets = 0; + int failure_count = 0; + + NET_EPOCH_ENTER(et); + nanouptime(&ts_pre); + for (int i = 0; i < pa.num_items; i++) { + if (!cmp_dst6(fibnum, &pa.arr[i])) { + failure_count++; + } + total_packets++; + } + nanouptime(&ts_post); + NET_EPOCH_EXIT(et); + + if (pa.arr != NULL) + free(pa.arr, M_TEMP); + + /* Signal error to userland */ + if (failure_count > 0) { + printf("[RT ERROR] total failures: %d\n", failure_count); + return (EINVAL); + } + + total_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 + + (ts_post.tv_nsec - ts_pre.tv_nsec); + printf("%zu packets in %zu nanoseconds, %zu pps\n", + total_packets, total_diff, total_packets * 1000000000 / total_diff); + + return (0); +} +SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet6_scan, + CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + 0, 0, run_test_inet6_scan, "I", "Execute fib6_lookup scan tests"); + #define LPS_SEQ 0x1 #define LPS_ANN 0x2 #define LPS_REP 0x4 From owner-dev-commits-src-main@freebsd.org Tue Aug 17 06:31:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4279A65D772; Tue, 17 Aug 2021 06:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gph5P1THnz3p56; Tue, 17 Aug 2021 06:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AF77185D4; Tue, 17 Aug 2021 06:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17H6VrxW094330; Tue, 17 Aug 2021 06:31:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17H6VrAE094329; Tue, 17 Aug 2021 06:31:53 GMT (envelope-from git) Date: Tue, 17 Aug 2021 06:31:53 GMT Message-Id: <202108170631.17H6VrAE094329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: e8ad0a0059af - main - ipmi: New tunable to deactivate IPMI watchdog MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e8ad0a0059afe1cd0af39bab49018ae7bc9be937 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 06:31:53 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=e8ad0a0059afe1cd0af39bab49018ae7bc9be937 commit e8ad0a0059afe1cd0af39bab49018ae7bc9be937 Author: Wojciech Macek AuthorDate: 2021-08-17 06:28:21 +0000 Commit: Wojciech Macek CommitDate: 2021-08-17 06:31:00 +0000 ipmi: New tunable to deactivate IPMI watchdog In case we want to use other WD than IPMI-provided, add sysctl to disable initialization. Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D31548 --- sys/dev/ipmi/ipmi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index cd2a289b25cb..77fd4b68ae96 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -96,11 +96,14 @@ static int wd_shutdown_countdown = 0; /* sec */ static int wd_startup_countdown = 0; /* sec */ static int wd_pretimeout_countdown = 120; /* sec */ static int cycle_wait = 10; /* sec */ +static int wd_init_disable = 0; static SYSCTL_NODE(_hw, OID_AUTO, ipmi, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "IPMI driver parameters"); SYSCTL_INT(_hw_ipmi, OID_AUTO, on, CTLFLAG_RWTUN, &on, 0, ""); +SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_init_disable, CTLFLAG_RWTUN, + &wd_init_disable, 0, ""); SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_timer_actions, CTLFLAG_RW, &wd_timer_actions, 0, "IPMI watchdog timer actions (including pre-timeout interrupt)"); @@ -909,7 +912,7 @@ ipmi_startup(void *arg) * Probe for watchdog, but only for backends which support * polled driver requests. */ - if (sc->ipmi_driver_requests_polled) { + if (!wd_init_disable && sc->ipmi_driver_requests_polled) { IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_GET_WDOG, 0, 0); From owner-dev-commits-src-main@freebsd.org Tue Aug 17 07:04:05 2021 Return-Path: Delivered-To: dev-commits-src-main@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 DF91565E608; Tue, 17 Aug 2021 07:04:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GphpY5l6Mz3qB7; Tue, 17 Aug 2021 07:04:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD29A1933D; Tue, 17 Aug 2021 07:04:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17H7458i037292; Tue, 17 Aug 2021 07:04:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17H745ld037291; Tue, 17 Aug 2021 07:04:05 GMT (envelope-from git) Date: Tue, 17 Aug 2021 07:04:05 GMT Message-Id: <202108170704.17H745ld037291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 1b9ce0885e5f - main - sdhci_xenon: add AP807 compatible string MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b9ce0885e5f53ea5818ee593babf11f6b5d5761 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 07:04:05 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=1b9ce0885e5f53ea5818ee593babf11f6b5d5761 commit 1b9ce0885e5f53ea5818ee593babf11f6b5d5761 Author: Bartlomiej Grzesik AuthorDate: 2021-07-14 12:47:40 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-17 07:03:37 +0000 sdhci_xenon: add AP807 compatible string This patch adds compatible string for xenon controller found on AP807 north brige. It is fully compatible with existing driver. Reviewed by: manu Sponsored by: Semihalf Differential Revision: https://reviews.freebsd.org/D31407 --- sys/dev/sdhci/sdhci_xenon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index 3f312921154f..10cbc5991119 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -74,6 +74,7 @@ static struct ofw_compat_data compat_data[] = { #ifdef SOC_MARVELL_8K { "marvell,armada-cp110-sdhci", 1 }, { "marvell,armada-ap806-sdhci", 1 }, + { "marvell,armada-ap807-sdhci", 1 }, #endif { NULL, 0 } }; From owner-dev-commits-src-main@freebsd.org Tue Aug 17 07:04:07 2021 Return-Path: Delivered-To: dev-commits-src-main@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 115C765E5CC; Tue, 17 Aug 2021 07:04:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GphpZ6md4z3qX2; Tue, 17 Aug 2021 07:04:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFFF31967F; Tue, 17 Aug 2021 07:04:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17H7461a037316; Tue, 17 Aug 2021 07:04:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17H746L2037315; Tue, 17 Aug 2021 07:04:06 GMT (envelope-from git) Date: Tue, 17 Aug 2021 07:04:06 GMT Message-Id: <202108170704.17H746L2037315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 6ad816a99917 - main - sdhci_xenon: remove redundant code in property parsing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ad816a999171874c36c73d5794d0d25ff8fd311 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 07:04:07 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=6ad816a999171874c36c73d5794d0d25ff8fd311 commit 6ad816a999171874c36c73d5794d0d25ff8fd311 Author: Bartlomiej Grzesik AuthorDate: 2021-07-15 15:20:46 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-17 07:03:45 +0000 sdhci_xenon: remove redundant code in property parsing Remove redundant ofw property parsing in driver code, is already taken care of in mmc_fdt_helpers. Move ofw parsing to attach method. Reviewed by: manu Sponsored by: Semihalf Differential Revision: https://reviews.freebsd.org/D31409 --- sys/dev/sdhci/sdhci_xenon.c | 69 +++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index 10cbc5991119..b6f7513245eb 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -83,9 +83,6 @@ struct sdhci_xenon_softc { device_t dev; /* Controller device */ int slot_id; /* Controller ID */ phandle_t node; /* FDT node */ - uint32_t quirks; /* Chip specific quirks */ - uint32_t caps; /* If we override SDHCI_CAPABILITIES */ - uint32_t max_clk; /* Max possible freq */ struct resource *irq_res; /* IRQ resource */ void *intrhand; /* Interrupt handle */ struct sdhci_fdt_gpio *gpio; /* GPIO pins for CD detection. */ @@ -95,7 +92,6 @@ struct sdhci_xenon_softc { uint8_t znr; /* PHY ZNR */ uint8_t zpr; /* PHY ZPR */ - bool no_18v; /* No 1.8V support */ bool slow_mode; /* PHY slow mode */ struct mmc_fdt_helper mmc_helper; /* MMC helper for parsing FDT */ @@ -509,32 +505,17 @@ sdhci_xenon_switch_vccq(device_t brdev, device_t reqdev) } } -static int -sdhci_xenon_probe(device_t dev) +static void +sdhci_xenon_fdt_parse(device_t dev, struct sdhci_slot *slot) { struct sdhci_xenon_softc *sc = device_get_softc(dev); pcell_t cid; - sc->quirks = 0; - sc->slot_id = 0; - sc->max_clk = XENON_MMC_MAX_CLK; - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) - return (ENXIO); - - sc->node = ofw_bus_get_node(dev); - device_set_desc(dev, "Armada Xenon SDHCI controller"); + mmc_fdt_parse(dev, 0, &sc->mmc_helper, &slot->host); /* Allow dts to patch quirks, slots, and max-frequency. */ if ((OF_getencprop(sc->node, "quirks", &cid, sizeof(cid))) > 0) - sc->quirks = cid; - if ((OF_getencprop(sc->node, "max-frequency", &cid, sizeof(cid))) > 0) - sc->max_clk = cid; - if (OF_hasprop(sc->node, "no-1-8-v")) - sc->no_18v = true; + slot->quirks = cid; if (OF_hasprop(sc->node, "marvell,xenon-phy-slow-mode")) sc->slow_mode = true; sc->znr = XENON_ZNR_DEF_VALUE; @@ -545,6 +526,18 @@ sdhci_xenon_probe(device_t dev) if ((OF_getencprop(sc->node, "marvell,xenon-phy-zpr", &cid, sizeof(cid))) > 0) sc->zpr = cid & XENON_ZPR_MASK; +} + +static int +sdhci_xenon_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Armada Xenon SDHCI controller"); return (0); } @@ -558,6 +551,8 @@ sdhci_xenon_attach(device_t dev) uint32_t reg; sc->dev = dev; + sc->slot_id = 0; + sc->node = ofw_bus_get_node(dev); /* Allocate IRQ. */ rid = 0; @@ -581,34 +576,34 @@ sdhci_xenon_attach(device_t dev) slot = malloc(sizeof(*slot), M_DEVBUF, M_ZERO | M_WAITOK); + /* + * Set up any gpio pin handling described in the FDT data. This cannot + * fail; see comments in sdhci_fdt_gpio.h for details. + */ + sc->gpio = sdhci_fdt_gpio_setup(dev, slot); + + sdhci_xenon_fdt_parse(dev, slot); + + slot->max_clk = XENON_MMC_MAX_CLK; + if (slot->host.f_max > 0) + slot->max_clk = slot->host.f_max; /* Check if the device is flagged as non-removable. */ - if (OF_hasprop(sc->node, "non-removable")) { + if (sc->mmc_helper.props & MMC_PROP_NON_REMOVABLE) { slot->opt |= SDHCI_NON_REMOVABLE; if (bootverbose) device_printf(dev, "Non-removable media\n"); } - slot->quirks = sc->quirks; - slot->caps = sc->caps; - slot->max_clk = sc->max_clk; sc->slot = slot; - /* - * Set up any gpio pin handling described in the FDT data. This cannot - * fail; see comments in sdhci_fdt_gpio.h for details. - */ - sc->gpio = sdhci_fdt_gpio_setup(dev, slot); - - mmc_fdt_parse(dev, 0, &sc->mmc_helper, &sc->slot->host); - if (sdhci_init_slot(dev, sc->slot, 0)) goto fail; /* 1.2V signaling is not supported. */ sc->slot->host.caps &= ~MMC_CAP_SIGNALING_120; - /* Disable UHS in case of lack of 1.8V VCCQ or the PHY slow mode. */ - if (sc->no_18v || sc->slow_mode) + /* Disable UHS in case of the PHY slow mode. */ + if (sc->slow_mode) sc->slot->host.caps &= ~MMC_CAP_SIGNALING_180; /* Activate the interrupt */ From owner-dev-commits-src-main@freebsd.org Tue Aug 17 08:35:06 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BB44365FA05; Tue, 17 Aug 2021 08:35:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpkqZ4cyMz4SJK; Tue, 17 Aug 2021 08:35:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86DB01A34B; Tue, 17 Aug 2021 08:35:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17H8Z6fa057322; Tue, 17 Aug 2021 08:35:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17H8Z6KC057321; Tue, 17 Aug 2021 08:35:06 GMT (envelope-from git) Date: Tue, 17 Aug 2021 08:35:06 GMT Message-Id: <202108170835.17H8Z6KC057321@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 322e5efda857 - main - ipfw: fix possible data race between jump cache reading and updating. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 322e5efda8578bb9c0a0ab0ef785cd1e1c222c85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 08:35:06 -0000 The branch main has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=322e5efda8578bb9c0a0ab0ef785cd1e1c222c85 commit 322e5efda8578bb9c0a0ab0ef785cd1e1c222c85 Author: Andrey V. Elsukov AuthorDate: 2021-08-17 08:08:28 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-08-17 08:08:28 +0000 ipfw: fix possible data race between jump cache reading and updating. Jump cache is used to reduce the cost of rule lookup for O_SKIPTO and O_CALLRETURN actions. It uses rules chain id to check correctness of cached value. But due to the possible race, there is the chance that one thread can read invalid value. In some cases this can lead to out of bounds access and panic. Use thread fence operations to constrain the reordering of accesses. Also rename jump_fast and jump_linear functions to jump_cached and jump_lookup_pos respectively. Submitted by: Arseny Smalyuk Reviewed by: melifaro Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D31484 --- sys/netpfil/ipfw/ip_fw2.c | 107 ++++++++++++++++++++++++--------------- sys/netpfil/ipfw/ip_fw_private.h | 12 ++++- 2 files changed, 75 insertions(+), 44 deletions(-) diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c index f03180cd3bca..bcf775009d25 100644 --- a/sys/netpfil/ipfw/ip_fw2.c +++ b/sys/netpfil/ipfw/ip_fw2.c @@ -144,14 +144,14 @@ VNET_DEFINE(unsigned int, fw_tables_sets) = 0; /* Don't use set-aware tables */ /* Use 128 tables by default */ static unsigned int default_fw_tables = IPFW_TABLES_DEFAULT; +static int jump_lookup_pos(struct ip_fw_chain *chain, struct ip_fw *f, int num, + int tablearg, int jump_backwards); #ifndef LINEAR_SKIPTO -static int jump_fast(struct ip_fw_chain *chain, struct ip_fw *f, int num, +static int jump_cached(struct ip_fw_chain *chain, struct ip_fw *f, int num, int tablearg, int jump_backwards); -#define JUMP(ch, f, num, targ, back) jump_fast(ch, f, num, targ, back) +#define JUMP(ch, f, num, targ, back) jump_cached(ch, f, num, targ, back) #else -static int jump_linear(struct ip_fw_chain *chain, struct ip_fw *f, int num, - int tablearg, int jump_backwards); -#define JUMP(ch, f, num, targ, back) jump_linear(ch, f, num, targ, back) +#define JUMP(ch, f, num, targ, back) jump_lookup_pos(ch, f, num, targ, back) #endif /* @@ -1227,60 +1227,83 @@ set_match(struct ip_fw_args *args, int slot, args->flags |= IPFW_ARGS_REF; } -#ifndef LINEAR_SKIPTO -/* - * Helper function to enable cached rule lookups using - * cached_id and cached_pos fields in ipfw rule. - */ static int -jump_fast(struct ip_fw_chain *chain, struct ip_fw *f, int num, +jump_lookup_pos(struct ip_fw_chain *chain, struct ip_fw *f, int num, int tablearg, int jump_backwards) { - int f_pos; + int f_pos, i; - /* If possible use cached f_pos (in f->cached_pos), - * whose version is written in f->cached_id - * (horrible hacks to avoid changing the ABI). - */ - if (num != IP_FW_TARG && f->cached_id == chain->id) - f_pos = f->cached_pos; - else { - int i = IP_FW_ARG_TABLEARG(chain, num, skipto); - /* make sure we do not jump backward */ - if (jump_backwards == 0 && i <= f->rulenum) - i = f->rulenum + 1; - if (chain->idxmap != NULL) - f_pos = chain->idxmap[i]; - else - f_pos = ipfw_find_rule(chain, i, 0); - /* update the cache */ - if (num != IP_FW_TARG) { - f->cached_id = chain->id; - f->cached_pos = f_pos; - } - } + i = IP_FW_ARG_TABLEARG(chain, num, skipto); + /* make sure we do not jump backward */ + if (jump_backwards == 0 && i <= f->rulenum) + i = f->rulenum + 1; + +#ifndef LINEAR_SKIPTO + if (chain->idxmap != NULL) + f_pos = chain->idxmap[i]; + else + f_pos = ipfw_find_rule(chain, i, 0); +#else + f_pos = chain->idxmap[i]; +#endif /* LINEAR_SKIPTO */ return (f_pos); } -#else + + +#ifndef LINEAR_SKIPTO /* - * Helper function to enable real fast rule lookups. + * Helper function to enable cached rule lookups using + * cache.id and cache.pos fields in ipfw rule. */ static int -jump_linear(struct ip_fw_chain *chain, struct ip_fw *f, int num, +jump_cached(struct ip_fw_chain *chain, struct ip_fw *f, int num, int tablearg, int jump_backwards) { int f_pos; - num = IP_FW_ARG_TABLEARG(chain, num, skipto); - /* make sure we do not jump backward */ - if (jump_backwards == 0 && num <= f->rulenum) - num = f->rulenum + 1; - f_pos = chain->idxmap[num]; + /* Can't use cache with IP_FW_TARG */ + if (num == IP_FW_TARG) + return jump_lookup_pos(chain, f, num, tablearg, jump_backwards); + + /* + * If possible use cached f_pos (in f->cache.pos), + * whose version is written in f->cache.id (horrible hacks + * to avoid changing the ABI). + * + * Multiple threads can execute the same rule simultaneously, + * we need to ensure that cache.pos is updated before cache.id. + */ +#ifdef __LP64__ + struct ip_fw_jump_cache cache; + + cache.raw_value = f->cache.raw_value; + if (cache.id == chain->id) + return (cache.pos); + + f_pos = jump_lookup_pos(chain, f, num, tablearg, jump_backwards); + + cache.pos = f_pos; + cache.id = chain->id; + f->cache.raw_value = cache.raw_value; +#else + if (f->cache.id == chain->id) { + /* Load pos after id */ + atomic_thread_fence_acq(); + return (f->cache.pos); + } + + f_pos = jump_lookup_pos(chain, f, num, tablearg, jump_backwards); + + f->cache.pos = f_pos; + /* Store id after pos */ + atomic_thread_fence_rel(); + f->cache.id = chain->id; +#endif /* !__LP64__ */ return (f_pos); } -#endif +#endif /* !LINEAR_SKIPTO */ #define TARG(k, f) IP_FW_ARG_TABLEARG(chain, k, f) /* diff --git a/sys/netpfil/ipfw/ip_fw_private.h b/sys/netpfil/ipfw/ip_fw_private.h index 56624209e4cb..1440b1a40eee 100644 --- a/sys/netpfil/ipfw/ip_fw_private.h +++ b/sys/netpfil/ipfw/ip_fw_private.h @@ -265,6 +265,15 @@ struct tables_config; * ACTION_PTR(r) is the start of the first action (things to do * once a rule matched). */ +struct ip_fw_jump_cache { + union { + struct { + uint32_t id; + uint32_t pos; + }; + uint64_t raw_value; + }; +}; struct ip_fw { uint16_t act_ofs; /* offset of action in 32-bit units */ @@ -273,10 +282,9 @@ struct ip_fw { uint8_t set; /* rule set (0..31) */ uint8_t flags; /* currently unused */ counter_u64_t cntr; /* Pointer to rule counters */ + struct ip_fw_jump_cache cache; /* used by jump_fast */ uint32_t timestamp; /* tv_sec of last match */ uint32_t id; /* rule id */ - uint32_t cached_id; /* used by jump_fast */ - uint32_t cached_pos; /* used by jump_fast */ uint32_t refcnt; /* number of references */ struct ip_fw *next; /* linked list of deleted rules */ From owner-dev-commits-src-main@freebsd.org Tue Aug 17 09:09:15 2021 Return-Path: Delivered-To: dev-commits-src-main@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 380516600D0; Tue, 17 Aug 2021 09:09:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GplZz0rK4z4V6P; Tue, 17 Aug 2021 09:09:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0519B1AF89; Tue, 17 Aug 2021 09:09:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17H99E31098362; Tue, 17 Aug 2021 09:09:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17H99EmP098361; Tue, 17 Aug 2021 09:09:14 GMT (envelope-from git) Date: Tue, 17 Aug 2021 09:09:14 GMT Message-Id: <202108170909.17H99EmP098361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 35cf9fecbd80 - main - Enable rc.d/jail within jails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35cf9fecbd80f56e39524f480240acfd953c93e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 09:09:15 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=35cf9fecbd80f56e39524f480240acfd953c93e1 commit 35cf9fecbd80f56e39524f480240acfd953c93e1 Author: Dan Langille AuthorDate: 2021-08-15 16:53:16 +0000 Commit: Kristof Provost CommitDate: 2021-08-17 07:07:53 +0000 Enable rc.d/jail within jails Jails with jails is a supported. This change allows the script to run upon startup with a jail. Without this, jails are not automatically started within jails. --- libexec/rc/rc.d/jail | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/jail b/libexec/rc/rc.d/jail index 1a3b551c9a4c..ff4336131bc9 100755 --- a/libexec/rc/rc.d/jail +++ b/libexec/rc/rc.d/jail @@ -6,7 +6,7 @@ # PROVIDE: jail # REQUIRE: LOGIN FILESYSTEMS # BEFORE: securelevel -# KEYWORD: nojail shutdown +# KEYWORD: shutdown . /etc/rc.subr From owner-dev-commits-src-main@freebsd.org Tue Aug 17 09:34:05 2021 Return-Path: Delivered-To: dev-commits-src-main@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 549F9660459; Tue, 17 Aug 2021 09:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gpm7d1fcJz4Wds; Tue, 17 Aug 2021 09:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 208AE1B26B; Tue, 17 Aug 2021 09:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17H9Y5Ik037008; Tue, 17 Aug 2021 09:34:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17H9Y4uU037007; Tue, 17 Aug 2021 09:34:04 GMT (envelope-from git) Date: Tue, 17 Aug 2021 09:34:04 GMT Message-Id: <202108170934.17H9Y4uU037007@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 5469a9953005 - main - unbound: Vendor import 1.13.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5469a9953005a9a4d4aad7be88545d441622e9a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 09:34:05 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=5469a9953005a9a4d4aad7be88545d441622e9a0 commit 5469a9953005a9a4d4aad7be88545d441622e9a0 Merge: 35cf9fecbd80 625f1c1312fb Author: Cy Schubert AuthorDate: 2021-08-17 09:32:56 +0000 Commit: Cy Schubert CommitDate: 2021-08-17 09:32:56 +0000 unbound: Vendor import 1.13.2 Merge commit '625f1c1312fb7defbd148c8ba121a0cf058707ef' MFC after: 1 month .../unbound/.github/ISSUE_TEMPLATE/bug_report.md | 41 + .../.github/ISSUE_TEMPLATE/feature_request.md | 31 + .../unbound/.github/workflows/analysis_ports.yml | 346 +++++ contrib/unbound/.github/workflows/ci.yml | 21 + contrib/unbound/.travis.yml | 124 +- contrib/unbound/Makefile.in | 509 ++++--- contrib/unbound/README.md | 1 + contrib/unbound/acx_nlnetlabs.m4 | 23 +- contrib/unbound/cachedb/cachedb.c | 8 +- contrib/unbound/compat/ctime_r.c | 2 +- contrib/unbound/config.guess | 1222 +++++++++-------- contrib/unbound/config.h.in | 26 + contrib/unbound/config.sub | 59 +- contrib/unbound/configure | 134 +- contrib/unbound/configure.ac | 72 +- contrib/unbound/contrib/ios/install_tools.sh | 8 +- contrib/unbound/contrib/unbound.service.in | 4 + contrib/unbound/contrib/unbound.spec | 20 +- contrib/unbound/contrib/unbound_munin_ | 71 +- contrib/unbound/daemon/daemon.c | 13 +- contrib/unbound/daemon/remote.c | 111 +- contrib/unbound/daemon/unbound.c | 29 + contrib/unbound/daemon/worker.c | 85 +- contrib/unbound/dnscrypt/dnscrypt.c | 2 + contrib/unbound/dnstap/dnstap.c | 120 +- contrib/unbound/dnstap/dnstap.h | 12 +- contrib/unbound/dnstap/unbound-dnstap-socket.c | 26 +- contrib/unbound/doc/Changelog | 374 ++++++ contrib/unbound/doc/README | 2 +- contrib/unbound/doc/example.conf.in | 30 +- contrib/unbound/doc/libunbound.3.in | 4 +- contrib/unbound/doc/unbound-anchor.8.in | 2 +- contrib/unbound/doc/unbound-checkconf.8.in | 2 +- contrib/unbound/doc/unbound-control.8.in | 7 +- contrib/unbound/doc/unbound-host.1.in | 2 +- contrib/unbound/doc/unbound.8.in | 4 +- contrib/unbound/doc/unbound.conf.5.in | 184 ++- contrib/unbound/doc/unbound.doxygen | 2 +- contrib/unbound/edns-subnet/subnetmod.c | 36 +- contrib/unbound/ipsecmod/ipsecmod.c | 17 + contrib/unbound/iterator/iter_scrub.c | 24 +- contrib/unbound/iterator/iter_utils.c | 34 +- contrib/unbound/iterator/iter_utils.h | 23 +- contrib/unbound/iterator/iterator.c | 79 +- contrib/unbound/iterator/iterator.h | 8 +- contrib/unbound/libunbound/context.c | 4 +- contrib/unbound/libunbound/libworker.c | 69 +- contrib/unbound/libunbound/worker.h | 8 - contrib/unbound/respip/respip.c | 2 +- contrib/unbound/services/authzone.c | 1405 +++++++++++++++++++- contrib/unbound/services/authzone.h | 96 +- contrib/unbound/services/cache/dns.c | 5 +- contrib/unbound/services/cache/dns.h | 4 +- contrib/unbound/services/cache/infra.c | 3 + contrib/unbound/services/listen_dnsport.c | 263 +++- contrib/unbound/services/listen_dnsport.h | 28 +- contrib/unbound/services/localzone.c | 16 +- contrib/unbound/services/localzone.h | 2 +- contrib/unbound/services/mesh.c | 17 +- contrib/unbound/services/modstack.c | 65 +- contrib/unbound/services/outside_network.c | 463 +++++-- contrib/unbound/services/outside_network.h | 45 +- contrib/unbound/services/rpz.c | 26 +- contrib/unbound/sldns/keyraw.c | 333 ++++- contrib/unbound/sldns/keyraw.h | 20 + contrib/unbound/sldns/parse.c | 3 + contrib/unbound/sldns/parse.h | 3 - contrib/unbound/sldns/parseutil.c | 15 + contrib/unbound/sldns/parseutil.h | 1 + contrib/unbound/sldns/rrdef.c | 15 +- contrib/unbound/sldns/rrdef.h | 10 +- contrib/unbound/sldns/sbuffer.h | 2 - contrib/unbound/sldns/str2wire.c | 683 +++++++++- contrib/unbound/sldns/str2wire.h | 31 + contrib/unbound/sldns/wire2str.c | 279 ++++ contrib/unbound/sldns/wire2str.h | 12 + contrib/unbound/smallapp/unbound-checkconf.c | 4 +- contrib/unbound/smallapp/unbound-control.c | 37 +- contrib/unbound/smallapp/unbound-host.c | 2 +- contrib/unbound/smallapp/worker_cb.c | 18 +- contrib/unbound/testcode/readzone.c | 158 +++ contrib/unbound/testcode/unittcpreuse.c | 236 ++++ contrib/unbound/testcode/unitzonemd.c | 537 ++++++++ contrib/unbound/testdata/auth_zonemd_anchor.rpl | 234 ++++ .../unbound/testdata/auth_zonemd_anchor_fail.rpl | 236 ++++ contrib/unbound/testdata/auth_zonemd_chain.rpl | 234 ++++ .../unbound/testdata/auth_zonemd_chain_fail.rpl | 236 ++++ contrib/unbound/testdata/auth_zonemd_file.rpl | 183 +++ contrib/unbound/testdata/auth_zonemd_file_fail.rpl | 185 +++ contrib/unbound/testdata/auth_zonemd_insecure.rpl | 215 +++ .../testdata/auth_zonemd_insecure_absent.rpl | 217 +++ .../auth_zonemd_insecure_absent_reject.rpl | 218 +++ .../unbound/testdata/auth_zonemd_insecure_fail.rpl | 218 +++ contrib/unbound/testdata/auth_zonemd_nokey.rpl | 212 +++ .../testdata/auth_zonemd_permissive_mode.rpl | 187 +++ contrib/unbound/testdata/auth_zonemd_xfr.rpl | 238 ++++ .../unbound/testdata/auth_zonemd_xfr_anchor.rpl | 285 ++++ .../testdata/auth_zonemd_xfr_anchor_fail.rpl | 266 ++++ contrib/unbound/testdata/auth_zonemd_xfr_chain.rpl | 310 +++++ .../testdata/auth_zonemd_xfr_chain_fail.rpl | 321 +++++ contrib/unbound/testdata/auth_zonemd_xfr_fail.rpl | 241 ++++ .../127.0.0.1/example.com.zone | 3 + .../http_user_agent.tdir/http_user_agent.conf | 24 + .../http_user_agent.tdir/http_user_agent.dsc | 16 + .../http_user_agent.tdir/http_user_agent.post | 11 + .../http_user_agent.tdir/http_user_agent.pre | 37 + .../http_user_agent.tdir/http_user_agent.test | 103 ++ .../testdata/http_user_agent.tdir/petal.key | 21 + .../testdata/http_user_agent.tdir/petal.pem | 14 + .../http_user_agent.tdir/unbound_control.key | 39 + .../http_user_agent.tdir/unbound_control.pem | 22 + .../http_user_agent.tdir/unbound_server.key | 39 + .../http_user_agent.tdir/unbound_server.pem | 22 + contrib/unbound/testdata/rpz_rootwc.rpl | 162 +++ .../testdata/svcb.tdir/crypto.cloudflare.com.zone | 9 + contrib/unbound/testdata/svcb.tdir/svcb.dsc | 16 + .../testdata/svcb.tdir/svcb.failure-cases-01 | 9 + .../testdata/svcb.tdir/svcb.failure-cases-02 | 8 + .../testdata/svcb.tdir/svcb.failure-cases-03 | 8 + .../testdata/svcb.tdir/svcb.failure-cases-04 | 8 + .../testdata/svcb.tdir/svcb.success-cases.zone | 47 + .../testdata/svcb.tdir/svcb.success-cases.zone.cmp | 10 + contrib/unbound/testdata/svcb.tdir/svcb.test | 97 ++ .../testdata/svcb.tdir/svcb.test-vectors-pf.zone | 92 ++ .../testdata/svcb.tdir/svcb.test-vectors-wf.zone | 232 ++++ contrib/unbound/testdata/zonemd.example1.zone | 4 + contrib/unbound/testdata/zonemd.example10.zone | 35 + contrib/unbound/testdata/zonemd.example11.zone | 33 + contrib/unbound/testdata/zonemd.example12.zone | 35 + contrib/unbound/testdata/zonemd.example13.zone | 33 + contrib/unbound/testdata/zonemd.example14.zone | 35 + contrib/unbound/testdata/zonemd.example15.zone | 35 + contrib/unbound/testdata/zonemd.example16.zone | 11 + contrib/unbound/testdata/zonemd.example17.zone | 11 + contrib/unbound/testdata/zonemd.example2.zone | 15 + contrib/unbound/testdata/zonemd.example3.zone | 34 + contrib/unbound/testdata/zonemd.example4.zone | 36 + contrib/unbound/testdata/zonemd.example5.zone | 34 + contrib/unbound/testdata/zonemd.example6.zone | 36 + contrib/unbound/testdata/zonemd.example7.zone | 31 + contrib/unbound/testdata/zonemd.example8.zone | 34 + contrib/unbound/testdata/zonemd.example9.zone | 35 + contrib/unbound/testdata/zonemd.example_a1.zone | 6 + contrib/unbound/testdata/zonemd.example_a2.zone | 25 + contrib/unbound/testdata/zonemd.example_a3.zone | 30 + contrib/unbound/testdata/zonemd.example_a4.zone | 127 ++ contrib/unbound/testdata/zonemd.example_a5.zone | 48 + .../testdata/zonemd_reload.tdir/zonemd_reload.conf | 23 + .../testdata/zonemd_reload.tdir/zonemd_reload.dsc | 16 + .../testdata/zonemd_reload.tdir/zonemd_reload.post | 14 + .../testdata/zonemd_reload.tdir/zonemd_reload.pre | 35 + .../testdata/zonemd_reload.tdir/zonemd_reload.test | 74 ++ .../zonemd_reload.tdir/zonemd_reload.testns | 27 + .../testdata/zonemd_reload.tdir/zonemd_reload.zone | 8 + contrib/unbound/util/config_file.c | 84 +- contrib/unbound/util/config_file.h | 39 + contrib/unbound/util/configlexer.lex | 9 + contrib/unbound/util/configparser.y | 138 +- contrib/unbound/util/data/dname.h | 4 +- contrib/unbound/util/data/msgreply.c | 22 +- contrib/unbound/util/fptr_wlist.c | 5 +- contrib/unbound/util/iana_ports.inc | 5 +- contrib/unbound/util/net_help.c | 3 +- contrib/unbound/util/net_help.h | 6 +- contrib/unbound/util/netevent.c | 126 +- contrib/unbound/util/netevent.h | 12 +- contrib/unbound/util/shm_side/shm_main.c | 6 + contrib/unbound/util/storage/lookup3.c | 102 +- contrib/unbound/util/ub_event_pluggable.c | 3 +- contrib/unbound/validator/autotrust.c | 31 +- contrib/unbound/validator/val_anchor.c | 7 +- contrib/unbound/validator/val_nsec.c | 1 + contrib/unbound/validator/val_secalgo.c | 247 +++- contrib/unbound/validator/val_secalgo.h | 43 + contrib/unbound/validator/val_sigcrypt.c | 98 +- contrib/unbound/validator/val_sigcrypt.h | 29 + contrib/unbound/validator/val_utils.c | 39 +- contrib/unbound/validator/validator.c | 18 +- contrib/unbound/validator/validator.h | 6 +- 179 files changed, 14359 insertions(+), 1803 deletions(-) diff --cc contrib/unbound/.github/ISSUE_TEMPLATE/bug_report.md index 000000000000,35d7ee94f9da..35d7ee94f9da mode 000000,100644..100644 --- a/contrib/unbound/.github/ISSUE_TEMPLATE/bug_report.md +++ b/contrib/unbound/.github/ISSUE_TEMPLATE/bug_report.md diff --cc contrib/unbound/.github/ISSUE_TEMPLATE/feature_request.md index 000000000000,e9ca08b7ab65..e9ca08b7ab65 mode 000000,100644..100644 --- a/contrib/unbound/.github/ISSUE_TEMPLATE/feature_request.md +++ b/contrib/unbound/.github/ISSUE_TEMPLATE/feature_request.md diff --cc contrib/unbound/.github/workflows/analysis_ports.yml index 000000000000,fbbdd80185a9..fbbdd80185a9 mode 000000,100644..100644 --- a/contrib/unbound/.github/workflows/analysis_ports.yml +++ b/contrib/unbound/.github/workflows/analysis_ports.yml diff --cc contrib/unbound/.github/workflows/ci.yml index 000000000000,73d68fbf35c9..73d68fbf35c9 mode 000000,100644..100644 --- a/contrib/unbound/.github/workflows/ci.yml +++ b/contrib/unbound/.github/workflows/ci.yml diff --cc contrib/unbound/README.md index 3e11ce58ce0d,000000000000..c8877d1e9df5 mode 100644,000000..100644 --- a/contrib/unbound/README.md +++ b/contrib/unbound/README.md @@@ -1,38 -1,0 +1,39 @@@ +# Unbound + +[![Travis Build Status](https://travis-ci.org/NLnetLabs/unbound.svg?branch=master)](https://travis-ci.org/NLnetLabs/unbound) +[![Packaging status](https://repology.org/badge/tiny-repos/unbound.svg)](https://repology.org/project/unbound/versions) +[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/unbound.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:unbound) ++[![Documentation Status](https://readthedocs.org/projects/unbound/badge/?version=latest)](https://unbound.readthedocs.io/en/latest/?badge=latest) + +Unbound is a validating, recursive, caching DNS resolver. It is designed to be +fast and lean and incorporates modern features based on open standards. If you +have any feedback, we would love to hear from you. Don’t hesitate to +[create an issue on Github](https://github.com/NLnetLabs/unbound/issues/new) +or post a message on the [Unbound mailing list](https://lists.nlnetlabs.nl/mailman/listinfo/unbound-users). +You can learn more about Unbound by reading our +[documentation](https://nlnetlabs.nl/documentation/unbound/). + +## Compiling + +Make sure you have the C toolchain, OpenSSL and its include files, and libexpat +installed. Unbound can be compiled and installed using: + +``` +./configure && make && make install +``` + +You can use libevent if you want. libevent is useful when using many (10000) +outgoing ports. By default max 256 ports are opened at the same time and the +builtin alternative is equally capable and a little faster. + +Use the `--with-libevent=dir` configure option to compile Unbound with libevent +support. + +## Unbound configuration + +All of Unbound's configuration options are described in the man pages, which +will be installed and are available on the Unbound +[documentation page](https://nlnetlabs.nl/documentation/unbound/). + +An example configuration file is located in +[doc/example.conf](https://github.com/NLnetLabs/unbound/blob/master/doc/example.conf.in). diff --cc contrib/unbound/testcode/readzone.c index 000000000000,94511e5771f4..94511e5771f4 mode 000000,100644..100644 --- a/contrib/unbound/testcode/readzone.c +++ b/contrib/unbound/testcode/readzone.c diff --cc contrib/unbound/testcode/unittcpreuse.c index 000000000000,087c6c1b9d50..087c6c1b9d50 mode 000000,100644..100644 --- a/contrib/unbound/testcode/unittcpreuse.c +++ b/contrib/unbound/testcode/unittcpreuse.c diff --cc contrib/unbound/testcode/unitzonemd.c index 000000000000,5caa68a102c3..5caa68a102c3 mode 000000,100644..100644 --- a/contrib/unbound/testcode/unitzonemd.c +++ b/contrib/unbound/testcode/unitzonemd.c diff --cc contrib/unbound/testdata/auth_zonemd_anchor.rpl index 000000000000,c443f7d43f10..c443f7d43f10 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_anchor.rpl +++ b/contrib/unbound/testdata/auth_zonemd_anchor.rpl diff --cc contrib/unbound/testdata/auth_zonemd_anchor_fail.rpl index 000000000000,d055174dcbe7..d055174dcbe7 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_anchor_fail.rpl +++ b/contrib/unbound/testdata/auth_zonemd_anchor_fail.rpl diff --cc contrib/unbound/testdata/auth_zonemd_chain.rpl index 000000000000,74479274fa97..74479274fa97 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_chain.rpl +++ b/contrib/unbound/testdata/auth_zonemd_chain.rpl diff --cc contrib/unbound/testdata/auth_zonemd_chain_fail.rpl index 000000000000,393b1c028fa9..393b1c028fa9 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_chain_fail.rpl +++ b/contrib/unbound/testdata/auth_zonemd_chain_fail.rpl diff --cc contrib/unbound/testdata/auth_zonemd_file.rpl index 000000000000,bdf0ccbae74f..bdf0ccbae74f mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_file.rpl +++ b/contrib/unbound/testdata/auth_zonemd_file.rpl diff --cc contrib/unbound/testdata/auth_zonemd_file_fail.rpl index 000000000000,69487cf6512c..69487cf6512c mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_file_fail.rpl +++ b/contrib/unbound/testdata/auth_zonemd_file_fail.rpl diff --cc contrib/unbound/testdata/auth_zonemd_insecure.rpl index 000000000000,18a4117d86ac..18a4117d86ac mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_insecure.rpl +++ b/contrib/unbound/testdata/auth_zonemd_insecure.rpl diff --cc contrib/unbound/testdata/auth_zonemd_insecure_absent.rpl index 000000000000,1c3f488080ee..1c3f488080ee mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_insecure_absent.rpl +++ b/contrib/unbound/testdata/auth_zonemd_insecure_absent.rpl diff --cc contrib/unbound/testdata/auth_zonemd_insecure_absent_reject.rpl index 000000000000,beb9f5b9ac89..beb9f5b9ac89 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_insecure_absent_reject.rpl +++ b/contrib/unbound/testdata/auth_zonemd_insecure_absent_reject.rpl diff --cc contrib/unbound/testdata/auth_zonemd_insecure_fail.rpl index 000000000000,f7aad071e3b9..f7aad071e3b9 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_insecure_fail.rpl +++ b/contrib/unbound/testdata/auth_zonemd_insecure_fail.rpl diff --cc contrib/unbound/testdata/auth_zonemd_nokey.rpl index 000000000000,a89414bf631c..a89414bf631c mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_nokey.rpl +++ b/contrib/unbound/testdata/auth_zonemd_nokey.rpl diff --cc contrib/unbound/testdata/auth_zonemd_permissive_mode.rpl index 000000000000,4149daa927f4..4149daa927f4 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_permissive_mode.rpl +++ b/contrib/unbound/testdata/auth_zonemd_permissive_mode.rpl diff --cc contrib/unbound/testdata/auth_zonemd_xfr.rpl index 000000000000,89e22cea1472..89e22cea1472 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_xfr.rpl +++ b/contrib/unbound/testdata/auth_zonemd_xfr.rpl diff --cc contrib/unbound/testdata/auth_zonemd_xfr_anchor.rpl index 000000000000,667de2eae0da..667de2eae0da mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_xfr_anchor.rpl +++ b/contrib/unbound/testdata/auth_zonemd_xfr_anchor.rpl diff --cc contrib/unbound/testdata/auth_zonemd_xfr_anchor_fail.rpl index 000000000000,237ed9498e39..237ed9498e39 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_xfr_anchor_fail.rpl +++ b/contrib/unbound/testdata/auth_zonemd_xfr_anchor_fail.rpl diff --cc contrib/unbound/testdata/auth_zonemd_xfr_chain.rpl index 000000000000,4deb99bcbd8a..4deb99bcbd8a mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_xfr_chain.rpl +++ b/contrib/unbound/testdata/auth_zonemd_xfr_chain.rpl diff --cc contrib/unbound/testdata/auth_zonemd_xfr_chain_fail.rpl index 000000000000,3e09c9e8e40b..3e09c9e8e40b mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_xfr_chain_fail.rpl +++ b/contrib/unbound/testdata/auth_zonemd_xfr_chain_fail.rpl diff --cc contrib/unbound/testdata/auth_zonemd_xfr_fail.rpl index 000000000000,f54ca7e086f0..f54ca7e086f0 mode 000000,100644..100644 --- a/contrib/unbound/testdata/auth_zonemd_xfr_fail.rpl +++ b/contrib/unbound/testdata/auth_zonemd_xfr_fail.rpl diff --cc contrib/unbound/testdata/http_user_agent.tdir/127.0.0.1/example.com.zone index 000000000000,695eb1c32bd4..695eb1c32bd4 mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/127.0.0.1/example.com.zone +++ b/contrib/unbound/testdata/http_user_agent.tdir/127.0.0.1/example.com.zone diff --cc contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.conf index 000000000000,c563416aefbe..c563416aefbe mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.conf +++ b/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.conf diff --cc contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.dsc index 000000000000,6b24c43fc7ab..6b24c43fc7ab mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.dsc +++ b/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.dsc diff --cc contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.post index 000000000000,797ff57c8bbc..797ff57c8bbc mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.post +++ b/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.post diff --cc contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.pre index 000000000000,e94bd536edb4..e94bd536edb4 mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.pre +++ b/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.pre diff --cc contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.test index 000000000000,afc0fbbe6f4b..afc0fbbe6f4b mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.test +++ b/contrib/unbound/testdata/http_user_agent.tdir/http_user_agent.test diff --cc contrib/unbound/testdata/http_user_agent.tdir/petal.key index 000000000000,6614e498fcd2..6614e498fcd2 mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/petal.key +++ b/contrib/unbound/testdata/http_user_agent.tdir/petal.key diff --cc contrib/unbound/testdata/http_user_agent.tdir/petal.pem index 000000000000,19c8b895ba86..19c8b895ba86 mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/petal.pem +++ b/contrib/unbound/testdata/http_user_agent.tdir/petal.pem diff --cc contrib/unbound/testdata/http_user_agent.tdir/unbound_control.key index 000000000000,753a4ef6162e..753a4ef6162e mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/unbound_control.key +++ b/contrib/unbound/testdata/http_user_agent.tdir/unbound_control.key diff --cc contrib/unbound/testdata/http_user_agent.tdir/unbound_control.pem index 000000000000,a1edf7017f1d..a1edf7017f1d mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/unbound_control.pem +++ b/contrib/unbound/testdata/http_user_agent.tdir/unbound_control.pem diff --cc contrib/unbound/testdata/http_user_agent.tdir/unbound_server.key index 000000000000,370a7bbb2f22..370a7bbb2f22 mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/unbound_server.key +++ b/contrib/unbound/testdata/http_user_agent.tdir/unbound_server.key diff --cc contrib/unbound/testdata/http_user_agent.tdir/unbound_server.pem index 000000000000,986807310f2b..986807310f2b mode 000000,100644..100644 --- a/contrib/unbound/testdata/http_user_agent.tdir/unbound_server.pem +++ b/contrib/unbound/testdata/http_user_agent.tdir/unbound_server.pem diff --cc contrib/unbound/testdata/rpz_rootwc.rpl index 000000000000,1fb94a1439fa..1fb94a1439fa mode 000000,100644..100644 --- a/contrib/unbound/testdata/rpz_rootwc.rpl +++ b/contrib/unbound/testdata/rpz_rootwc.rpl diff --cc contrib/unbound/testdata/svcb.tdir/crypto.cloudflare.com.zone index 000000000000,53c89c735ba1..53c89c735ba1 mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/crypto.cloudflare.com.zone +++ b/contrib/unbound/testdata/svcb.tdir/crypto.cloudflare.com.zone diff --cc contrib/unbound/testdata/svcb.tdir/svcb.dsc index 000000000000,6eae7638e9b0..6eae7638e9b0 mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.dsc +++ b/contrib/unbound/testdata/svcb.tdir/svcb.dsc diff --cc contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-01 index 000000000000,c60151692ee8..c60151692ee8 mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-01 +++ b/contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-01 diff --cc contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-02 index 000000000000,9d6f0186d535..9d6f0186d535 mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-02 +++ b/contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-02 diff --cc contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-03 index 000000000000,bb819daae316..bb819daae316 mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-03 +++ b/contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-03 diff --cc contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-04 index 000000000000,ae02ac417b1b..ae02ac417b1b mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-04 +++ b/contrib/unbound/testdata/svcb.tdir/svcb.failure-cases-04 diff --cc contrib/unbound/testdata/svcb.tdir/svcb.success-cases.zone index 000000000000,5d6339542f67..5d6339542f67 mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.success-cases.zone +++ b/contrib/unbound/testdata/svcb.tdir/svcb.success-cases.zone diff --cc contrib/unbound/testdata/svcb.tdir/svcb.success-cases.zone.cmp index 000000000000,e504e7b18ad5..e504e7b18ad5 mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.success-cases.zone.cmp +++ b/contrib/unbound/testdata/svcb.tdir/svcb.success-cases.zone.cmp diff --cc contrib/unbound/testdata/svcb.tdir/svcb.test index 000000000000,707287d5cf89..707287d5cf89 mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.test +++ b/contrib/unbound/testdata/svcb.tdir/svcb.test diff --cc contrib/unbound/testdata/svcb.tdir/svcb.test-vectors-pf.zone index 000000000000,d2cb5087bf9a..d2cb5087bf9a mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.test-vectors-pf.zone +++ b/contrib/unbound/testdata/svcb.tdir/svcb.test-vectors-pf.zone diff --cc contrib/unbound/testdata/svcb.tdir/svcb.test-vectors-wf.zone index 000000000000,bf47ab75c594..bf47ab75c594 mode 000000,100644..100644 --- a/contrib/unbound/testdata/svcb.tdir/svcb.test-vectors-wf.zone +++ b/contrib/unbound/testdata/svcb.tdir/svcb.test-vectors-wf.zone diff --cc contrib/unbound/testdata/zonemd.example1.zone index 000000000000,b1a44895f05c..b1a44895f05c mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example1.zone +++ b/contrib/unbound/testdata/zonemd.example1.zone diff --cc contrib/unbound/testdata/zonemd.example10.zone index 000000000000,33ca2828e019..33ca2828e019 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example10.zone +++ b/contrib/unbound/testdata/zonemd.example10.zone diff --cc contrib/unbound/testdata/zonemd.example11.zone index 000000000000,7562f79729b7..7562f79729b7 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example11.zone +++ b/contrib/unbound/testdata/zonemd.example11.zone diff --cc contrib/unbound/testdata/zonemd.example12.zone index 000000000000,4fc04bf88eb2..4fc04bf88eb2 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example12.zone +++ b/contrib/unbound/testdata/zonemd.example12.zone diff --cc contrib/unbound/testdata/zonemd.example13.zone index 000000000000,9f311c91291e..9f311c91291e mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example13.zone +++ b/contrib/unbound/testdata/zonemd.example13.zone diff --cc contrib/unbound/testdata/zonemd.example14.zone index 000000000000,bc4cdacdbbf5..bc4cdacdbbf5 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example14.zone +++ b/contrib/unbound/testdata/zonemd.example14.zone diff --cc contrib/unbound/testdata/zonemd.example15.zone index 000000000000,8a10689101d7..8a10689101d7 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example15.zone +++ b/contrib/unbound/testdata/zonemd.example15.zone diff --cc contrib/unbound/testdata/zonemd.example16.zone index 000000000000,7520744d3180..7520744d3180 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example16.zone +++ b/contrib/unbound/testdata/zonemd.example16.zone diff --cc contrib/unbound/testdata/zonemd.example17.zone index 000000000000,4315f9054af4..4315f9054af4 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example17.zone +++ b/contrib/unbound/testdata/zonemd.example17.zone diff --cc contrib/unbound/testdata/zonemd.example2.zone index 000000000000,14b7ea689ffa..14b7ea689ffa mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example2.zone +++ b/contrib/unbound/testdata/zonemd.example2.zone diff --cc contrib/unbound/testdata/zonemd.example3.zone index 000000000000,12389f3d5181..12389f3d5181 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example3.zone +++ b/contrib/unbound/testdata/zonemd.example3.zone diff --cc contrib/unbound/testdata/zonemd.example4.zone index 000000000000,dae0f17c708c..dae0f17c708c mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example4.zone +++ b/contrib/unbound/testdata/zonemd.example4.zone diff --cc contrib/unbound/testdata/zonemd.example5.zone index 000000000000,d88380ade09f..d88380ade09f mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example5.zone +++ b/contrib/unbound/testdata/zonemd.example5.zone diff --cc contrib/unbound/testdata/zonemd.example6.zone index 000000000000,0a7b05a8dcea..0a7b05a8dcea mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example6.zone +++ b/contrib/unbound/testdata/zonemd.example6.zone diff --cc contrib/unbound/testdata/zonemd.example7.zone index 000000000000,4339bd570c56..4339bd570c56 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example7.zone +++ b/contrib/unbound/testdata/zonemd.example7.zone diff --cc contrib/unbound/testdata/zonemd.example8.zone index 000000000000,2900753c0483..2900753c0483 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example8.zone +++ b/contrib/unbound/testdata/zonemd.example8.zone diff --cc contrib/unbound/testdata/zonemd.example9.zone index 000000000000,9c035aa1310d..9c035aa1310d mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example9.zone +++ b/contrib/unbound/testdata/zonemd.example9.zone diff --cc contrib/unbound/testdata/zonemd.example_a1.zone index 000000000000,331b45a153d6..331b45a153d6 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example_a1.zone +++ b/contrib/unbound/testdata/zonemd.example_a1.zone diff --cc contrib/unbound/testdata/zonemd.example_a2.zone index 000000000000,56d06ae066bf..56d06ae066bf mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example_a2.zone +++ b/contrib/unbound/testdata/zonemd.example_a2.zone diff --cc contrib/unbound/testdata/zonemd.example_a3.zone index 000000000000,45c47ad0508e..45c47ad0508e mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example_a3.zone +++ b/contrib/unbound/testdata/zonemd.example_a3.zone diff --cc contrib/unbound/testdata/zonemd.example_a4.zone index 000000000000,74b913c89e2b..74b913c89e2b mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example_a4.zone +++ b/contrib/unbound/testdata/zonemd.example_a4.zone diff --cc contrib/unbound/testdata/zonemd.example_a5.zone index 000000000000,246f5e2376db..246f5e2376db mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd.example_a5.zone +++ b/contrib/unbound/testdata/zonemd.example_a5.zone diff --cc contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.conf index 000000000000,9afd6e2b1e23..9afd6e2b1e23 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.conf +++ b/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.conf diff --cc contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.dsc index 000000000000,016c3d6c7ff0..016c3d6c7ff0 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.dsc +++ b/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.dsc diff --cc contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.post index 000000000000,5e315088a097..5e315088a097 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.post +++ b/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.post diff --cc contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.pre index 000000000000,fa5e4ca29bbf..fa5e4ca29bbf mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.pre +++ b/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.pre diff --cc contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.test index 000000000000,fbdf07511306..fbdf07511306 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.test +++ b/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.test diff --cc contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.testns index 000000000000,f1678a1ccc30..f1678a1ccc30 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.testns +++ b/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.testns diff --cc contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.zone index 000000000000,01e57a738e37..01e57a738e37 mode 000000,100644..100644 --- a/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.zone +++ b/contrib/unbound/testdata/zonemd_reload.tdir/zonemd_reload.zone diff --cc contrib/unbound/util/config_file.c index f3b7536d07eb,000000000000..083654ebad4c mode 100644,000000..100644 --- a/contrib/unbound/util/config_file.c +++ b/contrib/unbound/util/config_file.c @@@ -1,2607 -1,0 +1,2685 @@@ +/* + * util/config_file.c - reads and stores the config file for unbound. + * + * Copyright (c) 2007, NLnet Labs. All rights reserved. + * + * This software is open source. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the NLNET LABS nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER 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. + */ + +/** + * \file + * + * This file contains functions for the config file. + */ + +#include "config.h" +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include "util/log.h" +#include "util/configyyrename.h" +#include "util/config_file.h" +#include "configparser.h" +#include "util/net_help.h" +#include "util/data/msgparse.h" +#include "util/module.h" +#include "util/regional.h" +#include "util/fptr_wlist.h" +#include "util/data/dname.h" +#include "util/rtt.h" +#include "services/cache/infra.h" +#include "sldns/wire2str.h" +#include "sldns/parseutil.h" +#include "iterator/iterator.h" +#ifdef HAVE_GLOB_H +# include +#endif +#ifdef CLIENT_SUBNET +#include "edns-subnet/edns-subnet.h" +#endif +#ifdef HAVE_PWD_H +#include +#endif + +/** from cfg username, after daemonize setup performed */ +uid_t cfg_uid = (uid_t)-1; +/** from cfg username, after daemonize setup performed */ +gid_t cfg_gid = (gid_t)-1; +/** for debug allow small timeout values for fast rollovers */ +int autr_permit_small_holddown = 0; +/** size (in bytes) of stream wait buffers max */ +size_t stream_wait_max = 4 * 1024 * 1024; +size_t http2_query_buffer_max = 4 * 1024 * 1024; +size_t http2_response_buffer_max = 4 * 1024 * 1024; + +/** global config during parsing */ +struct config_parser_state* cfg_parser = 0; + +/** init ports possible for use */ +static void init_outgoing_availports(int* array, int num); + +struct config_file* +config_create(void) +{ + struct config_file* cfg; + cfg = (struct config_file*)calloc(1, sizeof(struct config_file)); + if(!cfg) + return NULL; + /* the defaults if no config is present */ + cfg->verbosity = 1; + cfg->stat_interval = 0; + cfg->stat_cumulative = 0; + cfg->stat_extended = 0; + cfg->num_threads = 1; + cfg->port = UNBOUND_DNS_PORT; + cfg->do_ip4 = 1; + cfg->do_ip6 = 1; + cfg->do_udp = 1; + cfg->do_tcp = 1; ++ cfg->tcp_reuse_timeout = 60 * 1000; /* 60s in milisecs */ ++ cfg->max_reuse_tcp_queries = 200; + cfg->tcp_upstream = 0; + cfg->udp_upstream_without_downstream = 0; + cfg->tcp_mss = 0; + cfg->outgoing_tcp_mss = 0; + cfg->tcp_idle_timeout = 30 * 1000; /* 30s in millisecs */ ++ cfg->tcp_auth_query_timeout = 3 * 1000; /* 3s in millisecs */ + cfg->do_tcp_keepalive = 0; + cfg->tcp_keepalive_timeout = 120 * 1000; /* 120s in millisecs */ + cfg->ssl_service_key = NULL; + cfg->ssl_service_pem = NULL; + cfg->ssl_port = UNBOUND_DNS_OVER_TLS_PORT; + cfg->ssl_upstream = 0; + cfg->tls_cert_bundle = NULL; + cfg->tls_win_cert = 0; + cfg->tls_use_sni = 1; + cfg->https_port = UNBOUND_DNS_OVER_HTTPS_PORT; + if(!(cfg->http_endpoint = strdup("/dns-query"))) goto error_exit; + cfg->http_max_streams = 100; + cfg->http_query_buffer_size = 4*1024*1024; + cfg->http_response_buffer_size = 4*1024*1024; + cfg->http_nodelay = 1; + cfg->use_syslog = 1; + cfg->log_identity = NULL; /* changed later with argv[0] */ + cfg->log_time_ascii = 0; + cfg->log_queries = 0; + cfg->log_replies = 0; + cfg->log_tag_queryreply = 0; + cfg->log_local_actions = 0; + cfg->log_servfail = 0; +#ifndef USE_WINSOCK +# ifdef USE_MINI_EVENT + /* select max 1024 sockets */ + cfg->outgoing_num_ports = 960; + cfg->num_queries_per_thread = 512; +# else + /* libevent can use many sockets */ + cfg->outgoing_num_ports = 4096; + cfg->num_queries_per_thread = 1024; +# endif + cfg->outgoing_num_tcp = 10; + cfg->incoming_num_tcp = 10; +#else + cfg->outgoing_num_ports = 48; /* windows is limited in num fds */ + cfg->num_queries_per_thread = 24; + cfg->outgoing_num_tcp = 2; /* leaves 64-52=12 for: 4if,1stop,thread4 */ + cfg->incoming_num_tcp = 2; +#endif + cfg->stream_wait_size = 4 * 1024 * 1024; + cfg->edns_buffer_size = 1232; /* from DNS flagday recommendation */ + cfg->msg_buffer_size = 65552; /* 64 k + a small margin */ + cfg->msg_cache_size = 4 * 1024 * 1024; + cfg->msg_cache_slabs = 4; + cfg->jostle_time = 200; + cfg->rrset_cache_size = 4 * 1024 * 1024; + cfg->rrset_cache_slabs = 4; + cfg->host_ttl = 900; + cfg->bogus_ttl = 60; + cfg->min_ttl = 0; + cfg->max_ttl = 3600 * 24; + cfg->max_negative_ttl = 3600; + cfg->prefetch = 0; + cfg->prefetch_key = 0; + cfg->deny_any = 0; + cfg->infra_cache_slabs = 4; + cfg->infra_cache_numhosts = 10000; + cfg->infra_cache_min_rtt = 50; + cfg->infra_keep_probing = 0; + cfg->delay_close = 0; + cfg->udp_connect = 1; + if(!(cfg->outgoing_avail_ports = (int*)calloc(65536, sizeof(int)))) + goto error_exit; + init_outgoing_availports(cfg->outgoing_avail_ports, 65536); + if(!(cfg->username = strdup(UB_USERNAME))) goto error_exit; +#ifdef HAVE_CHROOT + if(!(cfg->chrootdir = strdup(CHROOT_DIR))) goto error_exit; +#endif + if(!(cfg->directory = strdup(RUN_DIR))) goto error_exit; + if(!(cfg->logfile = strdup(""))) goto error_exit; + if(!(cfg->pidfile = strdup(PIDFILE))) goto error_exit; + if(!(cfg->target_fetch_policy = strdup("3 2 1 0 0"))) goto error_exit; + cfg->fast_server_permil = 0; + cfg->fast_server_num = 3; + cfg->donotqueryaddrs = NULL; + cfg->donotquery_localhost = 1; + cfg->root_hints = NULL; + cfg->use_systemd = 0; + cfg->do_daemonize = 1; + cfg->if_automatic = 0; + cfg->so_rcvbuf = 0; + cfg->so_sndbuf = 0; + cfg->so_reuseport = REUSEPORT_DEFAULT; + cfg->ip_transparent = 0; + cfg->ip_freebind = 0; + cfg->ip_dscp = 0; + cfg->num_ifs = 0; + cfg->ifs = NULL; + cfg->num_out_ifs = 0; + cfg->out_ifs = NULL; + cfg->stubs = NULL; + cfg->forwards = NULL; + cfg->auths = NULL; +#ifdef CLIENT_SUBNET + cfg->client_subnet = NULL; + cfg->client_subnet_zone = NULL; + cfg->client_subnet_opcode = LDNS_EDNS_CLIENT_SUBNET; + cfg->client_subnet_always_forward = 0; + cfg->max_client_subnet_ipv4 = 24; + cfg->max_client_subnet_ipv6 = 56; + cfg->min_client_subnet_ipv4 = 0; + cfg->min_client_subnet_ipv6 = 0; + cfg->max_ecs_tree_size_ipv4 = 100; + cfg->max_ecs_tree_size_ipv6 = 100; +#endif + cfg->views = NULL; + cfg->acls = NULL; + cfg->tcp_connection_limits = NULL; + cfg->harden_short_bufsize = 1; + cfg->harden_large_queries = 0; + cfg->harden_glue = 1; + cfg->harden_dnssec_stripped = 1; + cfg->harden_below_nxdomain = 1; + cfg->harden_referral_path = 0; + cfg->harden_algo_downgrade = 0; + cfg->use_caps_bits_for_id = 0; + cfg->caps_whitelist = NULL; + cfg->private_address = NULL; + cfg->private_domain = NULL; + cfg->unwanted_threshold = 0; + cfg->hide_identity = 0; + cfg->hide_version = 0; + cfg->hide_trustanchor = 0; ++ cfg->hide_http_user_agent = 0; + cfg->identity = NULL; + cfg->version = NULL; ++ cfg->http_user_agent = NULL; + cfg->nsid_cfg_str = NULL; + cfg->nsid = NULL; + cfg->nsid_len = 0; + cfg->auto_trust_anchor_file_list = NULL; + cfg->trust_anchor_file_list = NULL; + cfg->trust_anchor_list = NULL; + cfg->trusted_keys_file_list = NULL; + cfg->trust_anchor_signaling = 1; + cfg->root_key_sentinel = 1; + cfg->domain_insecure = NULL; + cfg->val_date_override = 0; + cfg->val_sig_skew_min = 3600; /* at least daylight savings trouble */ + cfg->val_sig_skew_max = 86400; /* at most timezone settings trouble */ ++ cfg->val_max_restart = 5; + cfg->val_clean_additional = 1; + cfg->val_log_level = 0; + cfg->val_log_squelch = 0; + cfg->val_permissive_mode = 0; + cfg->aggressive_nsec = 0; + cfg->ignore_cd = 0; + cfg->serve_expired = 0; + cfg->serve_expired_ttl = 0; + cfg->serve_expired_ttl_reset = 0; + cfg->serve_expired_reply_ttl = 30; + cfg->serve_expired_client_timeout = 0; + cfg->serve_original_ttl = 0; ++ cfg->zonemd_permissive_mode = 0; + cfg->add_holddown = 30*24*3600; + cfg->del_holddown = 30*24*3600; + cfg->keep_missing = 366*24*3600; /* one year plus a little leeway */ + cfg->permit_small_holddown = 0; + cfg->key_cache_size = 4 * 1024 * 1024; + cfg->key_cache_slabs = 4; + cfg->neg_cache_size = 1 * 1024 * 1024; + cfg->local_zones = NULL; + cfg->local_zones_nodefault = NULL; +#ifdef USE_IPSET + cfg->local_zones_ipset = NULL; +#endif + cfg->local_zones_disable_default = 0; + cfg->local_data = NULL; + cfg->local_zone_overrides = NULL; + cfg->unblock_lan_zones = 0; + cfg->insecure_lan_zones = 0; + cfg->python_script = NULL; + cfg->dynlib_file = NULL; + cfg->remote_control_enable = 0; + cfg->control_ifs.first = NULL; + cfg->control_ifs.last = NULL; + cfg->control_port = UNBOUND_CONTROL_PORT; + cfg->control_use_cert = 1; + cfg->minimal_responses = 1; + cfg->rrset_roundrobin = 1; + cfg->unknown_server_time_limit = 376; + cfg->max_udp_size = 4096; + if(!(cfg->server_key_file = strdup(RUN_DIR"/unbound_server.key"))) + goto error_exit; + if(!(cfg->server_cert_file = strdup(RUN_DIR"/unbound_server.pem"))) + goto error_exit; + if(!(cfg->control_key_file = strdup(RUN_DIR"/unbound_control.key"))) + goto error_exit; + if(!(cfg->control_cert_file = strdup(RUN_DIR"/unbound_control.pem"))) + goto error_exit; + +#ifdef CLIENT_SUBNET + if(!(cfg->module_conf = strdup("subnetcache validator iterator"))) goto error_exit; +#else + if(!(cfg->module_conf = strdup("validator iterator"))) goto error_exit; +#endif + if(!(cfg->val_nsec3_key_iterations = - strdup("1024 150 2048 500 4096 2500"))) goto error_exit; ++ strdup("1024 150 2048 150 4096 150"))) goto error_exit; +#if defined(DNSTAP_SOCKET_PATH) + if(!(cfg->dnstap_socket_path = strdup(DNSTAP_SOCKET_PATH))) + goto error_exit; +#endif + cfg->dnstap_bidirectional = 1; + cfg->dnstap_tls = 1; + cfg->disable_dnssec_lame_check = 0; + cfg->ip_ratelimit = 0; + cfg->ratelimit = 0; + cfg->ip_ratelimit_slabs = 4; + cfg->ratelimit_slabs = 4; + cfg->ip_ratelimit_size = 4*1024*1024; + cfg->ratelimit_size = 4*1024*1024; + cfg->ratelimit_for_domain = NULL; + cfg->ratelimit_below_domain = NULL; + cfg->ip_ratelimit_factor = 10; + cfg->ratelimit_factor = 10; + cfg->qname_minimisation = 1; + cfg->qname_minimisation_strict = 0; + cfg->shm_enable = 0; + cfg->shm_key = 11777; + cfg->edns_client_strings = NULL; + cfg->edns_client_string_opcode = 65001; + cfg->dnscrypt = 0; + cfg->dnscrypt_port = 0; + cfg->dnscrypt_provider = NULL; + cfg->dnscrypt_provider_cert = NULL; + cfg->dnscrypt_provider_cert_rotated = NULL; + cfg->dnscrypt_secret_key = NULL; + cfg->dnscrypt_shared_secret_cache_size = 4*1024*1024; + cfg->dnscrypt_shared_secret_cache_slabs = 4; + cfg->dnscrypt_nonce_cache_size = 4*1024*1024; *** 2340 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Aug 17 12:06:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A3FFF66322A; Tue, 17 Aug 2021 12:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpqWs2qyxz4hdw; Tue, 17 Aug 2021 12:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33A251D33E; Tue, 17 Aug 2021 12:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HC6nbI038587; Tue, 17 Aug 2021 12:06:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HC6nwI038586; Tue, 17 Aug 2021 12:06:49 GMT (envelope-from git) Date: Tue, 17 Aug 2021 12:06:49 GMT Message-Id: <202108171206.17HC6nwI038586@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 451dc2b7cc0c - main - rtld: rework how environment variables are named MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 451dc2b7cc0c845a3f76f9ee670f16699c49b491 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 12:06:49 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=451dc2b7cc0c845a3f76f9ee670f16699c49b491 commit 451dc2b7cc0c845a3f76f9ee670f16699c49b491 Author: Konstantin Belousov AuthorDate: 2021-08-15 18:57:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-17 12:05:46 +0000 rtld: rework how environment variables are named Instead of specifying the main name part of the environment variable as the string literal, create array of the var names and access them by symbolic index. Convert main name parts into complete names by prefixing with ABI-specific ld_env_vars. This way the name is not repeated, and also it can carry additional proporties explicitly. For instance, cleanup of the environment for the setuid image does not require retyping all names. Reviewed by: arichardson, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31545 --- libexec/rtld-elf/arm/rtld_machdep.h | 1 - libexec/rtld-elf/rtld.c | 178 ++++++++++++++++++++++++++---------- 2 files changed, 131 insertions(+), 48 deletions(-) diff --git a/libexec/rtld-elf/arm/rtld_machdep.h b/libexec/rtld-elf/arm/rtld_machdep.h index d890cb377fa3..26e677f26d5a 100644 --- a/libexec/rtld-elf/arm/rtld_machdep.h +++ b/libexec/rtld-elf/arm/rtld_machdep.h @@ -80,7 +80,6 @@ extern void arm_abi_variant_hook(Elf_Auxinfo **); #ifdef __ARM_FP #define md_abi_variant_hook(x) arm_abi_variant_hook(x) -#define RTLD_VARIANT_ENV_NAMES #else #define md_abi_variant_hook(x) #endif diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 61b823aaacf8..6826dde8a160 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -342,23 +342,106 @@ ld_utrace_log(int event, void *handle, void *mapbase, size_t mapsize, utrace(&ut, sizeof(ut)); } -#ifdef RTLD_VARIANT_ENV_NAMES -/* - * construct the env variable based on the type of binary that's - * running. - */ -static inline const char * -_LD(const char *var) +enum { + LD_BIND_NOW = 0, + LD_PRELOAD, + LD_LIBMAP, + LD_LIBRARY_PATH, + LD_LIBRARY_PATH_FDS, + LD_LIBMAP_DISABLE, + LD_BIND_NOT, + LD_DEBUG, + LD_ELF_HINTS_PATH, + LD_LOADFLTR, + LD_LIBRARY_PATH_RPATH, + LD_PRELOAD_FDS, + LD_DYNAMIC_WEAK, + LD_TRACE_LOADED_OBJECTS, + LD_UTRACE, + LD_DUMP_REL_PRE, + LD_DUMP_REL_POST, + LD_TRACE_LOADED_OBJECTS_PROGNAME, + LD_TRACE_LOADED_OBJECTS_FMT1, + LD_TRACE_LOADED_OBJECTS_FMT2, + LD_TRACE_LOADED_OBJECTS_ALL, +}; + +struct ld_env_var_desc { + char n[64]; + bool unsecure; +}; + +static struct ld_env_var_desc ld_env_vars[] = { + [LD_BIND_NOW] = + { .n = "BIND_NOW", .unsecure = false }, + [LD_PRELOAD] = + { .n = "PRELOAD", .unsecure = true }, + [LD_LIBMAP] = + { .n = "LIBMAP", .unsecure = true }, + [LD_LIBRARY_PATH] = + { .n = "LIBRARY_PATH", .unsecure = true }, + [LD_LIBRARY_PATH_FDS] = + { .n = "LIBRARY_PATH_FDS", .unsecure = true }, + [LD_LIBMAP_DISABLE] = + { .n = "LIBMAP_DISABLE", .unsecure = true }, + [LD_BIND_NOT] = + { .n = "BIND_NOT", .unsecure = true }, + [LD_DEBUG] = + { .n = "DEBUG", .unsecure = true }, + [LD_ELF_HINTS_PATH] = + { .n = "ELF_HINTS_PATH", .unsecure = true }, + [LD_LOADFLTR] = + { .n = "LOADFLTR", .unsecure = true }, + [LD_LIBRARY_PATH_RPATH] = + { .n = "LIBRARY_PATH_RPATH", .unsecure = true }, + [LD_PRELOAD_FDS] = + { .n = "PRELOAD_FDS", .unsecure = true }, + [LD_DYNAMIC_WEAK] = + { .n = "DYNAMIC_WEAK", .unsecure = true }, + [LD_TRACE_LOADED_OBJECTS] = + { .n = "TRACE_LOADED_OBJECTS", .unsecure = false }, + [LD_UTRACE] = + { .n = "UTRACE", .unsecure = false }, + [LD_DUMP_REL_PRE] = + { .n = "DUMP_REL_PRE", .unsecure = false }, + [LD_DUMP_REL_POST] = + { .n = "DUMP_REL_POST", .unsecure = false }, + [LD_TRACE_LOADED_OBJECTS_PROGNAME] = + { .n = "TRACE_LOADED_OBJECTS_PROGNAME", .unsecure = false}, + [LD_TRACE_LOADED_OBJECTS_FMT1] = + { .n = "TRACE_LOADED_OBJECTS_FMT1", .unsecure = false}, + [LD_TRACE_LOADED_OBJECTS_FMT2] = + { .n = "TRACE_LOADED_OBJECTS_FMT2", .unsecure = false}, + [LD_TRACE_LOADED_OBJECTS_ALL] = + { .n = "TRACE_LOADED_OBJECTS_ALL", .unsecure = false}, +}; + +static const char * +ld_var(int idx) { - static char buffer[128]; + return (ld_env_vars[idx].n); +} - strlcpy(buffer, ld_env_prefix, sizeof(buffer)); - strlcat(buffer, var, sizeof(buffer)); - return (buffer); +static char * +ld_get_env_var(int idx) +{ + return (getenv(ld_var(idx))); +} + +static void +rtld_init_env_vars(void) +{ + struct ld_env_var_desc *lvd; + size_t sz; + int i; + + sz = strlen(ld_env_prefix); + for (i = 0; i < (int)nitems(ld_env_vars); i++) { + lvd = &ld_env_vars[i]; + memmove(lvd->n + sz, lvd->n, strlen(lvd->n) + 1); + memcpy(lvd->n, ld_env_prefix, sz); + } } -#else -#define _LD(x) LD_ x -#endif /* * Main entry point for dynamic linking. The first argument is the @@ -389,6 +472,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) Elf_Addr *argcp; char **argv, **env, **envp, *kexecpath, *library_path_rpath; const char *argv0, *binpath; + struct ld_env_var_desc *lvd; caddr_t imgentry; char buf[MAXPATHLEN]; int argc, fd, i, mib[4], old_osrel, osrel, phnum, rtld_argc; @@ -464,6 +548,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) direct_exec = false; md_abi_variant_hook(aux_info); + rtld_init_env_vars(); fd = -1; if (aux_info[AT_EXECFD] != NULL) { @@ -571,7 +656,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) } } - ld_bind_now = getenv(_LD("BIND_NOW")); + ld_bind_now = ld_get_env_var(LD_BIND_NOW); /* * If the process is tainted, then we un-set the dangerous environment @@ -580,29 +665,27 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) * future processes to honor the potentially un-safe variables. */ if (!trust) { - if (unsetenv(_LD("PRELOAD")) || unsetenv(_LD("LIBMAP")) || - unsetenv(_LD("LIBRARY_PATH")) || unsetenv(_LD("LIBRARY_PATH_FDS")) || - unsetenv(_LD("LIBMAP_DISABLE")) || unsetenv(_LD("BIND_NOT")) || - unsetenv(_LD("DEBUG")) || unsetenv(_LD("ELF_HINTS_PATH")) || - unsetenv(_LD("LOADFLTR")) || unsetenv(_LD("LIBRARY_PATH_RPATH")) || - unsetenv(_LD("PRELOAD_FDS")) || unsetenv(_LD("DYNAMIC_WEAK"))) { - _rtld_error("environment corrupt; aborting"); - rtld_die(); - } + for (i = 0; i < (int)nitems(ld_env_vars); i++) { + lvd = &ld_env_vars[i]; + if (lvd->unsecure && unsetenv(lvd->n)) { + _rtld_error("environment corrupt; aborting"); + rtld_die(); + } + } } - ld_debug = getenv(_LD("DEBUG")); + ld_debug = ld_get_env_var(LD_DEBUG); if (ld_bind_now == NULL) - ld_bind_not = getenv(_LD("BIND_NOT")) != NULL; - ld_dynamic_weak = getenv(_LD("DYNAMIC_WEAK")) == NULL; - libmap_disable = getenv(_LD("LIBMAP_DISABLE")) != NULL; - libmap_override = getenv(_LD("LIBMAP")); - ld_library_path = getenv(_LD("LIBRARY_PATH")); - ld_library_dirs = getenv(_LD("LIBRARY_PATH_FDS")); - ld_preload = getenv(_LD("PRELOAD")); - ld_preload_fds = getenv(_LD("PRELOAD_FDS")); - ld_elf_hints_path = getenv(_LD("ELF_HINTS_PATH")); - ld_loadfltr = getenv(_LD("LOADFLTR")) != NULL; - library_path_rpath = getenv(_LD("LIBRARY_PATH_RPATH")); + ld_bind_not = ld_get_env_var(LD_BIND_NOT) != NULL; + ld_dynamic_weak = ld_get_env_var(LD_DYNAMIC_WEAK) == NULL; + libmap_disable = ld_get_env_var(LD_LIBMAP_DISABLE) != NULL; + libmap_override = ld_get_env_var(LD_LIBMAP); + ld_library_path = ld_get_env_var(LD_LIBRARY_PATH); + ld_library_dirs = ld_get_env_var(LD_LIBRARY_PATH_FDS); + ld_preload = ld_get_env_var(LD_PRELOAD); + ld_preload_fds = ld_get_env_var(LD_PRELOAD_FDS); + ld_elf_hints_path = ld_get_env_var(LD_ELF_HINTS_PATH); + ld_loadfltr = ld_get_env_var(LD_LOADFLTR) != NULL; + library_path_rpath = ld_get_env_var(LD_LIBRARY_PATH_RPATH); if (library_path_rpath != NULL) { if (library_path_rpath[0] == 'y' || library_path_rpath[0] == 'Y' || @@ -611,11 +694,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) else ld_library_path_rpath = false; } - dangerous_ld_env = libmap_disable || (libmap_override != NULL) || - (ld_library_path != NULL) || (ld_preload != NULL) || - (ld_elf_hints_path != NULL) || ld_loadfltr || ld_dynamic_weak; - ld_tracing = getenv(_LD("TRACE_LOADED_OBJECTS")); - ld_utrace = getenv(_LD("UTRACE")); + dangerous_ld_env = libmap_disable || libmap_override != NULL || + ld_library_path != NULL || ld_preload != NULL || + ld_elf_hints_path != NULL || ld_loadfltr || ld_dynamic_weak; + ld_tracing = ld_get_env_var(LD_TRACE_LOADED_OBJECTS); + ld_utrace = ld_get_env_var(LD_UTRACE); if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0) ld_elf_hints_path = ld_elf_hints_default; @@ -751,7 +834,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) exit(0); } - if (getenv(_LD("DUMP_REL_PRE")) != NULL) { + if (ld_get_env_var(LD_DUMP_REL_PRE) != NULL) { dump_relocations(obj_main); exit (0); } @@ -779,7 +862,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) if (do_copy_relocations(obj_main) == -1) rtld_die(); - if (getenv(_LD("DUMP_REL_POST")) != NULL) { + if (ld_get_env_var(LD_DUMP_REL_POST) != NULL) { dump_relocations(obj_main); exit (0); } @@ -4715,16 +4798,17 @@ trace_loaded_objects(Obj_Entry *obj) const char *fmt1, *fmt2, *fmt, *main_local, *list_containers; int c; - if ((main_local = getenv(_LD("TRACE_LOADED_OBJECTS_PROGNAME"))) == NULL) + if ((main_local = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_PROGNAME)) == + NULL) main_local = ""; - if ((fmt1 = getenv(_LD("TRACE_LOADED_OBJECTS_FMT1"))) == NULL) + if ((fmt1 = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_FMT1)) == NULL) fmt1 = "\t%o => %p (%x)\n"; - if ((fmt2 = getenv(_LD("TRACE_LOADED_OBJECTS_FMT2"))) == NULL) + if ((fmt2 = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_FMT2)) == NULL) fmt2 = "\t%o (%x)\n"; - list_containers = getenv(_LD("TRACE_LOADED_OBJECTS_ALL")); + list_containers = ld_get_env_var(LD_TRACE_LOADED_OBJECTS_ALL); for (; obj != NULL; obj = TAILQ_NEXT(obj, next)) { Needed_Entry *needed; From owner-dev-commits-src-main@freebsd.org Tue Aug 17 12:06:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A4AA266322C; Tue, 17 Aug 2021 12:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpqWt3ZXzz4hf2; Tue, 17 Aug 2021 12:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FA7B1D07B; Tue, 17 Aug 2021 12:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HC6o6q038611; Tue, 17 Aug 2021 12:06:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HC6o6i038610; Tue, 17 Aug 2021 12:06:50 GMT (envelope-from git) Date: Tue, 17 Aug 2021 12:06:50 GMT Message-Id: <202108171206.17HC6o6i038610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: bfd4c875a105 - main - rtld: avoid use of of getenv(3) for evaluating rtld env vars (LD_XXX) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bfd4c875a10560aaa2f41e82114df79fde008fdb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 12:06:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bfd4c875a10560aaa2f41e82114df79fde008fdb commit bfd4c875a10560aaa2f41e82114df79fde008fdb Author: Konstantin Belousov AuthorDate: 2021-08-16 12:59:05 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-17 12:05:47 +0000 rtld: avoid use of of getenv(3) for evaluating rtld env vars (LD_XXX) Scan through the set of environment variables during initialization and store values in the corresponding ld_env_var_desc structure, in the single pass at init time. This does not eliminate use of getenv(3) and unsetenv(3) completely, but provides a foundation to do that as the next step. Also organize the scan in a way that makes it easier to support aliases like LD_DEBUG vs. LD_64_DEBUG. Suggested by: arichardson Reviewed by: arichardson, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31545 --- libexec/rtld-elf/rtld.c | 144 ++++++++++++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 61 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 6826dde8a160..39c41fe0ed24 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -367,82 +367,105 @@ enum { }; struct ld_env_var_desc { - char n[64]; - bool unsecure; + const char *n; + char *val; + const bool unsecure; }; +#define LD_ENV_DESC(var, unsec) \ + [LD_##var] = { .n = #var, .unsecure = unsec } static struct ld_env_var_desc ld_env_vars[] = { - [LD_BIND_NOW] = - { .n = "BIND_NOW", .unsecure = false }, - [LD_PRELOAD] = - { .n = "PRELOAD", .unsecure = true }, - [LD_LIBMAP] = - { .n = "LIBMAP", .unsecure = true }, - [LD_LIBRARY_PATH] = - { .n = "LIBRARY_PATH", .unsecure = true }, - [LD_LIBRARY_PATH_FDS] = - { .n = "LIBRARY_PATH_FDS", .unsecure = true }, - [LD_LIBMAP_DISABLE] = - { .n = "LIBMAP_DISABLE", .unsecure = true }, - [LD_BIND_NOT] = - { .n = "BIND_NOT", .unsecure = true }, - [LD_DEBUG] = - { .n = "DEBUG", .unsecure = true }, - [LD_ELF_HINTS_PATH] = - { .n = "ELF_HINTS_PATH", .unsecure = true }, - [LD_LOADFLTR] = - { .n = "LOADFLTR", .unsecure = true }, - [LD_LIBRARY_PATH_RPATH] = - { .n = "LIBRARY_PATH_RPATH", .unsecure = true }, - [LD_PRELOAD_FDS] = - { .n = "PRELOAD_FDS", .unsecure = true }, - [LD_DYNAMIC_WEAK] = - { .n = "DYNAMIC_WEAK", .unsecure = true }, - [LD_TRACE_LOADED_OBJECTS] = - { .n = "TRACE_LOADED_OBJECTS", .unsecure = false }, - [LD_UTRACE] = - { .n = "UTRACE", .unsecure = false }, - [LD_DUMP_REL_PRE] = - { .n = "DUMP_REL_PRE", .unsecure = false }, - [LD_DUMP_REL_POST] = - { .n = "DUMP_REL_POST", .unsecure = false }, - [LD_TRACE_LOADED_OBJECTS_PROGNAME] = - { .n = "TRACE_LOADED_OBJECTS_PROGNAME", .unsecure = false}, - [LD_TRACE_LOADED_OBJECTS_FMT1] = - { .n = "TRACE_LOADED_OBJECTS_FMT1", .unsecure = false}, - [LD_TRACE_LOADED_OBJECTS_FMT2] = - { .n = "TRACE_LOADED_OBJECTS_FMT2", .unsecure = false}, - [LD_TRACE_LOADED_OBJECTS_ALL] = - { .n = "TRACE_LOADED_OBJECTS_ALL", .unsecure = false}, + LD_ENV_DESC(BIND_NOW, false), + LD_ENV_DESC(PRELOAD, true), + LD_ENV_DESC(LIBMAP, true), + LD_ENV_DESC(LIBRARY_PATH, true), + LD_ENV_DESC(LIBRARY_PATH_FDS, true), + LD_ENV_DESC(LIBMAP_DISABLE, true), + LD_ENV_DESC(BIND_NOT, true), + LD_ENV_DESC(DEBUG, true), + LD_ENV_DESC(ELF_HINTS_PATH, true), + LD_ENV_DESC(LOADFLTR, true), + LD_ENV_DESC(LIBRARY_PATH_RPATH, true), + LD_ENV_DESC(PRELOAD_FDS, true), + LD_ENV_DESC(DYNAMIC_WEAK, true), + LD_ENV_DESC(TRACE_LOADED_OBJECTS, false), + LD_ENV_DESC(UTRACE, false), + LD_ENV_DESC(DUMP_REL_PRE, false), + LD_ENV_DESC(DUMP_REL_POST, false), + LD_ENV_DESC(TRACE_LOADED_OBJECTS_PROGNAME, false), + LD_ENV_DESC(TRACE_LOADED_OBJECTS_FMT1, false), + LD_ENV_DESC(TRACE_LOADED_OBJECTS_FMT2, false), + LD_ENV_DESC(TRACE_LOADED_OBJECTS_ALL, false), }; -static const char * -ld_var(int idx) +static char * +ld_get_env_var(int idx) { - return (ld_env_vars[idx].n); + return (ld_env_vars[idx].val); } static char * -ld_get_env_var(int idx) +rtld_get_env_val(char **env, const char *name, size_t name_len) { - return (getenv(ld_var(idx))); + char **m, *n, *v; + + for (m = env; *m != NULL; m++) { + n = *m; + v = strchr(n, '='); + if (v == NULL) { + /* corrupt environment? */ + continue; + } + if (v - n == (ptrdiff_t)name_len && + strncmp(name, n, name_len) == 0) + return (v + 1); + } + return (NULL); } static void -rtld_init_env_vars(void) +rtld_init_env_vars_for_prefix(char **env, const char *env_prefix) { struct ld_env_var_desc *lvd; - size_t sz; + size_t prefix_len, nlen; + char **m, *n, *v; int i; - sz = strlen(ld_env_prefix); - for (i = 0; i < (int)nitems(ld_env_vars); i++) { - lvd = &ld_env_vars[i]; - memmove(lvd->n + sz, lvd->n, strlen(lvd->n) + 1); - memcpy(lvd->n, ld_env_prefix, sz); + prefix_len = strlen(env_prefix); + for (m = env; *m != NULL; m++) { + n = *m; + if (strncmp(env_prefix, n, prefix_len) != 0) { + /* Not a rtld environment variable. */ + continue; + } + n += prefix_len; + v = strchr(n, '='); + if (v == NULL) { + /* corrupt environment? */ + continue; + } + for (i = 0; i < (int)nitems(ld_env_vars); i++) { + lvd = &ld_env_vars[i]; + if (lvd->val != NULL) { + /* Saw higher-priority variable name already. */ + continue; + } + nlen = strlen(lvd->n); + if (v - n == (ptrdiff_t)nlen && + strncmp(lvd->n, n, nlen) == 0) { + lvd->val = v + 1; + break; + } + } } } +static void +rtld_init_env_vars(char **env) +{ + rtld_init_env_vars_for_prefix(env, ld_env_prefix); +} + /* * Main entry point for dynamic linking. The first argument is the * stack pointer. The stack is expected to be laid out as described @@ -548,7 +571,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) direct_exec = false; md_abi_variant_hook(aux_info); - rtld_init_env_vars(); + rtld_init_env_vars(env); fd = -1; if (aux_info[AT_EXECFD] != NULL) { @@ -667,12 +690,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) if (!trust) { for (i = 0; i < (int)nitems(ld_env_vars); i++) { lvd = &ld_env_vars[i]; - if (lvd->unsecure && unsetenv(lvd->n)) { - _rtld_error("environment corrupt; aborting"); - rtld_die(); - } + if (lvd->unsecure) + lvd->val = NULL; } } + ld_debug = ld_get_env_var(LD_DEBUG); if (ld_bind_now == NULL) ld_bind_not = ld_get_env_var(LD_BIND_NOT) != NULL; From owner-dev-commits-src-main@freebsd.org Tue Aug 17 12:06:51 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D125C6635CC; Tue, 17 Aug 2021 12:06:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpqWv4wSrz4hYj; Tue, 17 Aug 2021 12:06:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 883CA1D7AB; Tue, 17 Aug 2021 12:06:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HC6pNb038642; Tue, 17 Aug 2021 12:06:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HC6pE2038641; Tue, 17 Aug 2021 12:06:51 GMT (envelope-from git) Date: Tue, 17 Aug 2021 12:06:51 GMT Message-Id: <202108171206.17HC6pE2038641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b4b274889145 - main - rtld: provide private getenv(3) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b4b274889145bbc559613b54e7520b95f43e51e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 12:06:52 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b4b274889145bbc559613b54e7520b95f43e51e6 commit b4b274889145bbc559613b54e7520b95f43e51e6 Author: Konstantin Belousov AuthorDate: 2021-08-16 14:02:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-17 12:05:47 +0000 rtld: provide private getenv(3) Reviewed by: arichardson, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31545 --- libexec/rtld-elf/rtld-libc/Makefile.inc | 2 +- libexec/rtld-elf/rtld.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld-libc/Makefile.inc b/libexec/rtld-elf/rtld-libc/Makefile.inc index 7ffcb6e41ec7..ade2dc962aa2 100644 --- a/libexec/rtld-elf/rtld-libc/Makefile.inc +++ b/libexec/rtld-elf/rtld-libc/Makefile.inc @@ -27,7 +27,7 @@ SRCS+= rtld_libc.c # Now build the remaining files from libc: .PATH: ${LIBC_SRCTOP}/stdlib -SRCS+= reallocf.c realpath.c getenv.c merge.c reallocarray.c +SRCS+= reallocf.c realpath.c merge.c reallocarray.c # TODO: fix merge.c to build with WARNS=6 .if ${COMPILER_TYPE} == "clang" CFLAGS.merge.c+=-Wno-error=null-pointer-arithmetic diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 39c41fe0ed24..8fb99246a4c1 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -6027,6 +6027,12 @@ rtld_strerror(int errnum) return (sys_errlist[errnum]); } +char * +getenv(const char *name) +{ + return (rtld_get_env_val(environ, name, strlen(name))); +} + /* malloc */ void * malloc(size_t nbytes) From owner-dev-commits-src-main@freebsd.org Tue Aug 17 12:06:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 279EB663448; Tue, 17 Aug 2021 12:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpqWw6FQ4z4hfJ; Tue, 17 Aug 2021 12:06:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1A631D631; Tue, 17 Aug 2021 12:06:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HC6q3n038666; Tue, 17 Aug 2021 12:06:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HC6que038665; Tue, 17 Aug 2021 12:06:52 GMT (envelope-from git) Date: Tue, 17 Aug 2021 12:06:52 GMT Message-Id: <202108171206.17HC6que038665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: aa68b3bb2e11 - main - rtld: constify most variables holding references to the environment values MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa68b3bb2e11392f4636b3656b0f0bcacec3385a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 12:06:53 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=aa68b3bb2e11392f4636b3656b0f0bcacec3385a commit aa68b3bb2e11392f4636b3656b0f0bcacec3385a Author: Konstantin Belousov AuthorDate: 2021-08-16 16:55:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-17 12:06:08 +0000 rtld: constify most variables holding references to the environment values Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31545 --- libexec/rtld-elf/libmap.c | 14 ++++++------ libexec/rtld-elf/libmap.h | 2 +- libexec/rtld-elf/rtld.c | 56 +++++++++++++++++++++++++++-------------------- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c index 499d2cd2a1d9..e4388d14b951 100644 --- a/libexec/rtld-elf/libmap.c +++ b/libexec/rtld-elf/libmap.c @@ -64,22 +64,22 @@ static const char *quickbasename(const char *); #define rtld_isspace(c) ((c) == ' ' || (c) == '\t') int -lm_init(char *libmap_override) +lm_init(const char *libmap_override) { - char *p; + char *l, *p; dbg("lm_init(\"%s\")", libmap_override); TAILQ_INIT(&lmp_head); lmc_parse_file(ld_path_libmap_conf); - if (libmap_override) { + if (libmap_override != NULL) { /* * Do some character replacement to make $LDLIBMAP look * like a text file, then parse it. */ - libmap_override = xstrdup(libmap_override); - for (p = libmap_override; *p; p++) { + l = xstrdup(libmap_override); + for (p = l; *p != 0; p++) { switch (*p) { case '=': *p = ' '; @@ -89,8 +89,8 @@ lm_init(char *libmap_override) break; } } - lmc_parse(libmap_override, p - libmap_override); - free(libmap_override); + lmc_parse(l, p - l); + free(l); } return (lm_count == 0); diff --git a/libexec/rtld-elf/libmap.h b/libexec/rtld-elf/libmap.h index 0e9c668b4444..a5ba143f211f 100644 --- a/libexec/rtld-elf/libmap.h +++ b/libexec/rtld-elf/libmap.h @@ -2,7 +2,7 @@ * $FreeBSD$ */ -int lm_init (char *); +int lm_init(const char *); void lm_fini (void); char * lm_find (const char *, const char *); char * lm_findn (const char *, const char *, const size_t); diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 8fb99246a4c1..1a89a7b2c1de 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -123,7 +123,7 @@ static void linkmap_delete(Obj_Entry *); static void load_filtees(Obj_Entry *, int flags, RtldLockState *); static void unload_filtees(Obj_Entry *, RtldLockState *); static int load_needed_objects(Obj_Entry *, int); -static int load_preload_objects(char *, bool); +static int load_preload_objects(const char *, bool); static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int); static void map_stacks_exec(RtldLockState *); static int obj_disable_relro(Obj_Entry *); @@ -202,24 +202,24 @@ int __sys_openat(int, const char *, int, ...); struct r_debug r_debug __exported; /* for GDB; */ static bool libmap_disable; /* Disable libmap */ static bool ld_loadfltr; /* Immediate filters processing */ -static char *libmap_override; /* Maps to use in addition to libmap.conf */ +static const char *libmap_override;/* Maps to use in addition to libmap.conf */ static bool trust; /* False for setuid and setgid programs */ static bool dangerous_ld_env; /* True if environment variables have been used to affect the libraries loaded */ bool ld_bind_not; /* Disable PLT update */ -static char *ld_bind_now; /* Environment variable for immediate binding */ -static char *ld_debug; /* Environment variable for debugging */ +static const char *ld_bind_now; /* Environment variable for immediate binding */ +static const char *ld_debug; /* Environment variable for debugging */ static bool ld_dynamic_weak = true; /* True if non-weak definition overrides weak definition */ -static char *ld_library_path; /* Environment variable for search path */ -static char *ld_library_dirs; /* Environment variable for library descriptors */ -static char *ld_preload; /* Environment variable for libraries to +static const char *ld_library_path;/* Environment variable for search path */ +static const char *ld_library_dirs;/* Environment variable for library descriptors */ +static const char *ld_preload; /* Environment variable for libraries to load first */ -static char *ld_preload_fds; /* Environment variable for libraries represented by +static const char *ld_preload_fds;/* Environment variable for libraries represented by descriptors */ static const char *ld_elf_hints_path; /* Environment variable for alternative hints path */ static const char *ld_tracing; /* Called from ldd to print libs */ -static char *ld_utrace; /* Use utrace() to log events. */ +static const char *ld_utrace; /* Use utrace() to log events. */ static struct obj_entry_q obj_list; /* Queue of all loaded objects */ static Obj_Entry *obj_main; /* The main program shared object */ static Obj_Entry obj_rtld; /* The dynamic linker shared object */ @@ -367,8 +367,8 @@ enum { }; struct ld_env_var_desc { - const char *n; - char *val; + const char * const n; + const char *val; const bool unsecure; }; #define LD_ENV_DESC(var, unsec) \ @@ -398,13 +398,13 @@ static struct ld_env_var_desc ld_env_vars[] = { LD_ENV_DESC(TRACE_LOADED_OBJECTS_ALL, false), }; -static char * +static const char * ld_get_env_var(int idx) { return (ld_env_vars[idx].val); } -static char * +static const char * rtld_get_env_val(char **env, const char *name, size_t name_len) { char **m, *n, *v; @@ -493,8 +493,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) RtldLockState lockstate; struct stat st; Elf_Addr *argcp; - char **argv, **env, **envp, *kexecpath, *library_path_rpath; - const char *argv0, *binpath; + char **argv, **env, **envp, *kexecpath; + const char *argv0, *binpath, *library_path_rpath; struct ld_env_var_desc *lvd; caddr_t imgentry; char buf[MAXPATHLEN]; @@ -2600,36 +2600,42 @@ load_needed_objects(Obj_Entry *first, int flags) } static int -load_preload_objects(char *p, bool isfd) +load_preload_objects(const char *penv, bool isfd) { Obj_Entry *obj; + const char *name; + size_t len; + char savech, *p, *psave; + int fd; static const char delim[] = " \t:;"; - if (p == NULL) + if (penv == NULL) return (0); + p = psave = xstrdup(penv); p += strspn(p, delim); while (*p != '\0') { - const char *name; - size_t len = strcspn(p, delim); - char savech; - int fd; + len = strcspn(p, delim); savech = p[len]; p[len] = '\0'; if (isfd) { name = NULL; fd = parse_integer(p); - if (fd == -1) + if (fd == -1) { + free(psave); return (-1); + } } else { name = p; fd = -1; } obj = load_object(name, fd, NULL, 0); - if (obj == NULL) + if (obj == NULL) { + free(psave); return (-1); /* XXX - cleanup */ + } obj->z_interpose = true; p[len] = savech; p += len; @@ -2637,6 +2643,7 @@ load_preload_objects(char *p, bool isfd) } LD_UTRACE(UTRACE_PRELOAD_FINISHED, NULL, NULL, 0, 0, NULL); + free(psave); return (0); } @@ -6030,7 +6037,8 @@ rtld_strerror(int errnum) char * getenv(const char *name) { - return (rtld_get_env_val(environ, name, strlen(name))); + return (__DECONST(char *, rtld_get_env_val(environ, name, + strlen(name)))); } /* malloc */ From owner-dev-commits-src-main@freebsd.org Tue Aug 17 14:17:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6902166511D; Tue, 17 Aug 2021 14:17:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GptQw2D6Zz4s5G; Tue, 17 Aug 2021 14:17:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E9751EF36; Tue, 17 Aug 2021 14:17:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HEHivH012484; Tue, 17 Aug 2021 14:17:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HEHifv012483; Tue, 17 Aug 2021 14:17:44 GMT (envelope-from git) Date: Tue, 17 Aug 2021 14:17:44 GMT Message-Id: <202108171417.17HEHifv012483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: ee3ca711a898 - main - libfetch: use more portable getline() interface MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee3ca711a898cf41330c320826ea1e0e6e451f1d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 14:17:44 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=ee3ca711a898cf41330c320826ea1e0e6e451f1d commit ee3ca711a898cf41330c320826ea1e0e6e451f1d Author: Daniel Kolesa AuthorDate: 2021-08-17 14:01:46 +0000 Commit: Baptiste Daroussin CommitDate: 2021-08-17 14:17:22 +0000 libfetch: use more portable getline() interface this is for better portability in order to avoid using a function which is BSD-only or available via libbsd MFC after: 3 weeks --- lib/libfetch/http.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index e61e23b1425a..61f0f393ed98 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -1526,12 +1526,12 @@ http_get_proxy(struct url * url, const char *flags) static void http_print_html(FILE *out, FILE *in) { - size_t len; - char *line, *p, *q; + size_t len = 0; + char *line = NULL, *p, *q; int comment, tag; comment = tag = 0; - while ((line = fgetln(in, &len)) != NULL) { + while (getline(&line, &len, in) >= 0) { while (len && isspace((unsigned char)line[len - 1])) --len; for (p = q = line; q < line + len; ++q) { @@ -1559,6 +1559,8 @@ http_print_html(FILE *out, FILE *in) fwrite(p, q - p, 1, out); fputc('\n', out); } + + free(line); } From owner-dev-commits-src-main@freebsd.org Tue Aug 17 15:01:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 628A4665E1A; Tue, 17 Aug 2021 15:01:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpvPn25bBz4vL1; Tue, 17 Aug 2021 15:01:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FD701FC4C; Tue, 17 Aug 2021 15:01:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HF1nUb077631; Tue, 17 Aug 2021 15:01:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HF1nrm077630; Tue, 17 Aug 2021 15:01:49 GMT (envelope-from git) Date: Tue, 17 Aug 2021 15:01:49 GMT Message-Id: <202108171501.17HF1nrm077630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e86469075c5e - main - netinet tests: delete an interface with pending lookups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e86469075c5e391cc86e5bcd4f252712a69de37e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 15:01:49 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e86469075c5e391cc86e5bcd4f252712a69de37e commit e86469075c5e391cc86e5bcd4f252712a69de37e Author: Kristof Provost AuthorDate: 2021-08-17 14:19:29 +0000 Commit: Kristof Provost CommitDate: 2021-08-17 15:01:21 +0000 netinet tests: delete an interface with pending lookups This has been known to trigger panics. It currently doesn't, but we may as well have a test for it. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netinet/arp.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/sys/netinet/arp.sh b/tests/sys/netinet/arp.sh index 8b5b30911314..b909b9a48fb3 100755 --- a/tests/sys/netinet/arp.sh +++ b/tests/sys/netinet/arp.sh @@ -85,12 +85,48 @@ arp_del_success_cleanup() { vnet_cleanup } +atf_test_case "pending_delete_if" "cleanup" +pending_delete_if_head() { + atf_set descr 'Test having pending link layer lookups on interface delete' + atf_set require.user root +} + +pending_delete_if_body() { + vnet_init + + jname="arp_pending_delete_if" + epair=$(vnet_mkepair) + + ifconfig ${epair}b up + + vnet_mkjail ${jname} ${epair}a + jexec ${jname} ifconfig ${epair}a 198.51.100.1/24 + for i in `seq 2 200` + do + jexec ${jname} ping 198.51.100.${i} & + done + + # Give the ping processes time to send their ARP requests + sleep 1 + + jexec ${jname} arp -an + jexec ${jname} killall ping + + # Delete the interface. Test failure panics the machine. + ifconfig ${epair}b destroy +} + +pending_delete_if_cleanup() { + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "arp_add_success" atf_add_test_case "arp_del_success" + atf_add_test_case "pending_delete_if" } # end From owner-dev-commits-src-main@freebsd.org Tue Aug 17 15:51:35 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7F6516667DF; Tue, 17 Aug 2021 15:51:35 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4GpwWC39pfz3GCw; Tue, 17 Aug 2021 15:51:35 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f50.google.com with SMTP id e186so28272746iof.12; Tue, 17 Aug 2021 08:51:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sKz+mtzsE77MSMOk+xYmAua9lzPLgVI0Wpg7qnUuhY0=; b=Ia+DxBo5cvmW4lPM7SpKaACRbyBHdwswVATSzVfKnZkXC6xB8aApa1yC8B/YnAc5Sf J2+HDi8ct8kR1SUBj0AgMszrO4J2AUBoKvP6POc891Sm3ttP9YqvVwJv9xKPSM6+FZtY JX8kpmjFSIHfjSf6m8+Hse2v48gfUNN3ja/DpYUXYU0SSwxlSmQl1/dLNE9Tfi7t9oCo hH2w7ZbInz6WCYv3mBUTKkan9mYIfdDzd6FK9FR4nuH8+ckV7IQ4DDpfYGLHHbH1P0TP j0/hdixhciBl1MVLTOwDS71tUFuHrC4uxAdBf6Hos3Nj/ZC3s+UhP8ukEV5tp+FZYRfe IPLg== X-Gm-Message-State: AOAM532G0PqsydFdY1dCdL730YOtZAOLQHGh4lzCMauapPg1WxOyEhjx fiIg5YS2840iqU7yfHgArNFUNUhmSfv0hzrRl3MZO32I+vg= X-Google-Smtp-Source: ABdhPJwwF80nCEUzDOYXT5XVEY9K0+HiVFSt/Oxhy6rf6shStkJ8qK9fEulSHU+9nssLA6qiJnblvkZE95T8g1SXFSk= X-Received: by 2002:a02:90d0:: with SMTP id c16mr3548873jag.106.1629215488476; Tue, 17 Aug 2021 08:51:28 -0700 (PDT) MIME-Version: 1.0 References: <202108170631.17H6VrAE094329@gitrepo.freebsd.org> In-Reply-To: <202108170631.17H6VrAE094329@gitrepo.freebsd.org> From: Ed Maste Date: Tue, 17 Aug 2021 11:51:12 -0400 Message-ID: Subject: Re: git: e8ad0a0059af - main - ipmi: New tunable to deactivate IPMI watchdog To: Wojciech Macek Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GpwWC39pfz3GCw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 15:51:35 -0000 On Tue, 17 Aug 2021 at 02:31, Wojciech Macek wrote: > > The branch main has been updated by wma: > > URL: https://cgit.FreeBSD.org/src/commit/?id=e8ad0a0059afe1cd0af39bab49018ae7bc9be937 > > commit e8ad0a0059afe1cd0af39bab49018ae7bc9be937 > Author: Wojciech Macek > AuthorDate: 2021-08-17 06:28:21 +0000 > Commit: Wojciech Macek > CommitDate: 2021-08-17 06:31:00 +0000 > > ipmi: New tunable to deactivate IPMI watchdog A bit of post-commit review: >From sysctl.9: "For boolean sysctls, negative logic should be totally avoided. That is, do not use names like no_foobar or foobar_disable. They are confusing and lead to configuration errors. Use positive logic instead: foobar, foobar_enable." So, preferable to have wd_init_enable = 1 instead. > +SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_init_disable, CTLFLAG_RWTUN, > + &wd_init_disable, 0, ""); and we should have a description here. From owner-dev-commits-src-main@freebsd.org Tue Aug 17 16:11:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C974A666D5C; Tue, 17 Aug 2021 16:11:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gpwxf4L7cz3H9M; Tue, 17 Aug 2021 16:11:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D2BE20925; Tue, 17 Aug 2021 16:11:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HGB2EL069729; Tue, 17 Aug 2021 16:11:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HGB2P9069728; Tue, 17 Aug 2021 16:11:02 GMT (envelope-from git) Date: Tue, 17 Aug 2021 16:11:02 GMT Message-Id: <202108171611.17HGB2P9069728@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: dff1ba09f747 - main - sysctl.9: put negative sense sysctl note in own paragraph MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dff1ba09f74725bb0a0b7b8c229ed4e6665b43e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 16:11:02 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=dff1ba09f74725bb0a0b7b8c229ed4e6665b43e6 commit dff1ba09f74725bb0a0b7b8c229ed4e6665b43e6 Author: Ed Maste AuthorDate: 2021-08-17 15:58:03 +0000 Commit: Ed Maste CommitDate: 2021-08-17 16:10:44 +0000 sysctl.9: put negative sense sysctl note in own paragraph The sysctl man page cautions against negative-sense boolean sysctls (foobar_disable), but it gets lost at the end of a large paragraph. Move it to a separate paragraph in an attempt to make it more clear. This man page could use a more holistic review and edit pass. This change is simple and straightforward and I hope provides a small but immediate benefit. --- share/man/man9/sysctl.9 | 1 + 1 file changed, 1 insertion(+) diff --git a/share/man/man9/sysctl.9 b/share/man/man9/sysctl.9 index bae693489c73..f2b1159e71a8 100644 --- a/share/man/man9/sysctl.9 +++ b/share/man/man9/sysctl.9 @@ -1024,6 +1024,7 @@ underscore characters, as in Underscore characters may be omitted only if the name consists of not more than two words, each being not longer than four characters, as in .Va bootfile . +.Pp For boolean sysctls, negative logic should be totally avoided. That is, do not use names like .Va no_foobar From owner-dev-commits-src-main@freebsd.org Tue Aug 17 16:16:25 2021 Return-Path: Delivered-To: dev-commits-src-main@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 449DD666E52; Tue, 17 Aug 2021 16:16:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gpx3s1Gjtz3HHR; Tue, 17 Aug 2021 16:16:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12DE420C73; Tue, 17 Aug 2021 16:16:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HGGOm8072584; Tue, 17 Aug 2021 16:16:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HGGOwv072583; Tue, 17 Aug 2021 16:16:24 GMT (envelope-from git) Date: Tue, 17 Aug 2021 16:16:24 GMT Message-Id: <202108171616.17HGGOwv072583@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 0e92585cde51 - main - fstyp: add BeFS support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e92585cde5101506720ca1b904372317b7d84b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 16:16:25 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=0e92585cde5101506720ca1b904372317b7d84b6 commit 0e92585cde5101506720ca1b904372317b7d84b6 Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-17 15:07:31 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-08-17 16:16:07 +0000 fstyp: add BeFS support A simple support for detecting BeFS (BeOS) filesystem Submitted by: Miguel Gocobachi Differential Revision: https://reviews.freebsd.org/D29917 --- usr.sbin/fstyp/Makefile | 2 +- usr.sbin/fstyp/befs.c | 70 +++++++++++++++++++++++++++++++++++++ usr.sbin/fstyp/fstyp.8 | 4 ++- usr.sbin/fstyp/fstyp.c | 1 + usr.sbin/fstyp/fstyp.h | 1 + usr.sbin/fstyp/tests/Makefile | 1 + usr.sbin/fstyp/tests/befs.img.bz2 | Bin 0 -> 132 bytes usr.sbin/fstyp/tests/fstyp_test.sh | 11 ++++++ 8 files changed, 88 insertions(+), 2 deletions(-) diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index 14b5d9dfd9c3..384e2f7dee60 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -3,7 +3,7 @@ .include PROG= fstyp -SRCS= apfs.c cd9660.c exfat.c ext2fs.c fstyp.c geli.c hammer.c \ +SRCS= apfs.c befs.c cd9660.c exfat.c ext2fs.c fstyp.c geli.c hammer.c \ hammer2.c hfsplus.c msdosfs.c ntfs.c ufs.c .if ${MK_ZFS} != "no" diff --git a/usr.sbin/fstyp/befs.c b/usr.sbin/fstyp/befs.c new file mode 100644 index 000000000000..352fe7d4c296 --- /dev/null +++ b/usr.sbin/fstyp/befs.c @@ -0,0 +1,70 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Miguel Gocobachi + * + * 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 "fstyp.h" + +#define B_OS_NAME_LENGTH 32 +#define BEFS_BLOCK_OFFSET 512 +#define BEFS_SUPER_BLOCK_MAGIC1 0x42465331 + +struct disk_super_block { + char name[B_OS_NAME_LENGTH]; + int32_t magic1; +}; + +int +fstyp_befs(FILE *fp, char *label, size_t size) +{ + struct disk_super_block *volume; + + volume = read_buf(fp, BEFS_BLOCK_OFFSET, sizeof(*volume)); + + if (volume == NULL) { + return (1); + } + + if (volume->magic1 == BEFS_SUPER_BLOCK_MAGIC1) { + strlcpy(label, volume->name, size); + free(volume); + + return (0); + } + + free(volume); + + return (1); +} diff --git a/usr.sbin/fstyp/fstyp.8 b/usr.sbin/fstyp/fstyp.8 index d587e331490f..22d41628d8d5 100644 --- a/usr.sbin/fstyp/fstyp.8 +++ b/usr.sbin/fstyp/fstyp.8 @@ -42,7 +42,7 @@ The .Nm utility is used to determine the filesystem type on a given device. -It can recognize ISO-9660, exFAT, Ext2, FAT, NTFS, and UFS filesystems. +It can recognize BeFS (BeOS), ISO-9660, exFAT, Ext2, FAT, NTFS, and UFS filesystems. When the .Fl u flag is specified, @@ -59,6 +59,8 @@ The filesystem name is printed to the standard output as, respectively: .Bl -item -offset indent -compact .It +befs +.It cd9660 .It exfat diff --git a/usr.sbin/fstyp/fstyp.c b/usr.sbin/fstyp/fstyp.c index 46b5d6100011..b39277914aed 100644 --- a/usr.sbin/fstyp/fstyp.c +++ b/usr.sbin/fstyp/fstyp.c @@ -64,6 +64,7 @@ static struct { char *precache_encoding; } fstypes[] = { { "apfs", &fstyp_apfs, true, NULL }, + { "befs", &fstyp_befs, false, NULL }, { "cd9660", &fstyp_cd9660, false, NULL }, { "exfat", &fstyp_exfat, false, EXFAT_ENC }, { "ext2fs", &fstyp_ext2fs, false, NULL }, diff --git a/usr.sbin/fstyp/fstyp.h b/usr.sbin/fstyp/fstyp.h index 73861d7fdc0d..f11d66f5ffc2 100644 --- a/usr.sbin/fstyp/fstyp.h +++ b/usr.sbin/fstyp/fstyp.h @@ -50,6 +50,7 @@ char *checked_strdup(const char *s); void rtrim(char *label, size_t size); int fstyp_apfs(FILE *fp, char *label, size_t size); +int fstyp_befs(FILE *fp, char *label, size_t size); int fstyp_cd9660(FILE *fp, char *label, size_t size); int fstyp_exfat(FILE *fp, char *label, size_t size); int fstyp_ext2fs(FILE *fp, char *label, size_t size); diff --git a/usr.sbin/fstyp/tests/Makefile b/usr.sbin/fstyp/tests/Makefile index 9c4624af3a4c..c821bc9b45eb 100644 --- a/usr.sbin/fstyp/tests/Makefile +++ b/usr.sbin/fstyp/tests/Makefile @@ -4,6 +4,7 @@ PACKAGE= tests ATF_TESTS_SH= fstyp_test +${PACKAGE}FILES+= befs.img.bz2 ${PACKAGE}FILES+= dfr-01-xfat.img.bz2 ${PACKAGE}FILES+= ext2.img.bz2 ${PACKAGE}FILES+= ext3.img.bz2 diff --git a/usr.sbin/fstyp/tests/befs.img.bz2 b/usr.sbin/fstyp/tests/befs.img.bz2 new file mode 100644 index 000000000000..c2a6693216d5 Binary files /dev/null and b/usr.sbin/fstyp/tests/befs.img.bz2 differ diff --git a/usr.sbin/fstyp/tests/fstyp_test.sh b/usr.sbin/fstyp/tests/fstyp_test.sh index 8f76424f5f75..81a549629dd7 100755 --- a/usr.sbin/fstyp/tests/fstyp_test.sh +++ b/usr.sbin/fstyp/tests/fstyp_test.sh @@ -27,6 +27,16 @@ # $FreeBSD$ +atf_test_case befs +befs_head() { + atf_set "descr" "fstyp(8) can detect BeFS and label filesystem" +} +befs_body() { + bzcat $(atf_get_srcdir)/befs.img.bz2 > befs.img + atf_check -s exit:0 -o inline:"befs\n" fstyp befs.img + atf_check -s exit:0 -o inline:"befs BeFS\n" fstyp -l befs.img +} + atf_test_case cd9660 cd9660_head() { atf_set "descr" "fstyp(8) should detect cd9660 filesystems" @@ -257,6 +267,7 @@ zeros_body() { atf_init_test_cases() { + atf_add_test_case befs atf_add_test_case cd9660 atf_add_test_case cd9660_label atf_add_test_case dir From owner-dev-commits-src-main@freebsd.org Tue Aug 17 16:45:23 2021 Return-Path: Delivered-To: dev-commits-src-main@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 92716667B12; Tue, 17 Aug 2021 16:45:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpxjH3TgTz3KL0; Tue, 17 Aug 2021 16:45:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FA4D2116D; Tue, 17 Aug 2021 16:45:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HGjNJ8012770; Tue, 17 Aug 2021 16:45:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HGjNL3012769; Tue, 17 Aug 2021 16:45:23 GMT (envelope-from git) Date: Tue, 17 Aug 2021 16:45:23 GMT Message-Id: <202108171645.17HGjNL3012769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: d9f25575a29f - main - Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d9f25575a29ff7c83f226349a10a37b9aaf75ad5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 16:45:23 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d9f25575a29ff7c83f226349a10a37b9aaf75ad5 commit d9f25575a29ff7c83f226349a10a37b9aaf75ad5 Author: Alex Richardson AuthorDate: 2021-08-17 16:44:40 +0000 Commit: Alex Richardson CommitDate: 2021-08-17 16:44:52 +0000 Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now I enabled these options again in 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3, but unfortunately only my specific build configuration worked whereas the build with default options is still broken. --- share/mk/src.opts.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index bd360dd1ad29..e4427cb637a1 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -360,6 +360,13 @@ __DEFAULT_YES_OPTIONS+=OPENMP __DEFAULT_NO_OPTIONS+=OPENMP .endif +.if ${.MAKE.OS} != "FreeBSD" +# Bootstrapping the toolchain and building LLDB currently results in build +# failures non-FreeBSD, so disable these options until the fixes that are +# currently under review have landed. +BROKEN_OPTIONS+=LLDB CLANG_BOOTSTRAP LLD_BOOTSTRAP +.endif + .include # From owner-dev-commits-src-main@freebsd.org Tue Aug 17 17:00:46 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4EA3966764F for ; Tue, 17 Aug 2021 17:00:46 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4Gpy320fgnz3LCr for ; Tue, 17 Aug 2021 17:00:45 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f46.google.com with SMTP id f9-20020a05600c1549b029025b0f5d8c6cso2406824wmg.4 for ; Tue, 17 Aug 2021 10:00:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=B+GUQWjEyKw/XCznC/FyWMLdH+W/leftPpwx2pujvAA=; b=htnzJN8S+hYF1gv7t0jBG1GimPyPJLL7QSGwMYyOHEvMidPJUZLVYMjx2LfTCe+GGH eE0WlLNacG6uWlOu+vNKyC6mO2zZNabqkNW6kJdY8k8EZqpmEu2TqGDDBNM7weVZwSxk JCV6+BIEKOwpXk667XuXp6Co8ZPgddDzQ3e2fb3Edb3L9D9RzdG06ot+xOSZJYSiEL23 YhbZdOSgdZo9NKeoP3izIWfekg34sZlnGX9/ct+x+FzPL9ApSl+88L+Ck0WQ+HZT7mJa TFjMd7OwysZ2eaMJOdHFtrDxyZmOIjPvC/+XilBcgCmyoNVTjfoKCqaep/UWre561M34 ogjQ== X-Gm-Message-State: AOAM5315etUO3ApVsPl81NrEhKtC+Z34sEfJi+b6OqcDweBImIBDa/ho 7jq0f/E+iTdRvlOeBALSOSuZMjpW8vyJQw== X-Google-Smtp-Source: ABdhPJwpuxlm41Jpzw6pmP0q5Ydq1xmFDK+PzTiPbBDMFdAVE21gKmI2RzXg16B64ONJHtwgrPhzQA== X-Received: by 2002:a1c:a7c2:: with SMTP id q185mr449541wme.91.1629219639585; Tue, 17 Aug 2021 10:00:39 -0700 (PDT) Received: from smtpclient.apple (global-5-141.nat-2.net.cam.ac.uk. [131.111.5.141]) by smtp.gmail.com with ESMTPSA id a11sm3118243wrw.67.2021.08.17.10.00.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Aug 2021 10:00:39 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: d9f25575a29f - main - Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now From: Jessica Clarke In-Reply-To: <202108171645.17HGjNL3012769@gitrepo.freebsd.org> Date: Tue, 17 Aug 2021 18:00:38 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <4C25E4D8-D33E-4397-956E-D21B80239EBA@freebsd.org> References: <202108171645.17HGjNL3012769@gitrepo.freebsd.org> To: Alex Richardson X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4Gpy320fgnz3LCr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 17:00:46 -0000 On 17 Aug 2021, at 17:45, Alex Richardson = wrote: >=20 > The branch main has been updated by arichardson: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dd9f25575a29ff7c83f226349a10a37b9= aaf75ad5 >=20 > commit d9f25575a29ff7c83f226349a10a37b9aaf75ad5 > Author: Alex Richardson > AuthorDate: 2021-08-17 16:44:40 +0000 > Commit: Alex Richardson > CommitDate: 2021-08-17 16:44:52 +0000 >=20 > Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD = for now >=20 > I enabled these options again in = 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3, > but unfortunately only my specific build configuration worked = whereas the > build with default options is still broken. Insta-MFC to fix stable/13 cross-builds? Jess From owner-dev-commits-src-main@freebsd.org Tue Aug 17 17:15:46 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0CA246684C2; Tue, 17 Aug 2021 17:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpyNK6yZwz3Nbw; Tue, 17 Aug 2021 17:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D741A21847; Tue, 17 Aug 2021 17:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HHFjo3053392; Tue, 17 Aug 2021 17:15:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HHFjXM053391; Tue, 17 Aug 2021 17:15:45 GMT (envelope-from git) Date: Tue, 17 Aug 2021 17:15:45 GMT Message-Id: <202108171715.17HHFjXM053391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: f49931c1423e - main - style.9: remove an outdated comment about indent(1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f49931c1423e1c9454214f82bbb3ec30d0fee57d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 17:15:46 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=f49931c1423e1c9454214f82bbb3ec30d0fee57d commit f49931c1423e1c9454214f82bbb3ec30d0fee57d Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-17 15:56:41 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-08-17 17:06:24 +0000 style.9: remove an outdated comment about indent(1) indent(1) has had -ncs and -nbs for some time now. --- share/man/man9/style.9 | 3 --- 1 file changed, 3 deletions(-) diff --git a/share/man/man9/style.9 b/share/man/man9/style.9 index fff0e3815c13..beeb8d4568d2 100644 --- a/share/man/man9/style.9 +++ b/share/man/man9/style.9 @@ -734,9 +734,6 @@ scope is undesirable and will elicit complaints from a good compiler. Casts and .Ic sizeof Ns 's are not followed by a space. -Note that -.Xr indent 1 -does not understand this rule. .Ic sizeof Ns 's are written with parenthesis always. The redundant parenthesis rules do not apply to From owner-dev-commits-src-main@freebsd.org Tue Aug 17 17:15:47 2021 Return-Path: Delivered-To: dev-commits-src-main@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 3DDE16682A4; Tue, 17 Aug 2021 17:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpyNM0p75z3NQP; Tue, 17 Aug 2021 17:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 016362198F; Tue, 17 Aug 2021 17:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HHFknI053416; Tue, 17 Aug 2021 17:15:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HHFkBe053415; Tue, 17 Aug 2021 17:15:46 GMT (envelope-from git) Date: Tue, 17 Aug 2021 17:15:46 GMT Message-Id: <202108171715.17HHFkBe053415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: c66e9307ea95 - main - mount.h: improve a comment about flags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c66e9307ea9520f3d6e4d38dc842a99a31ae80bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 17:15:47 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=c66e9307ea9520f3d6e4d38dc842a99a31ae80bf commit c66e9307ea9520f3d6e4d38dc842a99a31ae80bf Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-14 20:07:09 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-08-17 17:08:33 +0000 mount.h: improve a comment about flags The comment only specifies MNT_ROOTFS - which is set by the kernel when mounting its root file system. So it's not clear if any other flags are not quite right and for what reason. --- sys/sys/mount.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 016c7e9c188d..f4b5945d3ad0 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -398,9 +398,7 @@ struct mntoptnames { #define MNT_EXTLSCERTUSER 0x0000010000000000ULL /* require TLS with user cert */ /* - * Flags set by internal operations, - * but visible to the user. - * XXX some of these are not quite right.. (I've never seen the root flag set) + * Flags set by internal operations, but visible to the user. */ #define MNT_LOCAL 0x0000000000001000ULL /* filesystem is stored locally */ #define MNT_QUOTA 0x0000000000002000ULL /* quotas are enabled on fs */ From owner-dev-commits-src-main@freebsd.org Tue Aug 17 18:34:24 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C9609669274; Tue, 17 Aug 2021 18:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq07453Cqz3kGL; Tue, 17 Aug 2021 18:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 958902286C; Tue, 17 Aug 2021 18:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HIYOMr061760; Tue, 17 Aug 2021 18:34:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HIYOjv061759; Tue, 17 Aug 2021 18:34:24 GMT (envelope-from git) Date: Tue, 17 Aug 2021 18:34:24 GMT Message-Id: <202108171834.17HIYOjv061759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: cbc186360c65 - main - cxgbei: Restructure how PDU limits are managed. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cbc186360c658eda884ed97f37cdc2d1b6512b91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 18:34:24 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cbc186360c658eda884ed97f37cdc2d1b6512b91 commit cbc186360c658eda884ed97f37cdc2d1b6512b91 Author: John Baldwin AuthorDate: 2021-08-17 18:14:11 +0000 Commit: John Baldwin CommitDate: 2021-08-17 18:14:11 +0000 cxgbei: Restructure how PDU limits are managed. - Compute data segment limits in read_pdu_limits() rather than PDU length limits. - Add back connection-specific PDU overhead lengths to compute PDU length limits in icl_cxgbei_conn_handoff(). Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31574 --- sys/dev/cxgbe/cxgbei/cxgbei.c | 19 ++++++++++++++----- sys/dev/cxgbe/cxgbei/cxgbei.h | 4 ++-- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 30 ++++++++++++++++++------------ 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 5cce7d3fce05..24187c862fe6 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -97,8 +97,8 @@ static struct cxgbei_worker_thread_softc *cwt_softc; static struct proc *cxgbei_proc; static void -read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, - uint32_t *max_rx_pdu_len) +read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, + uint32_t *max_rx_data_len) { uint32_t tx_len, rx_len, r, v; @@ -114,8 +114,17 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, rx_len = min(rx_len, v); tx_len = min(tx_len, v); - *max_tx_pdu_len = rounddown2(tx_len, 512); - *max_rx_pdu_len = rounddown2(rx_len, 512); + /* + * AHS is not supported by the kernel so we'll not account for + * it either in our PDU len -> data segment len conversions. + */ + rx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + + ISCSI_DATA_DIGEST_SIZE; + tx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + + ISCSI_DATA_DIGEST_SIZE; + + *max_tx_data_len = rounddown2(tx_len, 512); + *max_rx_data_len = rounddown2(rx_len, 512); } /* @@ -135,7 +144,7 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) MPASS(sc->vres.iscsi.size > 0); MPASS(ci != NULL); - read_pdu_limits(sc, &ci->max_tx_pdu_len, &ci->max_rx_pdu_len); + read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len); pr = &ci->pr; r = t4_read_reg(sc, A_ULP_RX_ISCSI_PSZ); diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 433f15b743fe..20754fa893a8 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -125,8 +125,8 @@ ip_to_icp(struct icl_pdu *ip) } struct cxgbei_data { - u_int max_tx_pdu_len; - u_int max_rx_pdu_len; + u_int max_tx_data_len; + u_int max_rx_data_len; u_int ddp_threshold; struct ppod_region pr; diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 5526388915f7..a6e7f8b95815 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -783,6 +783,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) struct tcpcb *tp; struct toepcb *toep; cap_rights_t rights; + u_int max_rx_pdu_len, max_tx_pdu_len; int error, max_iso_pdus; MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); @@ -828,6 +829,17 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) icc->sc = fa.sc; ci = icc->sc->iscsi_ulp_softc; + max_rx_pdu_len = ISCSI_BHS_SIZE + ic->ic_max_recv_data_segment_length; + max_tx_pdu_len = ISCSI_BHS_SIZE + ic->ic_max_send_data_segment_length; + if (ic->ic_header_crc32c) { + max_rx_pdu_len += ISCSI_HEADER_DIGEST_SIZE; + max_tx_pdu_len += ISCSI_HEADER_DIGEST_SIZE; + } + if (ic->ic_data_crc32c) { + max_rx_pdu_len += ISCSI_DATA_DIGEST_SIZE; + max_tx_pdu_len += ISCSI_DATA_DIGEST_SIZE; + } + inp = sotoinpcb(so); INP_WLOCK(inp); tp = intotcpcb(inp); @@ -853,7 +865,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5) { max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / - ci->max_tx_pdu_len; + max_tx_pdu_len; ic->ic_hw_isomax = max_iso_pdus * ic->ic_max_send_data_segment_length; } else @@ -864,15 +876,15 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) toep->ulpcb = icc; send_iscsi_flowc_wr(icc->sc, toep, - roundup(max_iso_pdus * ci->max_tx_pdu_len, tp->t_maxseg)); + roundup(max_iso_pdus * max_tx_pdu_len, tp->t_maxseg)); set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); error = 0; } INP_WUNLOCK(inp); if (error == 0) { - error = icl_cxgbei_setsockopt(ic, so, ci->max_tx_pdu_len, - ci->max_rx_pdu_len); + error = icl_cxgbei_setsockopt(ic, so, max_tx_pdu_len, + max_rx_pdu_len); } return (error); @@ -1378,18 +1390,12 @@ cxgbei_limits(struct adapter *sc, void *arg) ci = sc->iscsi_ulp_softc; MPASS(ci != NULL); - /* - * AHS is not supported by the kernel so we'll not account for - * it either in our PDU len -> data segment len conversions. - */ - max_dsl = ci->max_rx_pdu_len - ISCSI_BHS_SIZE - - ISCSI_HEADER_DIGEST_SIZE - ISCSI_DATA_DIGEST_SIZE; + max_dsl = ci->max_rx_data_len; if (idl->idl_max_recv_data_segment_length > max_dsl) idl->idl_max_recv_data_segment_length = max_dsl; - max_dsl = ci->max_tx_pdu_len - ISCSI_BHS_SIZE - - ISCSI_HEADER_DIGEST_SIZE - ISCSI_DATA_DIGEST_SIZE; + max_dsl = ci->max_tx_data_len; if (idl->idl_max_send_data_segment_length > max_dsl) idl->idl_max_send_data_segment_length = max_dsl; } From owner-dev-commits-src-main@freebsd.org Tue Aug 17 18:34:25 2021 Return-Path: Delivered-To: dev-commits-src-main@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 ECA12669744; Tue, 17 Aug 2021 18:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq0756Fdmz3kW8; Tue, 17 Aug 2021 18:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA2E4225E2; Tue, 17 Aug 2021 18:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HIYPDp061789; Tue, 17 Aug 2021 18:34:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HIYPY0061787; Tue, 17 Aug 2021 18:34:25 GMT (envelope-from git) Date: Tue, 17 Aug 2021 18:34:25 GMT Message-Id: <202108171834.17HIYPY0061787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: f28715fdc1f7 - main - cxgbei: Only round PDU data segment lengths down by 512 on T5. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f28715fdc1f7e801b260369787e7bcd633a481bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 18:34:26 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f28715fdc1f7e801b260369787e7bcd633a481bb commit f28715fdc1f7e801b260369787e7bcd633a481bb Author: John Baldwin AuthorDate: 2021-08-17 18:14:29 +0000 Commit: John Baldwin CommitDate: 2021-08-17 18:14:29 +0000 cxgbei: Only round PDU data segment lengths down by 512 on T5. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31575 --- sys/dev/cxgbe/cxgbei/cxgbei.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 24187c862fe6..acf6ee74c94f 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -123,8 +123,13 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, tx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE; - *max_tx_data_len = rounddown2(tx_len, 512); - *max_rx_data_len = rounddown2(rx_len, 512); + if (chip_id(sc) == CHELSIO_T5) { + rx_len = rounddown2(rx_len, 512); + tx_len = rounddown2(tx_len, 512); + } + + *max_tx_data_len = tx_len; + *max_rx_data_len = rx_len; } /* From owner-dev-commits-src-main@freebsd.org Tue Aug 17 18:34:27 2021 Return-Path: Delivered-To: dev-commits-src-main@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 098676695BB; Tue, 17 Aug 2021 18:34:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq0766kScz3kYg; Tue, 17 Aug 2021 18:34:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE5322286D; Tue, 17 Aug 2021 18:34:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HIYQk8061815; Tue, 17 Aug 2021 18:34:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HIYQJT061814; Tue, 17 Aug 2021 18:34:26 GMT (envelope-from git) Date: Tue, 17 Aug 2021 18:34:26 GMT Message-Id: <202108171834.17HIYQJT061814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d75b0870e542 - main - cxgbei: Restrict received PDUs to 4 DDP pages in length. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d75b0870e542613e63d9f4ac8ec9fb22817e34fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 18:34:27 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d75b0870e542613e63d9f4ac8ec9fb22817e34fa commit d75b0870e542613e63d9f4ac8ec9fb22817e34fa Author: John Baldwin AuthorDate: 2021-08-17 18:14:37 +0000 Commit: John Baldwin CommitDate: 2021-08-17 18:14:37 +0000 cxgbei: Restrict received PDUs to 4 DDP pages in length. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31576 --- sys/dev/cxgbe/cxgbei/cxgbei.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index acf6ee74c94f..8dc580d65770 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -98,7 +98,7 @@ static struct proc *cxgbei_proc; static void read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, - uint32_t *max_rx_data_len) + uint32_t *max_rx_data_len, struct ppod_region *pr) { uint32_t tx_len, rx_len, r, v; @@ -123,6 +123,14 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, tx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE; + /* + * DDP can place only 4 pages for a single PDU. A single + * request might use larger pages than the smallest page size, + * but that cannot be guaranteed. Assume the smallest DDP + * page size for this limit. + */ + rx_len = min(rx_len, 4 * (1U << pr->pr_page_shift[0])); + if (chip_id(sc) == CHELSIO_T5) { rx_len = rounddown2(rx_len, 512); tx_len = rounddown2(tx_len, 512); @@ -149,8 +157,6 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) MPASS(sc->vres.iscsi.size > 0); MPASS(ci != NULL); - read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len); - pr = &ci->pr; r = t4_read_reg(sc, A_ULP_RX_ISCSI_PSZ); rc = t4_init_ppod_region(pr, &sc->vres.iscsi, r, "iSCSI page pods"); @@ -176,6 +182,8 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) V_ISCSITAGMASK(M_ISCSITAGMASK), pr->pr_tag_mask); } + read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len, pr); + sysctl_ctx_init(&ci->ctx); oid = device_get_sysctl_tree(sc->dev); /* dev.t5nex.X */ children = SYSCTL_CHILDREN(oid); From owner-dev-commits-src-main@freebsd.org Tue Aug 17 19:07:06 2021 Return-Path: Delivered-To: dev-commits-src-main@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 F01216697D3; Tue, 17 Aug 2021 19:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq0rp6D3Dz3m3w; Tue, 17 Aug 2021 19:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDD1E22E7C; Tue, 17 Aug 2021 19:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HJ76LE002675; Tue, 17 Aug 2021 19:07:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HJ76kd002674; Tue, 17 Aug 2021 19:07:06 GMT (envelope-from git) Date: Tue, 17 Aug 2021 19:07:06 GMT Message-Id: <202108171907.17HJ76kd002674@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: a3ddd7c92b99 - main - _worldtmp: Fix some sub-makes not working with make -n MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3ddd7c92b9947ac4518fb0b55c2275422d0d627 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 19:07:07 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=a3ddd7c92b9947ac4518fb0b55c2275422d0d627 commit a3ddd7c92b9947ac4518fb0b55c2275422d0d627 Author: Bryan Drewery AuthorDate: 2021-08-17 19:06:14 +0000 Commit: Bryan Drewery CommitDate: 2021-08-17 19:06:40 +0000 _worldtmp: Fix some sub-makes not working with make -n --- Makefile.inc1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 2b631c2311f0..9209f0ef053c 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1046,11 +1046,11 @@ _worldtmp: .PHONY @touch ${WORLDTMP}/${.TARGET} # We can't use mtree to create the worldtmp directories since it may not be # available on the target system (this happens e.g. when building on non-FreeBSD) - cd ${.CURDIR}/tools/build; \ + ${_+_}cd ${.CURDIR}/tools/build; \ ${MAKE} DIRPRFX=tools/build/ DESTDIR=${WORLDTMP}/legacy installdirs # In order to build without inheriting $PATH we need to add symlinks to the host # tools in $WORLDTMP for the tools that we don't build during bootstrap-tools - cd ${.CURDIR}/tools/build; \ + ${_+_}cd ${.CURDIR}/tools/build; \ ${MAKE} DIRPRFX=tools/build/ DESTDIR=${WORLDTMP}/legacy host-symlinks _legacy: From owner-dev-commits-src-main@freebsd.org Tue Aug 17 19:11:23 2021 Return-Path: Delivered-To: dev-commits-src-main@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 43EF8669EE8; Tue, 17 Aug 2021 19:11:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq0xl1S3tz3mXC; Tue, 17 Aug 2021 19:11:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19DD823256; Tue, 17 Aug 2021 19:11:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HJBNPN015907; Tue, 17 Aug 2021 19:11:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HJBMu3015906; Tue, 17 Aug 2021 19:11:22 GMT (envelope-from git) Date: Tue, 17 Aug 2021 19:11:22 GMT Message-Id: <202108171911.17HJBMu3015906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 2faf504d1ab8 - main - zfs: merge openzfs/zfs@8ae86e2ed (master) into main MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2faf504d1ab821fe2b9df9d2afb49bb35e1334f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 19:11:23 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=2faf504d1ab821fe2b9df9d2afb49bb35e1334f4 commit 2faf504d1ab821fe2b9df9d2afb49bb35e1334f4 Merge: a3ddd7c92b99 8ae86e2edc73 Author: Martin Matuska AuthorDate: 2021-08-17 19:10:18 +0000 Commit: Martin Matuska CommitDate: 2021-08-17 19:10:44 +0000 zfs: merge openzfs/zfs@8ae86e2ed (master) into main Notable upstream pull request merges: #12422 Fix/improve dbuf hits accounting #12406 Increase default volblocksize from 8KB to 16KB #12398 Remove b_pabd/b_rabd allocation from arc_hdr_alloc() #12397 Run arc_evict thread at higher priority #12297 Avoid vq_lock drop in vdev_queue_aggregate() #12161 Restore FreeBSD sysctl processing for arc.min and arc.max Obtained from: OpenZFS OpenZFS commit: 8ae86e2edc736483c1530fd689525aa2460eaec8 sys/contrib/openzfs/configure.ac | 1 + .../openzfs/include/os/freebsd/spl/sys/mod_os.h | 6 + .../openzfs/include/os/linux/zfs/sys/trace_arc.h | 4 +- .../include/os/linux/zfs/sys/zfs_znode_impl.h | 4 +- sys/contrib/openzfs/include/sys/arc.h | 7 + sys/contrib/openzfs/include/sys/arc_impl.h | 14 +- sys/contrib/openzfs/include/sys/fs/zfs.h | 2 +- sys/contrib/openzfs/include/sys/zfs_refcount.h | 8 +- sys/contrib/openzfs/include/sys/zthr.h | 5 +- sys/contrib/openzfs/man/man4/zfs.4 | 2 +- sys/contrib/openzfs/man/man7/zfsprops.7 | 2 +- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 2 +- .../openzfs/module/os/freebsd/zfs/sysctl_os.c | 53 +++++- sys/contrib/openzfs/module/os/linux/zfs/arc_os.c | 14 +- .../openzfs/module/os/linux/zfs/zfs_znode.c | 12 +- .../openzfs/module/os/linux/zfs/zpl_inode.c | 34 +++- sys/contrib/openzfs/module/zfs/arc.c | 192 ++++++++++++--------- sys/contrib/openzfs/module/zfs/refcount.c | 51 +++--- sys/contrib/openzfs/module/zfs/spa.c | 7 +- sys/contrib/openzfs/module/zfs/vdev_indirect.c | 2 +- sys/contrib/openzfs/module/zfs/vdev_queue.c | 63 +++---- sys/contrib/openzfs/module/zfs/zthr.c | 19 +- sys/contrib/openzfs/scripts/zfs.sh | 12 +- sys/contrib/openzfs/tests/Makefile.am | 2 +- sys/contrib/openzfs/tests/runfiles/common.run | 4 + .../openzfs/tests/test-runner/bin/zts-report.py.in | 7 + .../openzfs/tests/zfs-tests/include/libtest.shlib | 28 +++ .../tests/zfs-tests/tests/functional/Makefile.am | 1 + .../functional/cli_root/zfs_create/zfs_create.cfg | 2 +- .../cli_root/zfs_diff/zfs_diff_timestamp.ksh | 6 +- .../zfs-tests/tests/functional/crtime/Makefile.am | 5 + .../zfs-tests/tests/functional/crtime/cleanup.ksh | 34 ++++ .../tests/functional/crtime/crtime_001_pos.ksh | 71 ++++++++ .../zfs-tests/tests/functional/crtime/setup.ksh | 35 ++++ .../tests/functional/nopwrite/nopwrite_volume.ksh | 4 +- .../functional/redacted_send/redacted_panic.ksh | 10 +- .../tests/functional/reservation/reservation.shlib | 6 +- sys/modules/zfs/zfs_config.h | 4 +- sys/modules/zfs/zfs_gitrev.h | 2 +- 39 files changed, 535 insertions(+), 202 deletions(-) diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/Makefile.am index 000000000000,13e1c2dde31b..13e1c2dde31b mode 000000,100644..100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/Makefile.am diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/cleanup.ksh index 000000000000,3166bd6ec16e..3166bd6ec16e mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/cleanup.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/cleanup.ksh diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/crtime_001_pos.ksh index 000000000000,4f9810553fa6..4f9810553fa6 mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/crtime_001_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/crtime_001_pos.ksh diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/setup.ksh index 000000000000,fc5cec3063a6..fc5cec3063a6 mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/setup.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/setup.ksh diff --cc sys/modules/zfs/zfs_config.h index 9542f241179f,000000000000..75eec9c705a4 mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,849 -1,0 +1,849 @@@ +/* + * $FreeBSD$ + */ + +/* zfs_config.h. Generated from zfs_config.h.in by configure. */ +/* zfs_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* bio_end_io_t wants 1 arg */ +/* #undef HAVE_1ARG_BIO_END_IO_T */ + +/* lookup_bdev() wants 1 arg */ +/* #undef HAVE_1ARG_LOOKUP_BDEV */ + +/* submit_bio() wants 1 arg */ +/* #undef HAVE_1ARG_SUBMIT_BIO */ + +/* bdi_setup_and_register() wants 2 args */ +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 2 args */ +/* #undef HAVE_2ARGS_VFS_GETATTR */ + +/* zlib_deflate_workspacesize() wants 2 args */ +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ + +/* bdi_setup_and_register() wants 3 args */ +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 3 args */ +/* #undef HAVE_3ARGS_VFS_GETATTR */ + +/* vfs_getattr wants 4 args */ +/* #undef HAVE_4ARGS_VFS_GETATTR */ + +/* kernel has access_ok with 'type' parameter */ +/* #undef HAVE_ACCESS_OK_TYPE */ + +/* posix_acl has refcount_t */ +/* #undef HAVE_ACL_REFCOUNT */ + +/* Define if host toolchain supports AES */ +#define HAVE_AES 1 + +#ifdef __amd64__ +#ifndef RESCUE +/* Define if host toolchain supports AVX */ +#define HAVE_AVX 1 +#endif + +/* Define if host toolchain supports AVX2 */ +#define HAVE_AVX2 1 + +/* Define if host toolchain supports AVX512BW */ +#define HAVE_AVX512BW 1 + +/* Define if host toolchain supports AVX512CD */ +#define HAVE_AVX512CD 1 + +/* Define if host toolchain supports AVX512DQ */ +#define HAVE_AVX512DQ 1 + +/* Define if host toolchain supports AVX512ER */ +#define HAVE_AVX512ER 1 + +/* Define if host toolchain supports AVX512F */ +#define HAVE_AVX512F 1 + +/* Define if host toolchain supports AVX512IFMA */ +#define HAVE_AVX512IFMA 1 + +/* Define if host toolchain supports AVX512PF */ +#define HAVE_AVX512PF 1 + +/* Define if host toolchain supports AVX512VBMI */ +#define HAVE_AVX512VBMI 1 + +/* Define if host toolchain supports AVX512VL */ +#define HAVE_AVX512VL 1 +#endif + +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + +/* bio->bi_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + +/* bio->bi_opf is defined */ +/* #undef HAVE_BIO_BI_OPF */ + +/* bio->bi_status exists */ +/* #undef HAVE_BIO_BI_STATUS */ + +/* bio has bi_iter */ +/* #undef HAVE_BIO_BVEC_ITER */ + +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + +/* bio_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + +/* bio_set_dev() is available */ +/* #undef HAVE_BIO_SET_DEV */ + +/* bio_set_dev() GPL-only */ +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */ + +/* bio_set_op_attrs is available */ +/* #undef HAVE_BIO_SET_OP_ATTRS */ + +/* blkdev_reread_part() exists */ +/* #undef HAVE_BLKDEV_REREAD_PART */ + +/* blkg_tryget() is available */ +/* #undef HAVE_BLKG_TRYGET */ + +/* blkg_tryget() GPL-only */ +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */ + +/* blk_alloc_disk() exists */ +/* #undef HAVE_BLK_ALLOC_DISK */ + +/* blk_alloc_queue() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ + +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + +/* blk queue backing_dev_info is dynamic */ +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ + +/* blk_queue_flag_clear() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */ + +/* blk_queue_flag_set() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_SET */ + +/* blk_queue_flush() is available */ +/* #undef HAVE_BLK_QUEUE_FLUSH */ + +/* blk_queue_flush() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */ + +/* blk_queue_secdiscard() is available */ +/* #undef HAVE_BLK_QUEUE_SECDISCARD */ + +/* blk_queue_secure_erase() is available */ +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */ + +/* blk_queue_write_cache() exists */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */ + +/* blk_queue_write_cache() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ + +/* Define if revalidate_disk() in block_device_operations */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + +/* clear_inode() is available */ +/* #undef HAVE_CLEAR_INODE */ + +/* dentry uses const struct dentry_operations */ +/* #undef HAVE_CONST_DENTRY_OPERATIONS */ + +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + +/* current_time() exists */ +/* #undef HAVE_CURRENT_TIME */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* DECLARE_EVENT_CLASS() is available */ +/* #undef HAVE_DECLARE_EVENT_CLASS */ + +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + +/* sops->dirty_inode() wants flags */ +/* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ + +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* d_make_root() is available */ +/* #undef HAVE_D_MAKE_ROOT */ + +/* d_prune_aliases() is available */ +/* #undef HAVE_D_PRUNE_ALIASES */ + +/* dops->d_revalidate() operation takes nameidata */ +/* #undef HAVE_D_REVALIDATE_NAMEIDATA */ + +/* eops->encode_fh() wants child and parent inodes */ +/* #undef HAVE_ENCODE_FH_WITH_INODE */ + +/* sops->evict_inode() exists */ +/* #undef HAVE_EVICT_INODE */ + +/* fops->aio_fsync() exists */ +/* #undef HAVE_FILE_AIO_FSYNC */ + +/* file_dentry() is available */ +/* #undef HAVE_FILE_DENTRY */ + +/* file_inode() is available */ +/* #undef HAVE_FILE_INODE */ + +/* iops->follow_link() cookie */ +/* #undef HAVE_FOLLOW_LINK_COOKIE */ + +/* iops->follow_link() nameidata */ +/* #undef HAVE_FOLLOW_LINK_NAMEIDATA */ + +/* fops->fsync() with range */ +/* #undef HAVE_FSYNC_RANGE */ + +/* fops->fsync() without dentry */ +/* #undef HAVE_FSYNC_WITHOUT_DENTRY */ + +/* generic_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + +/* generic_*_io_acct() 3 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_3ARG */ + +/* generic_*_io_acct() 4 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_4ARG */ + +/* generic_readlink is global */ +/* #undef HAVE_GENERIC_READLINK */ + +/* generic_setxattr() exists */ +/* #undef HAVE_GENERIC_SETXATTR */ + +/* generic_write_checks() takes kiocb */ +/* #undef HAVE_GENERIC_WRITE_CHECKS_KIOCB */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* iops->get_link() cookie */ +/* #undef HAVE_GET_LINK_COOKIE */ + +/* iops->get_link() delayed */ +/* #undef HAVE_GET_LINK_DELAYED */ + +/* group_info->gid exists */ +/* #undef HAVE_GROUP_INFO_GID */ + +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* yes */ +/* #undef HAVE_INODE_LOCK_SHARED */ + +/* inode_owner_or_capable() exists */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE */ + +/* inode_owner_or_capable() takes user_ns */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED */ + +/* inode_set_flags() exists */ +/* #undef HAVE_INODE_SET_FLAGS */ + +/* inode_set_iversion() exists */ +/* #undef HAVE_INODE_SET_IVERSION */ + +/* inode->i_*time's are timespec64 */ +/* #undef HAVE_INODE_TIMESPEC64_TIMES */ + +/* timestamp_truncate() exists */ +/* #undef HAVE_INODE_TIMESTAMP_TRUNCATE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* in_compat_syscall() is available */ +/* #undef HAVE_IN_COMPAT_SYSCALL */ + +/* iops->create() takes struct user_namespace* */ +/* #undef HAVE_IOPS_CREATE_USERNS */ + +/* iops->mkdir() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKDIR_USERNS */ + +/* iops->mknod() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKNOD_USERNS */ + +/* iops->rename() takes struct user_namespace* */ +/* #undef HAVE_IOPS_RENAME_USERNS */ + +/* iops->symlink() takes struct user_namespace* */ +/* #undef HAVE_IOPS_SYMLINK_USERNS */ + +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + +/* yes */ +/* #undef HAVE_IO_SCHEDULE_TIMEOUT */ + +/* Define to 1 if you have the `issetugid' function. */ +#define HAVE_ISSETUGID 1 + +/* kernel has kernel_fpu_* functions */ +/* #undef HAVE_KERNEL_FPU */ + +/* kernel has asm/fpu/api.h */ +/* #undef HAVE_KERNEL_FPU_API_HEADER */ + +/* kernel fpu internal */ +/* #undef HAVE_KERNEL_FPU_INTERNAL */ + +/* uncached_acl_sentinel() exists */ +/* #undef HAVE_KERNEL_GET_ACL_HANDLE_CACHE */ + +/* kernel does stack verification */ +/* #undef HAVE_KERNEL_OBJTOOL */ + +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + +/* kernel_read() take loff_t pointer */ +/* #undef HAVE_KERNEL_READ_PPOS */ + +/* timer_list.function gets a timer_list */ +/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */ + +/* struct timer_list has a flags member */ +/* #undef HAVE_KERNEL_TIMER_LIST_FLAGS */ + +/* timer_setup() is available */ +/* #undef HAVE_KERNEL_TIMER_SETUP */ + +/* kernel_write() take loff_t pointer */ +/* #undef HAVE_KERNEL_WRITE_PPOS */ + +/* kmem_cache_create_usercopy() exists */ +/* #undef HAVE_KMEM_CACHE_CREATE_USERCOPY */ + +/* kstrtoul() exists */ +/* #undef HAVE_KSTRTOUL */ + +/* ktime_get_coarse_real_ts64() exists */ +/* #undef HAVE_KTIME_GET_COARSE_REAL_TS64 */ + +/* ktime_get_raw_ts64() exists */ +/* #undef HAVE_KTIME_GET_RAW_TS64 */ + +/* kvmalloc exists */ +/* #undef HAVE_KVMALLOC */ + +/* Define if you have [aio] */ +/* #undef HAVE_LIBAIO */ + +/* Define if you have [blkid] */ +/* #undef HAVE_LIBBLKID */ + +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have [tirpc] */ +/* #undef HAVE_LIBTIRPC */ + +/* Define if you have [udev] */ +/* #undef HAVE_LIBUDEV */ + +/* Define if you have [uuid] */ +/* #undef HAVE_LIBUUID */ + +/* lseek_execute() is available */ +/* #undef HAVE_LSEEK_EXECUTE */ + +/* makedev() is declared in sys/mkdev.h */ +/* #undef HAVE_MAKEDEV_IN_MKDEV */ + +/* makedev() is declared in sys/sysmacros.h */ +/* #undef HAVE_MAKEDEV_IN_SYSMACROS */ + +/* Noting that make_request_fn() returns blk_qc_t */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_QC */ + +/* Noting that make_request_fn() returns void */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_VOID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* iops->mkdir() takes umode_t */ +/* #undef HAVE_MKDIR_UMODE_T */ + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + +/* Define if host toolchain supports MOVBE */ +#define HAVE_MOVBE 1 + +/* new_sync_read()/new_sync_write() are available */ +/* #undef HAVE_NEW_SYNC_READ */ + +/* iops->getattr() takes a path */ +/* #undef HAVE_PATH_IOPS_GETATTR */ + +/* Define if host toolchain supports PCLMULQDQ */ +#define HAVE_PCLMULQDQ 1 + +/* percpu_counter_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + +/* posix_acl_chmod() exists */ +/* #undef HAVE_POSIX_ACL_CHMOD */ + +/* posix_acl_from_xattr() needs user_ns */ +/* #undef HAVE_POSIX_ACL_FROM_XATTR_USERNS */ + +/* posix_acl_release() is available */ +/* #undef HAVE_POSIX_ACL_RELEASE */ + +/* posix_acl_release() is GPL-only */ +/* #undef HAVE_POSIX_ACL_RELEASE_GPL_ONLY */ + +/* posix_acl_valid() wants user namespace */ +/* #undef HAVE_POSIX_ACL_VALID_WITH_NS */ + +/* proc_ops structure exists */ +/* #undef HAVE_PROC_OPS_STRUCT */ + +/* iops->put_link() cookie */ +/* #undef HAVE_PUT_LINK_COOKIE */ + +/* iops->put_link() delayed */ +/* #undef HAVE_PUT_LINK_DELAYED */ + +/* iops->put_link() nameidata */ +/* #undef HAVE_PUT_LINK_NAMEIDATA */ + +/* If available, contains the Python version number currently in use. */ +#define HAVE_PYTHON "3.7" + +/* qat is enabled and existed */ +/* #undef HAVE_QAT */ + +/* iops->rename() wants flags */ +/* #undef HAVE_RENAME_WANTS_FLAGS */ + +/* REQ_DISCARD is defined */ +/* #undef HAVE_REQ_DISCARD */ + +/* REQ_FLUSH is defined */ +/* #undef HAVE_REQ_FLUSH */ + +/* REQ_OP_DISCARD is defined */ +/* #undef HAVE_REQ_OP_DISCARD */ + +/* REQ_OP_FLUSH is defined */ +/* #undef HAVE_REQ_OP_FLUSH */ + +/* REQ_OP_SECURE_ERASE is defined */ +/* #undef HAVE_REQ_OP_SECURE_ERASE */ + +/* REQ_PREFLUSH is defined */ +/* #undef HAVE_REQ_PREFLUSH */ + +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + +/* struct rw_semaphore has member activity */ +/* #undef HAVE_RWSEM_ACTIVITY */ + +/* struct rw_semaphore has atomic_long_t member count */ +/* #undef HAVE_RWSEM_ATOMIC_LONG_COUNT */ + +/* linux/sched/signal.h exists */ +/* #undef HAVE_SCHED_SIGNAL_HEADER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* setattr_prepare() is available, doesn't accept user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_NO_USERNS */ + +/* setattr_prepare() accepts user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_USERNS */ + +/* iops->set_acl() exists, takes 3 args */ +/* #undef HAVE_SET_ACL */ + +/* iops->set_acl() takes 4 args */ +/* #undef HAVE_SET_ACL_USERNS */ + +/* set_cached_acl() is usable */ +/* #undef HAVE_SET_CACHED_ACL_USABLE */ + +/* set_special_state() exists */ +/* #undef HAVE_SET_SPECIAL_STATE */ + +/* struct shrink_control exists */ +/* #undef HAVE_SHRINK_CONTROL_STRUCT */ + +/* kernel_siginfo_t exists */ +/* #undef HAVE_SIGINFO */ + +/* signal_stop() exists */ +/* #undef HAVE_SIGNAL_STOP */ + +/* new shrinker callback wants 2 args */ +/* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ + +/* ->count_objects exists */ +/* #undef HAVE_SPLIT_SHRINKER_CALLBACK */ + +#if defined(__amd64__) || defined(__i386__) +/* Define if host toolchain supports SSE */ +#define HAVE_SSE 1 + +/* Define if host toolchain supports SSE2 */ +#define HAVE_SSE2 1 + +/* Define if host toolchain supports SSE3 */ +#define HAVE_SSE3 1 + +/* Define if host toolchain supports SSE4.1 */ +#define HAVE_SSE4_1 1 + +/* Define if host toolchain supports SSE4.2 */ +#define HAVE_SSE4_2 1 + +/* Define if host toolchain supports SSSE3 */ +#define HAVE_SSSE3 1 +#endif + +/* STACK_FRAME_NON_STANDARD is defined */ +/* #undef HAVE_STACK_FRAME_NON_STANDARD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + +/* super_setup_bdi_name() exits */ +/* #undef HAVE_SUPER_SETUP_BDI_NAME */ + +/* super_block->s_user_ns exists */ +/* #undef HAVE_SUPER_USER_NS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* i_op->tmpfile() exists */ +/* #undef HAVE_TMPFILE */ + +/* i_op->tmpfile() has userns */ +/* #undef HAVE_TMPFILE_USERNS */ + +/* totalhigh_pages() exists */ +/* #undef HAVE_TOTALHIGH_PAGES */ + +/* kernel has totalram_pages() */ +/* #undef HAVE_TOTALRAM_PAGES_FUNC */ + +/* Define to 1 if you have the `udev_device_get_is_initialized' function. */ +/* #undef HAVE_UDEV_DEVICE_GET_IS_INITIALIZED */ + +/* kernel has __kernel_fpu_* functions */ +/* #undef HAVE_UNDERSCORE_KERNEL_FPU */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* iops->getattr() takes struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_GETATTR */ + +/* iops->getattr() takes a vfsmount */ +/* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ + +/* aops->direct_IO() uses iovec */ +/* #undef HAVE_VFS_DIRECT_IO_IOVEC */ + +/* aops->direct_IO() uses iov_iter without rw */ +/* #undef HAVE_VFS_DIRECT_IO_ITER */ + +/* aops->direct_IO() uses iov_iter with offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_OFFSET */ + +/* aops->direct_IO() uses iov_iter with rw and offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET */ + +/* All required iov_iter interfaces are available */ +/* #undef HAVE_VFS_IOV_ITER */ + +/* fops->iterate() is available */ +/* #undef HAVE_VFS_ITERATE */ + +/* fops->iterate_shared() is available */ +/* #undef HAVE_VFS_ITERATE_SHARED */ + +/* fops->readdir() is available */ +/* #undef HAVE_VFS_READDIR */ + +/* fops->read/write_iter() are available */ +/* #undef HAVE_VFS_RW_ITERATE */ + +/* __set_page_dirty_nobuffers exists */ +/* #undef HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS */ + +/* __vmalloc page flags exists */ +/* #undef HAVE_VMALLOC_PAGE_KERNEL */ + +/* yes */ +/* #undef HAVE_WAIT_ON_BIT_ACTION */ + +/* wait_queue_entry_t exists */ +/* #undef HAVE_WAIT_QUEUE_ENTRY_T */ + +/* wq_head->head and wq_entry->entry exist */ +/* #undef HAVE_WAIT_QUEUE_HEAD_ENTRY */ + +/* xattr_handler->get() wants dentry */ +/* #undef HAVE_XATTR_GET_DENTRY */ + +/* xattr_handler->get() wants both dentry and inode */ +/* #undef HAVE_XATTR_GET_DENTRY_INODE */ + +/* xattr_handler->get() wants xattr_handler */ +/* #undef HAVE_XATTR_GET_HANDLER */ + +/* xattr_handler has name */ +/* #undef HAVE_XATTR_HANDLER_NAME */ + +/* xattr_handler->list() wants dentry */ +/* #undef HAVE_XATTR_LIST_DENTRY */ + +/* xattr_handler->list() wants xattr_handler */ +/* #undef HAVE_XATTR_LIST_HANDLER */ + +/* xattr_handler->list() wants simple */ +/* #undef HAVE_XATTR_LIST_SIMPLE */ + +/* xattr_handler->set() wants dentry */ +/* #undef HAVE_XATTR_SET_DENTRY */ + +/* xattr_handler->set() wants both dentry and inode */ +/* #undef HAVE_XATTR_SET_DENTRY_INODE */ + +/* xattr_handler->set() wants xattr_handler */ +/* #undef HAVE_XATTR_SET_HANDLER */ + +/* xattr_handler->set() takes user_namespace */ +/* #undef HAVE_XATTR_SET_USERNS */ + +/* Define if you have [z] */ +#define HAVE_ZLIB 1 + +/* __posix_acl_chmod() exists */ +/* #undef HAVE___POSIX_ACL_CHMOD */ + +/* kernel exports FPU functions */ +/* #undef KERNEL_EXPORTS_X86_FPU */ + +/* TBD: fetch(3) support */ +#if 0 +/* whether the chosen libfetch is to be loaded at run-time */ +#define LIBFETCH_DYNAMIC 1 + +/* libfetch is fetch(3) */ +#define LIBFETCH_IS_FETCH 1 + +/* libfetch is libcurl */ +#define LIBFETCH_IS_LIBCURL 0 + +/* soname of chosen libfetch */ +#define LIBFETCH_SONAME "libfetch.so.6" +#endif + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* make_request_fn() return type */ +/* #undef MAKE_REQUEST_FN_RET */ + +/* hardened module_param_call */ +/* #undef MODULE_PARAM_CALL_CONST */ + +/* struct shrink_control has nid */ +/* #undef SHRINK_CONTROL_HAS_NID */ + +/* Defined for legacy compatibility. */ +#define SPL_META_ALIAS ZFS_META_ALIAS + +/* Defined for legacy compatibility. */ +#define SPL_META_RELEASE ZFS_META_RELEASE + +/* Defined for legacy compatibility. */ +#define SPL_META_VERSION ZFS_META_VERSION + +/* True if ZFS is to be compiled for a FreeBSD system */ +#define SYSTEM_FREEBSD 1 + +/* True if ZFS is to be compiled for a Linux system */ +/* #undef SYSTEM_LINUX */ + +/* zfs debugging enabled */ +/* #undef ZFS_DEBUG */ + +/* /dev/zfs minor */ +/* #undef ZFS_DEVICE_MINOR */ + +/* enum node_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum node_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum node_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* enum zone_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum zone_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum zone_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* global_node_page_state() exists */ +/* #undef ZFS_GLOBAL_NODE_PAGE_STATE */ + +/* global_zone_page_state() exists */ +/* #undef ZFS_GLOBAL_ZONE_PAGE_STATE */ + +/* Define to 1 if GPL-only symbols can be used */ +/* #undef ZFS_IS_GPL_COMPATIBLE */ + +/* Define the project alias string. */ - #define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_gf3678d70f" ++#define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_g8ae86e2ed" + +/* Define the project author. */ +#define ZFS_META_AUTHOR "OpenZFS" + +/* Define the project release date. */ +/* #undef ZFS_META_DATA */ + +/* Define the maximum compatible kernel version. */ +#define ZFS_META_KVER_MAX "5.13" + +/* Define the minimum compatible kernel version. */ +#define ZFS_META_KVER_MIN "3.10" + +/* Define the project license. */ +#define ZFS_META_LICENSE "CDDL" + +/* Define the libtool library 'age' version information. */ +/* #undef ZFS_META_LT_AGE */ + +/* Define the libtool library 'current' version information. */ +/* #undef ZFS_META_LT_CURRENT */ + +/* Define the libtool library 'revision' version information. */ +/* #undef ZFS_META_LT_REVISION */ + +/* Define the project name. */ +#define ZFS_META_NAME "zfs" + +/* Define the project release. */ - #define ZFS_META_RELEASE "FreeBSD_gf3678d70f" ++#define ZFS_META_RELEASE "FreeBSD_g8ae86e2ed" + +/* Define the project version. */ +#define ZFS_META_VERSION "2.1.99" + +/* count is located in percpu_ref.data */ +/* #undef ZFS_PERCPU_REF_COUNT_IN_DATA */ + diff --cc sys/modules/zfs/zfs_gitrev.h index fc9656910a1f,000000000000..264add9028dd mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_gitrev.h +++ b/sys/modules/zfs/zfs_gitrev.h @@@ -1,5 -1,0 +1,5 @@@ +/* + * $FreeBSD$ + */ + - #define ZFS_META_GITREV "zfs-2.1.99-404-gf3678d70f" ++#define ZFS_META_GITREV "zfs-2.1.99-419-g8ae86e2ed" From owner-dev-commits-src-main@freebsd.org Tue Aug 17 19:26:07 2021 Return-Path: Delivered-To: dev-commits-src-main@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 538A666A317; Tue, 17 Aug 2021 19:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq1Gl1Wrzz3my8; Tue, 17 Aug 2021 19:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 183A92327D; Tue, 17 Aug 2021 19:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HJQ6oG030774; Tue, 17 Aug 2021 19:26:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HJQ6E5030773; Tue, 17 Aug 2021 19:26:06 GMT (envelope-from git) Date: Tue, 17 Aug 2021 19:26:06 GMT Message-Id: <202108171926.17HJQ6E5030773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: 4b7bf8424892 - main - bootstrap-tools: Don't copy host tools with make -n MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b7bf84248920fbafa5cbe2f7d3389c5eca4ef1d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 19:26:07 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=4b7bf84248920fbafa5cbe2f7d3389c5eca4ef1d commit 4b7bf84248920fbafa5cbe2f7d3389c5eca4ef1d Author: Bryan Drewery AuthorDate: 2021-08-17 19:25:44 +0000 Commit: Bryan Drewery CommitDate: 2021-08-17 19:26:03 +0000 bootstrap-tools: Don't copy host tools with make -n --- Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 9209f0ef053c..eb69d660cede 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2475,7 +2475,7 @@ _bootstrap_tools_links+=${_links:S/,/ /g} ${_bt}-links: .PHONY .for _tool in ${_bootstrap_tools_links} -${_bt}-link-${_tool}: .PHONY .MAKE +${_bt}-link-${_tool}: .PHONY @rm -f "${WORLDTMP}/legacy/bin/${_tool}"; \ source_path=`which ${_tool}`; \ if [ ! -e "$${source_path}" ] ; then \ From owner-dev-commits-src-main@freebsd.org Tue Aug 17 19:42:20 2021 Return-Path: Delivered-To: dev-commits-src-main@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 92EB666A33B for ; Tue, 17 Aug 2021 19:42:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4Gq1dS3RgLz3qKm for ; Tue, 17 Aug 2021 19:42:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id o123so43581qkf.12 for ; Tue, 17 Aug 2021 12:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IAudOLDIzRDLtfu3nGIeG39VRrfz3SUySS5e9Z8w4SA=; b=JRjPO8Gr6X3JqauKwMAfdcbfHUAisBCVJkFAZ907fzubmP5zzn6ixUNdC+YLz79gdj ngD2nBv1h3PtxEdLDxdnKenPSGkC7iNiKR5FKmvFRRXqD7t1RftfStZru5yCb5G5A3mc VQdOgoXzcn2ePEqEDbTmJxiVVmic/Xq37TRAX4tSz/uF6cRy+pBa06oFVc/LSreQEgeu KlgEnHiWY/g9ur/4Bz6F4k4NCNapMo0UW3f70dViQZG0hguf/bcFrXB4JhubXWRgFUMm 3nOHzYW0d0A6t4MGe6cxx7MkmhEw4SfYHjaDaUP2/7MHteUwFG8uVx0ctIefVB7HbpOd O9/Q== 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=IAudOLDIzRDLtfu3nGIeG39VRrfz3SUySS5e9Z8w4SA=; b=VpDwMH/4oXTDEkYewmeX/ozvudeHs8VZuSSlrRFFqwQTQXGvxA8uQ17Dh7yleL1I0s CPxhvikhh6iJ0JDlPVOJNuCoep6HMVlOe9+2IpViFDW+mWzfrIAg9062cIQKK0iitof2 UnOO7UIE8Trm0+OxBWzVoi0wETu/EaZjqtereULl5PMfeM+tuKW599O8vynWOcqp6adJ TIDR+RCdDMcHkxtnQ54AHN+8Ykd2lqaz6AWEXeQKdVGuNXV/YTGRkjOc/2Kwp7h14K3Z fk0orhkkZuabjz5DzSIUYFw4LWGLFqg0KBHmpYI3Q+nBREOgB67jc2qDN0NJwx44SsDc AUPA== X-Gm-Message-State: AOAM5300TX0qFMVLW5T3nz97yE1usYxAnF6iuTxkV8t/X9ZS5GXYIPzb L9pKOiAivjcbTBeFM0cdVxXE1ZFCcPN8CeMJI0gYMA== X-Google-Smtp-Source: ABdhPJy2WjT/t3VAYxPlNew2izorXcBNjMjoS/MAFqJPJtpz4JOlXQ078mOG8yfMWNcEo5OgIWt2xnCN+EgJynmS2EU= X-Received: by 2002:ae9:e30c:: with SMTP id v12mr5282474qkf.206.1629229339977; Tue, 17 Aug 2021 12:42:19 -0700 (PDT) MIME-Version: 1.0 References: <202108171645.17HGjNL3012769@gitrepo.freebsd.org> <4C25E4D8-D33E-4397-956E-D21B80239EBA@freebsd.org> In-Reply-To: <4C25E4D8-D33E-4397-956E-D21B80239EBA@freebsd.org> From: Warner Losh Date: Tue, 17 Aug 2021 13:42:09 -0600 Message-ID: Subject: Re: git: d9f25575a29f - main - Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now To: Jessica Clarke Cc: Alex Richardson , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4Gq1dS3RgLz3qKm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 19:42:20 -0000 On Tue, Aug 17, 2021 at 11:00 AM Jessica Clarke wrote: > On 17 Aug 2021, at 17:45, Alex Richardson wrote: > > > > The branch main has been updated by arichardson: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=d9f25575a29ff7c83f226349a10a37b9aaf75ad5 > > > > commit d9f25575a29ff7c83f226349a10a37b9aaf75ad5 > > Author: Alex Richardson > > AuthorDate: 2021-08-17 16:44:40 +0000 > > Commit: Alex Richardson > > CommitDate: 2021-08-17 16:44:52 +0000 > > > > Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for > now > > > > I enabled these options again in > 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3, > > but unfortunately only my specific build configuration worked whereas > the > > build with default options is still broken. > > Insta-MFC to fix stable/13 cross-builds? > I'd say it falls into the build-breakage exception that's we've been doing for the past few years. Warner From owner-dev-commits-src-main@freebsd.org Tue Aug 17 19:48:40 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5E7EC66A885; Tue, 17 Aug 2021 19:48:40 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq1mm1khTz3ql4; Tue, 17 Aug 2021 19:48:40 +0000 (UTC) (envelope-from gjb@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1629229720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1VGxnZ6827QXg3jEG8+D024qtyGl1qKR54XO6G7Rh7w=; b=GXTGf4bRuZWvzwbpmUyX++RytxyC8BBnm19Hf43eS7Xq6CbXEAWBwHKMBHdY9jUg5epIbT bHNrpjIpS7tBXjw71jBdTMLLpsSsj1Mk3/DxNmBAyG+l2EwTydzyf2tUObfHDybbvYUfUA 47Q2gEdpG9MD2jtQG1Jfp/c/2w2gy6YCGog8vknCaMuyaqvyFI7LQaCowQb5+Ygx3YLjCB 1M1RxI1cQLnhfDYN++2X94PaDoL8wxCLRvOUfi65+XKPp3/fdRaupKyhHOzgJ9bfA7NL53 kEoK5Vi/GMv05vAt9b/6JKmVgIh9/l1UFv5A1c5zSZ+xy+SFvgUe1/X4S0b/Gw== Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id B49DAC9B2; Tue, 17 Aug 2021 19:48:39 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Tue, 17 Aug 2021 19:48:37 +0000 From: Glen Barber To: Warner Losh Cc: Jessica Clarke , Alex Richardson , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: d9f25575a29f - main - Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now Message-ID: <20210817194837.GH5802@FreeBSD.org> References: <202108171645.17HGjNL3012769@gitrepo.freebsd.org> <4C25E4D8-D33E-4397-956E-D21B80239EBA@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TA4f0niHM6tHt3xR" Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1629229720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1VGxnZ6827QXg3jEG8+D024qtyGl1qKR54XO6G7Rh7w=; b=c4eRwgiGKKkGMbZ5W5iLwl3LFay3uJs/H1AhZybu12vmv9OLpLmvtns1Gqc2MIar4UIuTL s2QMADXyAViOOAgtDCaqh3Dkvx9ewkCzktqHTfg7fHVrt3fHS0TY4TWp1vD33kJ62J3WsT ESipSm28L0MXApb3CZXTEOy3N9qfRrXQU2qvCdf1wmYrNEmD4G2YR0E2G1PLWQgf3W8kRo nP5BzxXN+hBsgcZjhN86r7z2QIkY52pMa2efA6reFpqKL4oz1VsmP3eN6CZR2v/r3yEWfp 5SbNtol+m524i2mcaNtwZOCk188FMM2z4+yeF+IuFkxj6tiSc2tQDgIcSwXuWg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1629229720; a=rsa-sha256; cv=none; b=Pk4XvP+6kZrIv6utBekzwGI/AudP9IWzKRjN/mJ8pql71XiRmXQmIN/ndLdIUDlbcCQL/q XOTtMvyU/mV8l5BT6D9XdjDg2Qkh2vtwNKWVOVhhoH9wu0eic8wJeWW/fGSGa5cBH4nbtH inqlTjM0ZR8CC0ScF39vxi4ylztIhMmPu1aIxSFyRRr465Bcckk3WVHozNzPdAH8DSBI7V yqVe0P0HmAHC8X+BKKmext/khvoQTEsLpXj+8fFsTPXspN6obUaDOcuFwTztAbqq0qVAMA xHtxMTRU6toQ0s+b6L7YnHY4zDQltEryQ3GLOQ8hmvZvyM4UgwT8q9v/zTm43g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 19:48:40 -0000 --TA4f0niHM6tHt3xR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 17, 2021 at 01:42:09PM -0600, Warner Losh wrote: > On Tue, Aug 17, 2021 at 11:00 AM Jessica Clarke wrot= e: >=20 > > On 17 Aug 2021, at 17:45, Alex Richardson wro= te: > > > > > > The branch main has been updated by arichardson: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3Dd9f25575a29ff7c83f226349a10a3= 7b9aaf75ad5 > > > > > > commit d9f25575a29ff7c83f226349a10a37b9aaf75ad5 > > > Author: Alex Richardson > > > AuthorDate: 2021-08-17 16:44:40 +0000 > > > Commit: Alex Richardson > > > CommitDate: 2021-08-17 16:44:52 +0000 > > > > > > Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD f= or > > now > > > > > > I enabled these options again in > > 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3, > > > but unfortunately only my specific build configuration worked wher= eas > > the > > > build with default options is still broken. > > > > Insta-MFC to fix stable/13 cross-builds? > > >=20 > I'd say it falls into the build-breakage exception that's we've been doing > for the past few years. >=20 Agreed. Glen --TA4f0niHM6tHt3xR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAmEcEo4ACgkQAxRYpUeP 4pOVWQ/+MCftaxivyuKTTQ3nQeaM7CVZoO5yMhCh0pAYfoRSom3SKne3JhpErhPe 49MsKrVxINqaa37CgbOnay8Ag5kuwOuBDVC2Ys+JaIzqYmaDmJ/JvXApbRsUdSzT iK99Fw2L2tJUGHKVj3fnspZrkrO2lToezzVeEPdyQp2zcmRYfpumj5y+uhwhtsu/ uLoNCEN50yM5AblhULqtcqgjj6p4lyd9N3yxzXLGfSzEi/cy/meyGHLkd9hFCAbP UpQlEj+nL4j/+eM3YDfwwihzP3dFwijaaaeHta4XQ4MGIJidCHoCEH73CLP/5RKb FLhpfWC58LKSUKMLHbxhhRcE+3zFFHaVU0yYY59Cw50W1qBPWaXttnmkOpfOTSQe HzgmgvH7ombddoU98VhBFg8Ub8o6z0f0BE80V8LssEsUP5AfMKwa55dv0fwVIJZZ ugttmcZtGrZ+GEMpfaKKGX/EA34Kwgp7NGzMRB10LbYO770wtLR23E6SlMaP0MsG IloyLhTxro9e+w181sapERrCphacyaCz603JH+X2TXBhRFcsHWQmRAJQWwH/RlVy 07zn/peuwWkVko4PzpXqpOkxGIzb8HEiTg23PnvH1jC22fXFoxMWPOcEc7RCVssu QiOfQb6veqxLmIVZ2hSf3dRwzGPofGppqKKGmVxXw2aUlcofi2Q= =xjZX -----END PGP SIGNATURE----- --TA4f0niHM6tHt3xR-- From owner-dev-commits-src-main@freebsd.org Tue Aug 17 19:59:01 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EA56366A367; Tue, 17 Aug 2021 19:59:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq20j5ftqz3r0l; Tue, 17 Aug 2021 19:59:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6AB923738; Tue, 17 Aug 2021 19:59:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HJx1M8069833; Tue, 17 Aug 2021 19:59:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HJx16Z069832; Tue, 17 Aug 2021 19:59:01 GMT (envelope-from git) Date: Tue, 17 Aug 2021 19:59:01 GMT Message-Id: <202108171959.17HJx16Z069832@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: e0a17c3f063f - main - uipc: create dedicated lists for fast and slow timeout callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0a17c3f063fd51430fb2b4f5bc667f79d2967c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 19:59:02 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e0a17c3f063fd51430fb2b4f5bc667f79d2967c2 commit e0a17c3f063fd51430fb2b4f5bc667f79d2967c2 Author: Mateusz Guzik AuthorDate: 2021-08-15 21:41:47 +0000 Commit: Mateusz Guzik CommitDate: 2021-08-17 19:56:05 +0000 uipc: create dedicated lists for fast and slow timeout callbacks This avoids having to walk all possible protocols only to check if they have one (vast majority does not). Original patch by kevans@. Reviewed by: kevans Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/kern/uipc_domain.c | 59 +++++++++++++++++++++++++++++++++++--------------- sys/sys/protosw.h | 4 ++++ 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index b6aefec9556a..0946a2a75326 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -76,6 +77,14 @@ static struct callout pfslow_callout; static void pffasttimo(void *); static void pfslowtimo(void *); +static struct rmlock pftimo_lock; +RM_SYSINIT(pftimo_lock, &pftimo_lock, "pftimo"); + +static LIST_HEAD(, protosw) pffast_list = + LIST_HEAD_INITIALIZER(pffast_list); +static LIST_HEAD(, protosw) pfslow_list = + LIST_HEAD_INITIALIZER(pfslow_list); + struct domain *domains; /* registered protocol domains */ int domain_init_status = 0; static struct mtx dom_mtx; /* domain list lock */ @@ -183,8 +192,16 @@ domain_init(void *arg) ("Premature initialization of domain in non-default vnet")); if (dp->dom_init) (*dp->dom_init)(); - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { protosw_init(pr); + rm_wlock(&pftimo_lock); + if (pr->pr_fasttimo != NULL) + LIST_INSERT_HEAD(&pffast_list, pr, pr_fasttimos); + if (pr->pr_slowtimo != NULL) + LIST_INSERT_HEAD(&pfslow_list, pr, pr_slowtimos); + rm_wunlock(&pftimo_lock); + } + /* * update global information about maximums */ @@ -387,6 +404,13 @@ pf_proto_register(int family, struct protosw *npr) /* Copy the new struct protosw over the spacer. */ bcopy(npr, fpr, sizeof(*fpr)); + rm_wlock(&pftimo_lock); + if (fpr->pr_fasttimo != NULL) + LIST_INSERT_HEAD(&pffast_list, fpr, pr_fasttimos); + if (fpr->pr_slowtimo != NULL) + LIST_INSERT_HEAD(&pfslow_list, fpr, pr_slowtimos); + rm_wunlock(&pftimo_lock); + /* Job is done, no more protection required. */ mtx_unlock(&dom_mtx); @@ -447,6 +471,13 @@ pf_proto_unregister(int family, int protocol, int type) return (EPROTONOSUPPORT); } + rm_wlock(&pftimo_lock); + if (dpr->pr_fasttimo != NULL) + LIST_REMOVE(dpr, pr_fasttimos); + if (dpr->pr_slowtimo != NULL) + LIST_REMOVE(dpr, pr_slowtimos); + rm_wunlock(&pftimo_lock); + /* De-orbit the protocol and make the slot available again. */ dpr->pr_type = 0; dpr->pr_domain = dp; @@ -483,39 +514,33 @@ pfctlinput(int cmd, struct sockaddr *sa) static void pfslowtimo(void *arg) { + struct rm_priotracker tracker; struct epoch_tracker et; - struct domain *dp; struct protosw *pr; + rm_rlock(&pftimo_lock, &tracker); NET_EPOCH_ENTER(et); - for (dp = domains; dp; dp = dp->dom_next) { - if ((atomic_load_int(&dp->dom_flags) & DOMF_INITED) == 0) - continue; - atomic_thread_fence_acq(); - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_slowtimo) - (*pr->pr_slowtimo)(); + LIST_FOREACH(pr, &pfslow_list, pr_slowtimos) { + (*pr->pr_slowtimo)(); } NET_EPOCH_EXIT(et); + rm_runlock(&pftimo_lock, &tracker); callout_reset(&pfslow_callout, hz/2, pfslowtimo, NULL); } static void pffasttimo(void *arg) { + struct rm_priotracker tracker; struct epoch_tracker et; - struct domain *dp; struct protosw *pr; + rm_rlock(&pftimo_lock, &tracker); NET_EPOCH_ENTER(et); - for (dp = domains; dp; dp = dp->dom_next) { - if ((atomic_load_int(&dp->dom_flags) & DOMF_INITED) == 0) - continue; - atomic_thread_fence_acq(); - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_fasttimo) - (*pr->pr_fasttimo)(); + LIST_FOREACH(pr, &pffast_list, pr_fasttimos) { + (*pr->pr_fasttimo)(); } NET_EPOCH_EXIT(et); + rm_runlock(&pftimo_lock, &tracker); callout_reset(&pffast_callout, hz/5, pffasttimo, NULL); } diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index 5c2fa2d4077e..a929544501f4 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -35,6 +35,8 @@ #ifndef _SYS_PROTOSW_H_ #define _SYS_PROTOSW_H_ +#include + /* Forward declare these structures referenced from prototypes below. */ struct kaiocb; struct mbuf; @@ -93,6 +95,8 @@ struct protosw { pr_drain_t *pr_drain; /* flush any excess space possible */ struct pr_usrreqs *pr_usrreqs; /* user-protocol hook */ + LIST_ENTRY(protosw) pr_fasttimos; + LIST_ENTRY(protosw) pr_slowtimos; }; /*#endif*/ From owner-dev-commits-src-main@freebsd.org Tue Aug 17 19:59:03 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1A35F66A376; Tue, 17 Aug 2021 19:59:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq20k6RRXz3qxP; Tue, 17 Aug 2021 19:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE1E0239ED; Tue, 17 Aug 2021 19:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HJx2qb069857; Tue, 17 Aug 2021 19:59:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HJx2lL069856; Tue, 17 Aug 2021 19:59:02 GMT (envelope-from git) Date: Tue, 17 Aug 2021 19:59:02 GMT Message-Id: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 5091ca26507b - main - pf: save on branching in the common case in pf_test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5091ca26507b83ebd5ce677dd26bd10e4bad4153 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 19:59:03 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=5091ca26507b83ebd5ce677dd26bd10e4bad4153 commit 5091ca26507b83ebd5ce677dd26bd10e4bad4153 Author: Mateusz Guzik AuthorDate: 2021-08-17 18:04:31 +0000 Commit: Mateusz Guzik CommitDate: 2021-08-17 19:56:33 +0000 pf: save on branching in the common case in pf_test Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index e2dd3eb7c0de..add76c7b98d4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6151,7 +6151,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * PF_RULES_RLOCK(); - if (ip_divert_ptr != NULL && + if (__predict_false(ip_divert_ptr != NULL) && ((ipfwtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL)) != NULL)) { struct ipfw_rule_ref *rr = (struct ipfw_rule_ref *)(ipfwtag+1); if (rr->info & IPFW_IS_DIVERT && rr->rulenum == 0) { @@ -6419,8 +6419,8 @@ done: IN_LOOPBACK(ntohl(pd.dst->v4.s_addr))) m->m_flags |= M_SKIP_FIREWALL; - if (action == PF_PASS && r->divert.port && ip_divert_ptr != NULL && - !PACKET_LOOPED(&pd)) { + if (__predict_false(ip_divert_ptr != NULL) && action == PF_PASS && + r->divert.port && !PACKET_LOOPED(&pd)) { ipfwtag = m_tag_alloc(MTAG_IPFW_RULE, 0, sizeof(struct ipfw_rule_ref), M_NOWAIT | M_ZERO); if (ipfwtag != NULL) { From owner-dev-commits-src-main@freebsd.org Tue Aug 17 19:59:04 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6908466A8C8; Tue, 17 Aug 2021 19:59:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq20m0hQwz3qxV; Tue, 17 Aug 2021 19:59:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E84A023D10; Tue, 17 Aug 2021 19:59:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HJx3fJ069888; Tue, 17 Aug 2021 19:59:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HJx38g069887; Tue, 17 Aug 2021 19:59:03 GMT (envelope-from git) Date: Tue, 17 Aug 2021 19:59:03 GMT Message-Id: <202108171959.17HJx38g069887@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 3e875f952af0 - main - pf: assert dir state on pf_test{,6} MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e875f952af05697807139b460e5124eb5f6137b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 19:59:04 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3e875f952af05697807139b460e5124eb5f6137b commit 3e875f952af05697807139b460e5124eb5f6137b Author: Mateusz Guzik AuthorDate: 2021-08-17 18:16:09 +0000 Commit: Mateusz Guzik CommitDate: 2021-08-17 19:56:50 +0000 pf: assert dir state on pf_test{,6} The intent is to line up various enums so that branching in the lines of: idx = (dir == PF_IN ? PF_SK_WIRE : PF_SK_STACK); is avoided. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index add76c7b98d4..66c11a450030 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6126,7 +6126,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * int off, dirndx, pqid = 0; PF_RULES_RLOCK_TRACKER; - + KASSERT(dir == PF_IN || dir == PF_OUT, ("%s: bad direction %d\n", __func__, dir)); M_ASSERTPKTHDR(m); if (!V_pf_status.running) @@ -6575,6 +6575,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; PF_RULES_RLOCK_TRACKER; + KASSERT(dir == PF_IN || dir == PF_OUT, ("%s: bad direction %d\n", __func__, dir)); M_ASSERTPKTHDR(m); if (!V_pf_status.running) From owner-dev-commits-src-main@freebsd.org Tue Aug 17 20:30:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2493766B23D; Tue, 17 Aug 2021 20:30:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq2jF6ZqGz3t6g; Tue, 17 Aug 2021 20:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAC2023F6F; Tue, 17 Aug 2021 20:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HKUfrC018681; Tue, 17 Aug 2021 20:30:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HKUf9L018680; Tue, 17 Aug 2021 20:30:41 GMT (envelope-from git) Date: Tue, 17 Aug 2021 20:30:41 GMT Message-Id: <202108172030.17HKUf9L018680@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 5baf32c97a1d - main - tcp: Add support for DSACK based reordering window to rack. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5baf32c97a1ded3398efd0677ea9b73204629b2f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 20:30:42 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=5baf32c97a1ded3398efd0677ea9b73204629b2f commit 5baf32c97a1ded3398efd0677ea9b73204629b2f Author: Randall Stewart AuthorDate: 2021-08-17 20:29:22 +0000 Commit: Randall Stewart CommitDate: 2021-08-17 20:29:22 +0000 tcp: Add support for DSACK based reordering window to rack. The rack stack, with respect to the rack bits in it, was originally built based on an early I-D of rack. In fact at that time the TLP bits were in a separate I-D. The dynamic reordering window based on DSACK events was not present in rack at that time. It is now part of the RFC and we need to update our stack to include these features. However we want to have a way to control the feature so that we can, if the admin decides, make it stay the same way system wide as well as via socket option. The new sysctl and socket option has the following meaning for setting: 00 (0) - Keep the old way, i.e. reordering window is 1 and do not use DSACK bytes to add to reorder window 01 (1) - Change the Reordering window to 1/4 of an RTT but do not use DSACK bytes to add to reorder window 10 (2) - Keep the reordering window as 1, but do use SACK bytes to add additional 1/4 RTT delay to the reorder window 11 (3) - reordering window is 1/4 of an RTT and add additional DSACK bytes to increase the reordering window (RFC behavior) The default currently in the sysctl is 3 so we get standards based behavior. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31506 --- sys/netinet/tcp.h | 1 + sys/netinet/tcp_log_buf.h | 3 +- sys/netinet/tcp_stacks/rack.c | 596 ++++++++++++++++++++++++++++++++------ sys/netinet/tcp_stacks/tcp_rack.h | 21 +- 4 files changed, 529 insertions(+), 92 deletions(-) diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index a79dbeaad748..29c1e376c8de 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -309,6 +309,7 @@ struct tcphdr { #define TCP_RACK_PACING_BETA 1138 /* Changing the beta for pacing */ #define TCP_RACK_PACING_BETA_ECN 1139 /* Changing the beta for ecn with pacing */ #define TCP_RACK_TIMER_SLOP 1140 /* Set or get the timer slop used */ +#define TCP_RACK_DSACK_OPT 1141 /* How do we setup rack timer DSACK options bit 1/2 */ /* Start of reserved space for third-party user-settable options. */ #define TCP_VENDOR SO_VENDOR diff --git a/sys/netinet/tcp_log_buf.h b/sys/netinet/tcp_log_buf.h index 47993660cb1f..2203fd061213 100644 --- a/sys/netinet/tcp_log_buf.h +++ b/sys/netinet/tcp_log_buf.h @@ -234,7 +234,8 @@ enum tcp_log_events { TCP_LOG_HTTP_T, /* logging of http request tracking 61 */ TCP_LOG_ACCOUNTING, /* Log of TCP Accounting data 62 */ TCP_LOG_FSB, /* FSB information 63 */ - TCP_LOG_END /* End (keep at end) 64 */ + RACK_DSACK_HANDLING, /* Handling of DSACK in rack for reordering window 64 */ + TCP_LOG_END /* End (keep at end) 65 */ }; enum tcp_log_states { diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index f417f8a4ee7f..947f9f619929 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -217,6 +217,7 @@ static int32_t rack_use_rfo = 1; static int32_t rack_use_rsm_rfo = 1; static int32_t rack_max_abc_post_recovery = 2; static int32_t rack_client_low_buf = 0; +static int32_t rack_dsack_std_based = 0x3; /* bit field bit 1 sets rc_rack_tmr_std_based and bit 2 sets rc_rack_use_dsack */ #ifdef TCP_ACCOUNTING static int32_t rack_tcp_accounting = 0; #endif @@ -1375,6 +1376,12 @@ rack_init_sysctls(void) &rack_tcp_accounting, 0, "Should we turn on TCP accounting for all rack sessions?"); #endif + + SYSCTL_ADD_S32(&rack_sysctl_ctx, + SYSCTL_CHILDREN(rack_misc), + OID_AUTO, "rack_dsack_ctl", CTLFLAG_RW, + &rack_dsack_std_based, 3, + "How do we process dsack with respect to rack timers, bit field, 3 is standards based?"); SYSCTL_ADD_S32(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_misc), OID_AUTO, "prr_addback_max", CTLFLAG_RW, @@ -2071,6 +2078,44 @@ configured_rate: return (rack->r_ctl.rack_per_of_gp_ca); } +static void +rack_log_dsack_event(struct tcp_rack *rack, uint8_t mod, uint32_t flex4, uint32_t flex5, uint32_t flex6) +{ + /* + * Types of logs (mod value) + * 1 = dsack_persists reduced by 1 via T-O or fast recovery exit. + * 2 = a dsack round begins, persist is reset to 16. + * 3 = a dsack round ends + * 4 = Dsack option increases rack rtt flex5 is the srtt input, flex6 is thresh + * 5 = Socket option set changing the control flags rc_rack_tmr_std_based, rc_rack_use_dsack + * 6 = Final rack rtt, flex4 is srtt and flex6 is final limited thresh. + */ + if (rack->rc_tp->t_logstate != TCP_LOG_STATE_OFF) { + union tcp_log_stackspecific log; + struct timeval tv; + + memset(&log, 0, sizeof(log)); + log.u_bbr.flex1 = rack->rc_rack_tmr_std_based; + log.u_bbr.flex1 <<= 1; + log.u_bbr.flex1 |= rack->rc_rack_use_dsack; + log.u_bbr.flex1 <<= 1; + log.u_bbr.flex1 |= rack->rc_dsack_round_seen; + log.u_bbr.flex2 = rack->r_ctl.dsack_round_end; + log.u_bbr.flex3 = rack->r_ctl.num_dsack; + log.u_bbr.flex4 = flex4; + log.u_bbr.flex5 = flex5; + log.u_bbr.flex6 = flex6; + log.u_bbr.flex7 = rack->r_ctl.dsack_persist; + log.u_bbr.flex8 = mod; + log.u_bbr.timeStamp = tcp_get_usecs(&tv); + TCP_LOG_EVENTP(rack->rc_tp, NULL, + &rack->rc_inp->inp_socket->so_rcv, + &rack->rc_inp->inp_socket->so_snd, + RACK_DSACK_HANDLING, 0, + 0, &log, false, &tv); + } +} + static void rack_log_hdwr_pacing(struct tcp_rack *rack, uint64_t rate, uint64_t hw_rate, int line, @@ -4862,6 +4907,13 @@ rack_post_recovery(struct tcpcb *tp, uint32_t th_ack) } rack_log_to_prr(rack, 14, orig_cwnd); tp->snd_recover = tp->snd_una; + if (rack->r_ctl.dsack_persist) { + rack->r_ctl.dsack_persist--; + if (rack->r_ctl.num_dsack && (rack->r_ctl.dsack_persist == 0)) { + rack->r_ctl.num_dsack = 0; + } + rack_log_dsack_event(rack, 1, __LINE__, 0, 0); + } EXIT_RECOVERY(tp->t_flags); } @@ -5097,24 +5149,38 @@ rack_calc_thresh_rack(struct tcp_rack *rack, uint32_t srtt, uint32_t cts) } else { lro = 0; } - thresh = srtt + rack->r_ctl.rc_pkt_delay; - if (lro) { + if (rack->rc_rack_tmr_std_based == 0) { + thresh = srtt + rack->r_ctl.rc_pkt_delay; + } else { + /* Standards based pkt-delay is 1/4 srtt */ + thresh = srtt + (srtt >> 2); + } + if (lro && (rack->rc_rack_tmr_std_based == 0)) { /* It must be set, if not you get 1/4 rtt */ if (rack->r_ctl.rc_reorder_shift) thresh += (srtt >> rack->r_ctl.rc_reorder_shift); else thresh += (srtt >> 2); - } else { - thresh += 1; } - /* We don't let the rack timeout be above a RTO */ - if (thresh > rack->rc_tp->t_rxtcur) { - thresh = rack->rc_tp->t_rxtcur; + if (rack->rc_rack_use_dsack && + lro && + (rack->r_ctl.num_dsack > 0)) { + /* + * We only increase the reordering window if we + * have seen reordering we have a DSACK count. + */ + thresh += rack->r_ctl.num_dsack * (srtt >> 2); + rack_log_dsack_event(rack, 4, __LINE__, srtt, thresh); + } + /* SRTT * 2 is the ceiling */ + if (thresh > (srtt * 2)) { + thresh = srtt * 2; } /* And we don't want it above the RTO max either */ if (thresh > rack_rto_max) { thresh = rack_rto_max; } + rack_log_dsack_event(rack, 6, __LINE__, srtt, thresh); return (thresh); } @@ -6219,6 +6285,13 @@ rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t collapsed_win = 1; goto need_retran; } + if (rack->r_ctl.dsack_persist && (rack->r_ctl.rc_tlp_cnt_out >= 1)) { + rack->r_ctl.dsack_persist--; + if (rack->r_ctl.num_dsack && (rack->r_ctl.dsack_persist == 0)) { + rack->r_ctl.num_dsack = 0; + } + rack_log_dsack_event(rack, 1, __LINE__, 0, 0); + } if ((tp->t_flags & TF_GPUTINPROG) && (rack->r_ctl.rc_tlp_cnt_out == 1)) { /* @@ -6349,7 +6422,6 @@ need_retran: TAILQ_INSERT_AFTER(&rack->r_ctl.rc_tmap, rsm, nrsm, r_tnext); nrsm->r_in_tmap = 1; } - rsm->r_flags &= (~RACK_HAS_FIN); rsm = nrsm; } rack->r_ctl.rc_tlpsend = rsm; @@ -6755,6 +6827,13 @@ rack_timeout_rxt(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) /* Nothing outstanding .. nothing to do */ return (0); } + if (rack->r_ctl.dsack_persist) { + rack->r_ctl.dsack_persist--; + if (rack->r_ctl.num_dsack && (rack->r_ctl.dsack_persist == 0)) { + rack->r_ctl.num_dsack = 0; + } + rack_log_dsack_event(rack, 1, __LINE__, 0, 0); + } /* * Rack can only run one timer at a time, so we cannot * run a KEEPINIT (gating SYN sending) and a retransmit @@ -8218,6 +8297,22 @@ rack_need_set_test(struct tcpcb *tp, } } +static inline int +is_rsm_inside_declared_tlp_block(struct tcp_rack *rack, struct rack_sendmap *rsm) +{ + if (SEQ_LT(rsm->r_end, rack->r_ctl.last_tlp_acked_start)) { + /* Behind our TLP definition or right at */ + return (0); + } + if (SEQ_GT(rsm->r_start, rack->r_ctl.last_tlp_acked_end)) { + /* The start is beyond or right at our end of TLP definition */ + return (0); + } + /* It has to be a sub-part of the original TLP recorded */ + return (1); +} + + static uint32_t rack_proc_sack_blk(struct tcpcb *tp, struct tcp_rack *rack, struct sackblk *sack, struct tcpopt *to, struct rack_sendmap **prsm, uint32_t cts, int *moved_two) @@ -8253,6 +8348,46 @@ do_rest_ofb: /* Ok we have an ACK for some piece of this rsm */ if (rsm->r_start != start) { if ((rsm->r_flags & RACK_ACKED) == 0) { + /* + * Before any splitting or hookery is + * done is it a TLP of interest i.e. rxt? + */ + if ((rsm->r_flags & RACK_TLP) && + (rsm->r_rtr_cnt > 1)) { + /* + * We are splitting a rxt TLP, check + * if we need to save off the start/end + */ + if (rack->rc_last_tlp_acked_set && + (is_rsm_inside_declared_tlp_block(rack, rsm))) { + /* + * We already turned this on since we are inside + * the previous one was a partially sack now we + * are getting another one (maybe all of it). + * + */ + rack_log_dsack_event(rack, 10, __LINE__, rsm->r_start, rsm->r_end); + /* + * Lets make sure we have all of it though. + */ + if (SEQ_LT(rsm->r_start, rack->r_ctl.last_tlp_acked_start)) { + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + if (SEQ_GT(rsm->r_end, rack->r_ctl.last_tlp_acked_end)) { + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + } else { + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack->rc_last_tlp_past_cumack = 0; + rack->rc_last_tlp_acked_set = 1; + rack_log_dsack_event(rack, 8, __LINE__, rsm->r_start, rsm->r_end); + } + } /** * Need to split this in two pieces the before and after, * the before remains in the map, the after must be @@ -8267,6 +8402,7 @@ do_rest_ofb: * But before we start down that path lets * see if the sack spans over on top of * the next guy and it is already sacked. + * */ next = RB_NEXT(rack_rb_tree_head, &rack->r_ctl.rc_mtree, rsm); if (next && (next->r_flags & RACK_ACKED) && @@ -8426,6 +8562,44 @@ do_rest_ofb: * end |---------| */ if ((rsm->r_flags & RACK_ACKED) == 0) { + /* + * Is it a TLP of interest? + */ + if ((rsm->r_flags & RACK_TLP) && + (rsm->r_rtr_cnt > 1)) { + /* + * We are splitting a rxt TLP, check + * if we need to save off the start/end + */ + if (rack->rc_last_tlp_acked_set && + (is_rsm_inside_declared_tlp_block(rack, rsm))) { + /* + * We already turned this on since we are inside + * the previous one was a partially sack now we + * are getting another one (maybe all of it). + */ + rack_log_dsack_event(rack, 10, __LINE__, rsm->r_start, rsm->r_end); + /* + * Lets make sure we have all of it though. + */ + if (SEQ_LT(rsm->r_start, rack->r_ctl.last_tlp_acked_start)) { + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + if (SEQ_GT(rsm->r_end, rack->r_ctl.last_tlp_acked_end)) { + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + } else { + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack->rc_last_tlp_past_cumack = 0; + rack->rc_last_tlp_acked_set = 1; + rack_log_dsack_event(rack, 8, __LINE__, rsm->r_start, rsm->r_end); + } + } rack_update_rtt(tp, rack, rsm, to, cts, SACKED, 0); changed += (rsm->r_end - rsm->r_start); rack->r_ctl.rc_sacked += (rsm->r_end - rsm->r_start); @@ -8441,7 +8615,6 @@ do_rest_ofb: rack_need_set_test(tp, rack, rsm, tp->snd_una, __LINE__, RACK_USE_END); rsm->r_ack_arrival = rack_to_usec_ts(&rack->r_ctl.act_rcv_time); rsm->r_flags |= RACK_ACKED; - rsm->r_flags &= ~RACK_TLP; if (rsm->r_in_tmap) { TAILQ_REMOVE(&rack->r_ctl.rc_tmap, rsm, r_tnext); rsm->r_in_tmap = 0; @@ -8473,8 +8646,47 @@ do_rest_ofb: * end |--| */ if ((rsm->r_flags & RACK_ACKED) == 0) { + /* + * Is it a TLP of interest? + */ + if ((rsm->r_flags & RACK_TLP) && + (rsm->r_rtr_cnt > 1)) { + /* + * We are splitting a rxt TLP, check + * if we need to save off the start/end + */ + if (rack->rc_last_tlp_acked_set && + (is_rsm_inside_declared_tlp_block(rack, rsm))) { + /* + * We already turned this on since we are inside + * the previous one was a partially sack now we + * are getting another one (maybe all of it). + */ + rack_log_dsack_event(rack, 10, __LINE__, rsm->r_start, rsm->r_end); + /* + * Lets make sure we have all of it though. + */ + if (SEQ_LT(rsm->r_start, rack->r_ctl.last_tlp_acked_start)) { + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + if (SEQ_GT(rsm->r_end, rack->r_ctl.last_tlp_acked_end)) { + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + } else { + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack->rc_last_tlp_past_cumack = 0; + rack->rc_last_tlp_acked_set = 1; + rack_log_dsack_event(rack, 8, __LINE__, rsm->r_start, rsm->r_end); + } + } prev = RB_PREV(rack_rb_tree_head, &rack->r_ctl.rc_mtree, rsm); - if (prev && (prev->r_flags & RACK_ACKED)) { + if (prev && + (prev->r_flags & RACK_ACKED)) { /** * Goal, we want the right remainder of rsm to shrink * in place and span from (rsm->r_start = end) to rsm->r_end. @@ -8488,6 +8700,9 @@ do_rest_ofb: * prev |----------| (acked) * rsm |-----| (non-acked) * nrsm |-| (temporary) + * + * Note if either prev/rsm is a TLP we don't + * do this. */ nrsm = &stack_map; memcpy(nrsm, rsm, sizeof(struct rack_sendmap)); @@ -8534,6 +8749,41 @@ do_rest_ofb: /* failed rrs what can we do but loose the sack info? */ goto out; } + if ((rsm->r_flags & RACK_TLP) && + (rsm->r_rtr_cnt > 1)) { + /* + * We are splitting a rxt TLP, check + * if we need to save off the start/end + */ + if (rack->rc_last_tlp_acked_set && + (is_rsm_inside_declared_tlp_block(rack, rsm))) { + /* + * We already turned this on since this block is inside + * the previous one was a partially sack now we + * are getting another one (maybe all of it). + */ + rack_log_dsack_event(rack, 10, __LINE__, rsm->r_start, rsm->r_end); + /* + * Lets make sure we have all of it though. + */ + if (SEQ_LT(rsm->r_start, rack->r_ctl.last_tlp_acked_start)) { + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + if (SEQ_GT(rsm->r_end, rack->r_ctl.last_tlp_acked_end)) { + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + } else { + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack->rc_last_tlp_acked_set = 1; + rack->rc_last_tlp_past_cumack = 0; + rack_log_dsack_event(rack, 8, __LINE__, rsm->r_start, rsm->r_end); + } + } /** * In this case nrsm becomes * nrsm->r_start = end; @@ -8584,7 +8834,6 @@ do_rest_ofb: rack_need_set_test(tp, rack, rsm, tp->snd_una, __LINE__, RACK_USE_END); rsm->r_ack_arrival = rack_to_usec_ts(&rack->r_ctl.act_rcv_time); rsm->r_flags |= RACK_ACKED; - rsm->r_flags &= ~RACK_TLP; rack_log_map_chg(tp, rack, NULL, rsm, nrsm, MAP_SACK_M5, end, __LINE__); if (rsm->r_in_tmap) { TAILQ_REMOVE(&rack->r_ctl.rc_tmap, rsm, r_tnext); @@ -8599,7 +8848,9 @@ do_rest_ofb: moved++; } out: - if (rsm && (rsm->r_flags & RACK_ACKED)) { + if (rsm && + ((rsm->r_flags & RACK_TLP) == 0) && + (rsm->r_flags & RACK_ACKED)) { /* * Now can we merge where we worked * with either the previous or @@ -8607,22 +8858,26 @@ out: */ next = RB_NEXT(rack_rb_tree_head, &rack->r_ctl.rc_mtree, rsm); while (next) { - if (next->r_flags & RACK_ACKED) { + if (next->r_flags & RACK_TLP) + break; + if (next->r_flags & RACK_ACKED) { /* yep this and next can be merged */ - rsm = rack_merge_rsm(rack, rsm, next); - next = RB_NEXT(rack_rb_tree_head, &rack->r_ctl.rc_mtree, rsm); - } else - break; + rsm = rack_merge_rsm(rack, rsm, next); + next = RB_NEXT(rack_rb_tree_head, &rack->r_ctl.rc_mtree, rsm); + } else + break; } /* Now what about the previous? */ prev = RB_PREV(rack_rb_tree_head, &rack->r_ctl.rc_mtree, rsm); while (prev) { - if (prev->r_flags & RACK_ACKED) { - /* yep the previous and this can be merged */ - rsm = rack_merge_rsm(rack, prev, rsm); - prev = RB_PREV(rack_rb_tree_head, &rack->r_ctl.rc_mtree, rsm); - } else - break; + if (prev->r_flags & RACK_TLP) + break; + if (prev->r_flags & RACK_ACKED) { + /* yep the previous and this can be merged */ + rsm = rack_merge_rsm(rack, prev, rsm); + prev = RB_PREV(rack_rb_tree_head, &rack->r_ctl.rc_mtree, rsm); + } else + break; } } if (used_ref == 0) { @@ -8744,6 +8999,55 @@ rack_process_to_cumack(struct tcpcb *tp, struct tcp_rack *rack, register uint32_ * RTT's. */ rack->r_wanted_output = 1; + + /* Tend any TLP that has been marked for 1/2 the seq space (its old) */ + if ((rack->rc_last_tlp_acked_set == 1)&& + (rack->rc_last_tlp_past_cumack == 1) && + (SEQ_GT(rack->r_ctl.last_tlp_acked_start, th_ack))) { + /* + * We have reached the point where our last rack + * tlp retransmit sequence is ahead of the cum-ack. + * This can only happen when the cum-ack moves all + * the way around (its been a full 2^^31+1 bytes + * or more since we sent a retransmitted TLP). Lets + * turn off the valid flag since its not really valid. + * + * Note since sack's also turn on this event we have + * a complication, we have to wait to age it out until + * the cum-ack is by the TLP before checking which is + * what the next else clause does. + */ + rack_log_dsack_event(rack, 9, __LINE__, + rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + rack->rc_last_tlp_acked_set = 0; + rack->rc_last_tlp_past_cumack = 0; + } else if ((rack->rc_last_tlp_acked_set == 1) && + (rack->rc_last_tlp_past_cumack == 0) && + (SEQ_GEQ(th_ack, rack->r_ctl.last_tlp_acked_end))) { + /* + * It is safe to start aging TLP's out. + */ + rack->rc_last_tlp_past_cumack = 1; + } + /* We do the same for the tlp send seq as well */ + if ((rack->rc_last_sent_tlp_seq_valid == 1) && + (rack->rc_last_sent_tlp_past_cumack == 1) && + (SEQ_GT(rack->r_ctl.last_sent_tlp_seq, th_ack))) { + rack_log_dsack_event(rack, 9, __LINE__, + rack->r_ctl.last_sent_tlp_seq, + (rack->r_ctl.last_sent_tlp_seq + + rack->r_ctl.last_sent_tlp_len)); + rack->rc_last_sent_tlp_seq_valid = 0; + rack->rc_last_sent_tlp_past_cumack = 0; + } else if ((rack->rc_last_sent_tlp_seq_valid == 1) && + (rack->rc_last_sent_tlp_past_cumack == 0) && + (SEQ_GEQ(th_ack, rack->r_ctl.last_sent_tlp_seq))) { + /* + * It is safe to start aging TLP's send. + */ + rack->rc_last_sent_tlp_past_cumack = 1; + } more: rsm = RB_MIN(rack_rb_tree_head, &rack->r_ctl.rc_mtree); if (rsm == NULL) { @@ -8778,6 +9082,48 @@ more: return; } rack_update_rtt(tp, rack, rsm, to, cts, CUM_ACKED, th_ack); + + /* Now was it a retransmitted TLP? */ + if ((rsm->r_flags & RACK_TLP) && + (rsm->r_rtr_cnt > 1)) { + /* + * Yes, this rsm was a TLP and retransmitted, remember that + * since if a DSACK comes back on this we don't want + * to think of it as a reordered segment. This may + * get updated again with possibly even other TLPs + * in flight, but thats ok. Only when we don't send + * a retransmitted TLP for 1/2 the sequences space + * will it get turned off (above). + */ + if (rack->rc_last_tlp_acked_set && + (is_rsm_inside_declared_tlp_block(rack, rsm))) { + /* + * We already turned this on since the end matches, + * the previous one was a partially ack now we + * are getting another one (maybe all of it). + */ + rack_log_dsack_event(rack, 10, __LINE__, rsm->r_start, rsm->r_end); + /* + * Lets make sure we have all of it though. + */ + if (SEQ_LT(rsm->r_start, rack->r_ctl.last_tlp_acked_start)) { + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + if (SEQ_GT(rsm->r_end, rack->r_ctl.last_tlp_acked_end)) { + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack_log_dsack_event(rack, 11, __LINE__, rack->r_ctl.last_tlp_acked_start, + rack->r_ctl.last_tlp_acked_end); + } + } else { + rack->rc_last_tlp_past_cumack = 1; + rack->r_ctl.last_tlp_acked_start = rsm->r_start; + rack->r_ctl.last_tlp_acked_end = rsm->r_end; + rack->rc_last_tlp_acked_set = 1; + rack_log_dsack_event(rack, 8, __LINE__, rsm->r_start, rsm->r_end); + } + } /* Now do we consume the whole thing? */ if (SEQ_GEQ(th_ack, rsm->r_end)) { /* Its all consumed. */ @@ -9059,12 +9405,44 @@ static void rack_note_dsack(struct tcp_rack *rack, tcp_seq start, tcp_seq end) { - uint32_t am; + uint32_t am, l_end; if (SEQ_GT(end, start)) am = end - start; else am = 0; + if ((rack->rc_last_tlp_acked_set ) && + (SEQ_GEQ(start, rack->r_ctl.last_tlp_acked_start)) && + (SEQ_LEQ(end, rack->r_ctl.last_tlp_acked_end))) { + /* + * The DSACK is because of a TLP which we don't + * do anything with the reordering window over since + * it was not reordering that caused the DSACK but + * our previous retransmit TLP. + */ + rack_log_dsack_event(rack, 7, __LINE__, start, end); + goto skip_dsack_round; + } + if (rack->rc_last_sent_tlp_seq_valid) { + l_end = rack->r_ctl.last_sent_tlp_seq + rack->r_ctl.last_sent_tlp_len; + if (SEQ_GEQ(start, rack->r_ctl.last_sent_tlp_seq) && + (SEQ_LEQ(end, l_end))) { + /* + * This dsack is from the last sent TLP, ignore it + * for reordering purposes. + */ + rack_log_dsack_event(rack, 7, __LINE__, start, end); + goto skip_dsack_round; + } + } + if (rack->rc_dsack_round_seen == 0) { + rack->rc_dsack_round_seen = 1; + rack->r_ctl.dsack_round_end = rack->rc_tp->snd_max; + rack->r_ctl.num_dsack++; + rack->r_ctl.dsack_persist = 16; /* 16 is from the standard */ + rack_log_dsack_event(rack, 2, __LINE__, 0, 0); + } +skip_dsack_round: /* * We keep track of how many DSACK blocks we get * after a recovery incident. @@ -9233,9 +9611,9 @@ rack_log_ack(struct tcpcb *tp, struct tcpopt *to, struct tcphdr *th, int entered SEQ_LEQ(sack.end, tp->snd_max)) { sack_blocks[num_sack_blks] = sack; num_sack_blks++; -#ifdef NETFLIX_STATS } else if (SEQ_LEQ(sack.start, th_ack) && SEQ_LEQ(sack.end, th_ack)) { +#ifdef NETFLIX_STATS /* * Its a D-SACK block. */ @@ -9244,6 +9622,14 @@ rack_log_ack(struct tcpcb *tp, struct tcpopt *to, struct tcphdr *th, int entered rack_note_dsack(rack, sack.start, sack.end); } } + if (rack->rc_dsack_round_seen) { + /* Is the dsack roound over? */ + if (SEQ_GEQ(th_ack, rack->r_ctl.dsack_round_end)) { + /* Yes it is */ + rack->rc_dsack_round_seen = 0; + rack_log_dsack_event(rack, 3, __LINE__, 0, 0); + } + } /* * Sort the SACK blocks so we can update the rack scoreboard with * just one pass. @@ -9823,7 +10209,9 @@ rack_process_ack(struct mbuf *m, struct tcphdr *th, struct socket *so, RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), rack_rto_min, rack_rto_max, rack->r_ctl.timer_slop); } - if ((th->th_ack == tp->snd_una) && (tiwin == tp->snd_wnd)) { + if ((th->th_ack == tp->snd_una) && + (tiwin == tp->snd_wnd) && + ((to->to_flags & TOF_SACK) == 0)) { rack_strike_dupack(rack); dup_ack_struck = 1; } @@ -12043,9 +12431,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) #ifdef INET struct ip *ip = NULL; #endif -#if defined(INET) || defined(INET6) struct udphdr *udp = NULL; -#endif /* Ok lets fill in the fast block, it can only be used with no IP options! */ #ifdef INET6 @@ -12069,7 +12455,6 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) ip6, rack->r_ctl.fsb.th); } else #endif /* INET6 */ -#ifdef INET { rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct tcpiphdr); ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; @@ -12089,7 +12474,6 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) tp->t_port, ip, rack->r_ctl.fsb.th); } -#endif rack->r_fsb_inited = 1; } @@ -12245,6 +12629,14 @@ rack_init(struct tcpcb *tp) rack->r_ctl.rc_time_of_last_probertt = us_cts; rack->r_ctl.challenge_ack_ts = tcp_ts_getticks(); rack->r_ctl.rc_time_probertt_starts = 0; + if (rack_dsack_std_based & 0x1) { + /* Basically this means all rack timers are at least (srtt + 1/4 srtt) */ + rack->rc_rack_tmr_std_based = 1; + } + if (rack_dsack_std_based & 0x2) { + /* Basically this means rack timers are extended based on dsack by up to (2 * srtt) */ + rack->rc_rack_use_dsack = 1; + } /* We require at least one measurement, even if the sysctl is 0 */ if (rack_req_measurements) rack->r_ctl.req_measurements = rack_req_measurements; @@ -13122,7 +13514,6 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb } } else if (ae->ack_val_set == ACK_DUPACK) { /* Case D */ - rack_strike_dupack(rack); } else if (ae->ack_val_set == ACK_RWND) { /* Case C */ @@ -13172,6 +13563,14 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb rack->r_ctl.act_rcv_time = *tv; } rack_process_to_cumack(tp, rack, ae->ack, cts, to); + if (rack->rc_dsack_round_seen) { + /* Is the dsack roound over? */ + if (SEQ_GEQ(ae->ack, rack->r_ctl.dsack_round_end)) { + /* Yes it is */ + rack->rc_dsack_round_seen = 0; + rack_log_dsack_event(rack, 3, __LINE__, 0, 0); + } + } } } /* And lets be sure to commit the rtt measurements for this ack */ @@ -13609,13 +14008,6 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, * the scale is zero. */ tiwin = th->th_win << tp->snd_scale; - /* - * Parse options on any incoming segment. - */ - memset(&to, 0, sizeof(to)); - tcp_dooptions(&to, (u_char *)(th + 1), - (th->th_off << 2) - sizeof(struct tcphdr), - (thflags & TH_SYN) ? TO_SYN : 0); #ifdef TCP_ACCOUNTING if (thflags & TH_ACK) { /* @@ -13639,6 +14031,13 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, ctf_fixed_maxseg(tp)); } #endif + /* + * Parse options on any incoming segment. + */ + memset(&to, 0, sizeof(to)); + tcp_dooptions(&to, (u_char *)(th + 1), + (th->th_off << 2) - sizeof(struct tcphdr), + (thflags & TH_SYN) ? TO_SYN : 0); NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(tp->t_inpcb); KASSERT(tp->t_state > TCPS_LISTEN, ("%s: TCPS_LISTEN", @@ -13769,14 +14168,6 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, #endif return (1); } - - /* - * Parse options on any incoming segment. - */ - tcp_dooptions(&to, (u_char *)(th + 1), - (th->th_off << 2) - sizeof(struct tcphdr), - (thflags & TH_SYN) ? TO_SYN : 0); - /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop @@ -15230,7 +15621,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma struct tcpopt to; u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; - int32_t slot, segsiz, max_val, tso = 0, error = 0, flags, ulen = 0; + int32_t slot, segsiz, max_val, tso = 0, error, flags, ulen = 0; uint32_t us_cts; uint32_t if_hw_tsomaxsegcount = 0, startseq; uint32_t if_hw_tsomaxsegsize; @@ -15250,10 +15641,13 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma if (tp->t_port && (V_tcp_udp_tunneling_port == 0)) { goto failed; } - if (rsm->r_flags & RACK_TLP) - doing_tlp = 1; - else if (doing_tlp) + if (doing_tlp) { + /* Its a TLP add the flag, it may already be there but be sure */ rsm->r_flags |= RACK_TLP; + } else { + /* If it was a TLP it is not not on this retransmit */ + rsm->r_flags &= ~RACK_TLP; + } startseq = rsm->r_start; segsiz = min(ctf_fixed_maxseg(tp), rack->r_ctl.rc_pace_min_segs); inp = rack->rc_inp; @@ -15555,8 +15949,15 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma rack->rc_tlp_in_progress = 1; rack->r_ctl.rc_tlp_cnt_out++; } - if (error == 0) + if (error == 0) { tcp_account_for_send(tp, len, 1, doing_tlp, rsm->r_hw_tls); + if (doing_tlp) { + rack->rc_last_sent_tlp_past_cumack = 0; + rack->rc_last_sent_tlp_seq_valid = 1; + rack->r_ctl.last_sent_tlp_seq = rsm->r_start; + rack->r_ctl.last_sent_tlp_len = rsm->r_end - rsm->r_start; + } + } tp->t_flags &= ~(TF_ACKNOW | TF_DELACK); rack->forced_ack = 0; /* If we send something zap the FA flag */ if (IN_FASTRECOVERY(tp->t_flags) && rsm) @@ -15710,7 +16111,7 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val, u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; int cnt_thru = 1; - int32_t slot, segsiz, len, max_val, tso = 0, sb_offset, error = 0, flags, ulen = 0; + int32_t slot, segsiz, len, max_val, tso = 0, sb_offset, error, flags, ulen = 0; uint32_t us_cts, s_soff; uint32_t if_hw_tsomaxsegcount = 0, startseq; uint32_t if_hw_tsomaxsegsize; @@ -16123,9 +16524,9 @@ rack_output(struct tcpcb *tp) long tot_len_this_send = 0; #ifdef INET struct ip *ip = NULL; +#endif #ifdef TCPDEBUG struct ipovly *ipov = NULL; -#endif #endif struct udphdr *udp = NULL; struct tcp_rack *rack; @@ -16134,10 +16535,7 @@ rack_output(struct tcpcb *tp) uint8_t mark = 0; uint8_t wanted_cookie = 0; u_char opt[TCP_MAXOLEN]; - unsigned ipoptlen, optlen, hdrlen; -#if defined(INET) || defined(INET6) - unsigned ulen=0; -#endif + unsigned ipoptlen, optlen, hdrlen, ulen=0; uint32_t rack_seq; #if defined(IPSEC) || defined(IPSEC_SUPPORT) @@ -16420,7 +16818,6 @@ again: /* Retransmit timer */ rsm = rack->r_ctl.rc_resend; rack->r_ctl.rc_resend = NULL; - rsm->r_flags &= ~RACK_TLP; len = rsm->r_end - rsm->r_start; sack_rxmit = 1; sendalot = 0; @@ -16433,7 +16830,6 @@ again: len = segsiz; } else if ((rsm = tcp_rack_output(tp, rack, cts)) != NULL) { /* We have a retransmit that takes precedence */ - rsm->r_flags &= ~RACK_TLP; if ((!IN_FASTRECOVERY(tp->t_flags)) && ((tp->t_flags & TF_WASFRECOVERY) == 0)) { /* Enter recovery if not induced by a time-out */ @@ -16476,8 +16872,8 @@ again: * went off. */ rsm = rack->r_ctl.rc_tlpsend; + /* We are doing a TLP make sure the flag is preent */ rsm->r_flags |= RACK_TLP; - rack->r_ctl.rc_tlpsend = NULL; sack_rxmit = 1; tlen = rsm->r_end - rsm->r_start; @@ -17837,29 +18233,21 @@ send: #endif if ((ipoptlen == 0) && (rack->r_ctl.fsb.tcp_ip_hdr) && rack->r_fsb_inited) { #ifdef INET6 - if (isipv6) { + if (isipv6) ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr; - } else + else #endif /* INET6 */ - { -#ifdef INET ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; -#endif - } th = rack->r_ctl.fsb.th; udp = rack->r_ctl.fsb.udp; if (udp) { #ifdef INET6 - if (isipv6) { + if (isipv6) ulen = hdrlen + len - sizeof(struct ip6_hdr); - } else + else #endif /* INET6 */ - { -#ifdef INET ulen = hdrlen + len - sizeof(struct ip); - udp->uh_ulen = htons(ulen); -#endif - } + udp->uh_ulen = htons(ulen); } } else { #ifdef INET6 @@ -17878,7 +18266,6 @@ send: } else #endif /* INET6 */ { -#ifdef INET ip = mtod(m, struct ip *); #ifdef TCPDEBUG ipov = (struct ipovly *)ip; @@ -17893,7 +18280,6 @@ send: } else th = (struct tcphdr *)(ip + 1); tcpip_fillheaders(inp, tp->t_port, ip, th); -#endif /* INET */ } } /* @@ -17932,15 +18318,11 @@ send: if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && (sack_rxmit == 0)) { #ifdef INET6 - if (isipv6) { + if (isipv6) ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); - } else + else #endif - { -#ifdef INET ip->ip_tos |= IPTOS_ECN_ECT0; -#endif - } KMOD_TCPSTAT_INC(tcps_ecn_ect0); /* * Reply with proper ECN notifications. @@ -18045,9 +18427,7 @@ send: ip6 = mtod(m, struct ip6_hdr *); else #endif /* INET6 */ *** 176 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:12:03 2021 Return-Path: Delivered-To: dev-commits-src-main@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 ACE1A66B5D7; Tue, 17 Aug 2021 21:12:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq3cz4GNsz3wRt; Tue, 17 Aug 2021 21:12:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A5CA24AB9; Tue, 17 Aug 2021 21:12:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLC303076282; Tue, 17 Aug 2021 21:12:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLC3X3076281; Tue, 17 Aug 2021 21:12:03 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:12:03 GMT Message-Id: <202108172112.17HLC3X3076281@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 36e15b717eec - main - routing: Fix crashes with dpdk_lpm[46] algo. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36e15b717eec80047fe7442898b5752101f2fbca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:12:03 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=36e15b717eec80047fe7442898b5752101f2fbca commit 36e15b717eec80047fe7442898b5752101f2fbca Author: Alexander V. Chernikov AuthorDate: 2021-08-15 22:25:21 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-17 20:46:22 +0000 routing: Fix crashes with dpdk_lpm[46] algo. When a prefix gets deleted from the RIB, dpdk_lpm algo needs to know the nexthop of the "parent" prefix to update its internal state. The glue code, which utilises RIB as a backing route store, uses fib[46]_lookup_rt() for the prefix destination after its deletion to fetch the desired nexthop. This approach does not work when deleting less-specific prefixes with most-specific ones are still present. For example, if 10.0.0.0/24, 10.0.0.0/23 and 10.0.0.0/22 exist in RIB, deleting 10.0.0.0/23 would result in 10.0.0.0/24 being returned as a search result instead of 10.0.0.0/22. This, in turn, results in the failed datastructure update: part of the deleted /23 prefix will still contain the reference to an old nexthop. This leads to the use-after-free behaviour, ending with the eventual crashes. Fix the logic flaw by properly fetching the prefix "parent" via newly-created rt_get_inet[6]_parent() helpers. Differential Revision: https://reviews.freebsd.org/D31546 PR: 256882,256833 MFC after: 1 week --- sys/contrib/dpdk_rte_lpm/dpdk_lpm.c | 32 ++++---- sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c | 42 +++++----- sys/net/radix.c | 14 ++++ sys/net/radix.h | 1 + sys/net/route/route_ctl.h | 3 + sys/net/route/route_helpers.c | 150 +++++++++++++++++++++++++++++++++++ 6 files changed, 208 insertions(+), 34 deletions(-) diff --git a/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c b/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c index af145997c4d6..51cd134132f6 100644 --- a/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c +++ b/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c @@ -134,26 +134,27 @@ handle_default_change(struct dpdk_lpm_data *dd, struct rib_cmd_info *rc) } static void -get_parent_rule(struct dpdk_lpm_data *dd, struct in_addr addr, uint8_t *plen, uint32_t *nhop_idx) +get_parent_rule(struct dpdk_lpm_data *dd, struct in_addr addr, int plen, + uint8_t *pplen, uint32_t *nhop_idx) { - struct route_nhop_data rnd; struct rtentry *rt; - rt = fib4_lookup_rt(dd->fibnum, addr, 0, NHR_UNLOCKED, &rnd); + rt = rt_get_inet_parent(dd->fibnum, addr, plen); if (rt != NULL) { struct in_addr addr4; uint32_t scopeid; - int inet_plen; - rt_get_inet_prefix_plen(rt, &addr4, &inet_plen, &scopeid); - if (inet_plen > 0) { - *plen = inet_plen; - *nhop_idx = fib_get_nhop_idx(dd->fd, rnd.rnd_nhop); + int parent_plen; + + rt_get_inet_prefix_plen(rt, &addr4, &parent_plen, &scopeid); + if (parent_plen > 0) { + *pplen = parent_plen; + *nhop_idx = fib_get_nhop_idx(dd->fd, rt_get_raw_nhop(rt)); return; } } *nhop_idx = 0; - *plen = 0; + *pplen = 0; } static enum flm_op_result @@ -181,20 +182,23 @@ handle_gu_change(struct dpdk_lpm_data *dd, const struct rib_cmd_info *rc, } ret = rte_lpm_add(dd->lpm, ip, plen, nhidx); - FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u = %d", + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u -> %u ret: %d", (rc->rc_cmd == RTM_ADD) ? "ADD" : "UPDATE", - abuf, plen, nhidx, ret); + abuf, plen, + rc->rc_nh_old != NULL ? fib_get_nhop_idx(dd->fd, rc->rc_nh_old) : 0, + nhidx, ret); } else { /* * Need to lookup parent. Assume deletion happened already */ uint8_t parent_plen; uint32_t parent_nhop_idx; - get_parent_rule(dd, addr, &parent_plen, &parent_nhop_idx); + get_parent_rule(dd, addr, plen, &parent_plen, &parent_nhop_idx); ret = rte_lpm_delete(dd->lpm, ip, plen, parent_plen, parent_nhop_idx); - FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK: %s %s/%d nhop %u = %d", - "DEL", abuf, plen, nhidx, ret); + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK: %s %s/%d -> /%d nhop %u -> %u ret: %d", + "DEL", abuf, plen, parent_plen, fib_get_nhop_idx(dd->fd, rc->rc_nh_old), + parent_nhop_idx, ret); } if (ret != 0) { diff --git a/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c index 17d35c16346d..ec1a3228d42b 100644 --- a/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c +++ b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c @@ -165,30 +165,26 @@ handle_ll_change(struct dpdk_lpm6_data *dd, struct rib_cmd_info *rc, } static struct rte_lpm6_rule * -pack_parent_rule(struct dpdk_lpm6_data *dd, const struct in6_addr *addr6, - char *buffer) +pack_parent_rule(struct dpdk_lpm6_data *dd, const struct in6_addr *addr6, int plen, + int *pplen, uint32_t *pnhop_idx, char *buffer) { struct rte_lpm6_rule *lsp_rule = NULL; - struct route_nhop_data rnd; struct rtentry *rt; - int plen; - rt = fib6_lookup_rt(dd->fibnum, addr6, 0, NHR_UNLOCKED, &rnd); + *pnhop_idx = 0; + *pplen = 0; + + rt = rt_get_inet6_parent(dd->fibnum, addr6, plen); /* plen = 0 means default route and it's out of scope */ if (rt != NULL) { - uint32_t scopeid; + uint32_t nhop_idx, scopeid; struct in6_addr new_addr6; rt_get_inet6_prefix_plen(rt, &new_addr6, &plen, &scopeid); if (plen > 0) { - uint32_t nhidx = fib_get_nhop_idx(dd->fd, rnd.rnd_nhop); - if (nhidx == 0) { - /* - * shouldn't happen as we already have parent route. - * It will trigger rebuild automatically. - */ - return (NULL); - } - lsp_rule = fill_rule6(buffer, (uint8_t *)&new_addr6, plen, nhidx); + nhop_idx = fib_get_nhop_idx(dd->fd, rt_get_raw_nhop(rt)); + lsp_rule = fill_rule6(buffer, (uint8_t *)&new_addr6, plen, nhop_idx); + *pnhop_idx = nhop_idx; + *pplen = plen; } } @@ -217,20 +213,26 @@ handle_gu_change(struct dpdk_lpm6_data *dd, const struct rib_cmd_info *rc, ret = rte_lpm6_add(dd->lpm6, (const uint8_t *)addr6, plen, nhidx, (rc->rc_cmd == RTM_ADD) ? 1 : 0); - FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u = %d", + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u -> %u ret: %d", (rc->rc_cmd == RTM_ADD) ? "ADD" : "UPDATE", - abuf, plen, nhidx, ret); + abuf, plen, + rc->rc_nh_old != NULL ? fib_get_nhop_idx(dd->fd, rc->rc_nh_old) : 0, + nhidx, ret); } else { /* * Need to lookup parent. Assume deletion happened already */ char buffer[RTE_LPM6_RULE_SIZE]; struct rte_lpm6_rule *lsp_rule = NULL; - lsp_rule = pack_parent_rule(dd, addr6, buffer); + int parent_plen; + uint32_t parent_nhop_idx; + lsp_rule = pack_parent_rule(dd, addr6, plen, &parent_plen, + &parent_nhop_idx, buffer); ret = rte_lpm6_delete(dd->lpm6, (const uint8_t *)addr6, plen, lsp_rule); - FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop ? = %d", - "DEL", abuf, plen, ret); + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d -> /%d nhop %u -> %u ret: %d", + "DEL", abuf, plen, parent_plen, fib_get_nhop_idx(dd->fd, rc->rc_nh_old), + parent_nhop_idx, ret); } if (ret != 0) { diff --git a/sys/net/radix.c b/sys/net/radix.c index 931bf6db871b..2169361c7229 100644 --- a/sys/net/radix.c +++ b/sys/net/radix.c @@ -371,6 +371,20 @@ on1: return (0); } +/* + * Returns the next (wider) prefix for the key defined by @rn + * if exists. + */ +struct radix_node * +rn_nextprefix(struct radix_node *rn) +{ + for (rn = rn->rn_dupedkey; rn != NULL; rn = rn->rn_dupedkey) { + if (!(rn->rn_flags & RNF_ROOT)) + return (rn); + } + return (NULL); +} + #ifdef RN_DEBUG int rn_nodenum; struct radix_node *rn_clist; diff --git a/sys/net/radix.h b/sys/net/radix.h index a0e5e5c5aa3f..97555ee9e16d 100644 --- a/sys/net/radix.h +++ b/sys/net/radix.h @@ -119,6 +119,7 @@ typedef int rn_walktree_t(struct radix_head *head, walktree_f_t *f, typedef int rn_walktree_from_t(struct radix_head *head, void *a, void *m, walktree_f_t *f, void *w); typedef void rn_close_t(struct radix_node *rn, struct radix_head *head); +struct radix_node *rn_nextprefix(struct radix_node *rn); struct radix_mask_head; diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index 229c762d4a73..a670979df8c9 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -117,6 +117,7 @@ void rt_get_inet_prefix_plen(const struct rtentry *rt, struct in_addr *paddr, int *plen, uint32_t *pscopeid); void rt_get_inet_prefix_pmask(const struct rtentry *rt, struct in_addr *paddr, struct in_addr *pmask, uint32_t *pscopeid); +struct rtentry *rt_get_inet_parent(uint32_t fibnum, struct in_addr addr, int plen); #endif #ifdef INET6 struct in6_addr; @@ -124,6 +125,8 @@ void rt_get_inet6_prefix_plen(const struct rtentry *rt, struct in6_addr *paddr, int *plen, uint32_t *pscopeid); void rt_get_inet6_prefix_pmask(const struct rtentry *rt, struct in6_addr *paddr, struct in6_addr *pmask, uint32_t *pscopeid); +struct rtentry *rt_get_inet6_parent(uint32_t fibnum, const struct in6_addr *paddr, + int plen); #endif /* Nexthops */ diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c index 5d29197cc4fb..569e13a308eb 100644 --- a/sys/net/route/route_helpers.c +++ b/sys/net/route/route_helpers.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #endif #ifdef INET6 #include +#include #endif #include @@ -415,3 +416,152 @@ rib_decompose_notification(struct rib_cmd_info *rc, route_notification_t *cb, } } #endif + +#ifdef INET +/* + * Checks if the found key in the trie contains (<=) a prefix covering + * @paddr/@plen. + * Returns the most specific rtentry matching the condition or NULL. + */ +static struct rtentry * +get_inet_parent_prefix(uint32_t fibnum, struct in_addr addr, int plen) +{ + struct route_nhop_data rnd; + struct rtentry *rt; + struct in_addr addr4; + uint32_t scopeid; + int parent_plen; + struct radix_node *rn; + + rt = fib4_lookup_rt(fibnum, addr, 0, NHR_UNLOCKED, &rnd); + rt_get_inet_prefix_plen(rt, &addr4, &parent_plen, &scopeid); + if (parent_plen <= plen) + return (rt); + + /* + * There can be multiple prefixes associated with the found key: + * 10.0.0.0 -> 10.0.0.0/24, 10.0.0.0/23, 10.0.0.0/22, etc. + * All such prefixes are linked via rn_dupedkey, from most specific + * to least specific. Iterate over them to check if any of these + * prefixes are wider than desired plen. + */ + rn = (struct radix_node *)rt; + while ((rn = rn_nextprefix(rn)) != NULL) { + rt = RNTORT(rn); + rt_get_inet_prefix_plen(rt, &addr4, &parent_plen, &scopeid); + if (parent_plen <= plen) + return (rt); + } + + return (NULL); +} + +/* + * Returns the most specific prefix containing (>) @paddr/plen. + */ +struct rtentry * +rt_get_inet_parent(uint32_t fibnum, struct in_addr addr, int plen) +{ + struct in_addr lookup_addr = { .s_addr = INADDR_BROADCAST }; + struct in_addr addr4 = addr; + struct in_addr mask4; + struct rtentry *rt; + + while (plen-- > 0) { + /* Calculate wider mask & new key to lookup */ + mask4.s_addr = htonl(plen ? ~((1 << (32 - plen)) - 1) : 0); + addr4.s_addr = htonl(ntohl(addr4.s_addr) & ntohl(mask4.s_addr)); + if (addr4.s_addr == lookup_addr.s_addr) { + /* Skip lookup if the key is the same */ + continue; + } + lookup_addr = addr4; + + rt = get_inet_parent_prefix(fibnum, lookup_addr, plen); + if (rt != NULL) + return (rt); + } + + return (NULL); +} +#endif + +#ifdef INET6 +/* + * Checks if the found key in the trie contains (<=) a prefix covering + * @paddr/@plen. + * Returns the most specific rtentry matching the condition or NULL. + */ +static struct rtentry * +get_inet6_parent_prefix(uint32_t fibnum, const struct in6_addr *paddr, int plen) +{ + struct route_nhop_data rnd; + struct rtentry *rt; + struct in6_addr addr6; + uint32_t scopeid; + int parent_plen; + struct radix_node *rn; + + rt = fib6_lookup_rt(fibnum, paddr, 0, NHR_UNLOCKED, &rnd); + rt_get_inet6_prefix_plen(rt, &addr6, &parent_plen, &scopeid); + if (parent_plen <= plen) + return (rt); + + /* + * There can be multiple prefixes associated with the found key: + * 2001:db8:1::/64 -> 2001:db8:1::/56, 2001:db8:1::/48, etc. + * All such prefixes are linked via rn_dupedkey, from most specific + * to least specific. Iterate over them to check if any of these + * prefixes are wider than desired plen. + */ + rn = (struct radix_node *)rt; + while ((rn = rn_nextprefix(rn)) != NULL) { + rt = RNTORT(rn); + rt_get_inet6_prefix_plen(rt, &addr6, &parent_plen, &scopeid); + if (parent_plen <= plen) + return (rt); + } + + return (NULL); +} + +static void +ipv6_writemask(struct in6_addr *addr6, uint8_t mask) +{ + uint32_t *cp; + + for (cp = (uint32_t *)addr6; mask >= 32; mask -= 32) + *cp++ = 0xFFFFFFFF; + if (mask > 0) + *cp = htonl(mask ? ~((1 << (32 - mask)) - 1) : 0); +} + +/* + * Returns the most specific prefix containing (>) @paddr/plen. + */ +struct rtentry * +rt_get_inet6_parent(uint32_t fibnum, const struct in6_addr *paddr, int plen) +{ + struct in6_addr lookup_addr = in6mask128; + struct in6_addr addr6 = *paddr; + struct in6_addr mask6; + struct rtentry *rt; + + while (plen-- > 0) { + /* Calculate wider mask & new key to lookup */ + ipv6_writemask(&mask6, plen); + IN6_MASK_ADDR(&addr6, &mask6); + if (IN6_ARE_ADDR_EQUAL(&addr6, &lookup_addr)) { + /* Skip lookup if the key is the same */ + continue; + } + lookup_addr = addr6; + + rt = get_inet6_parent_prefix(fibnum, &lookup_addr, plen); + if (rt != NULL) + return (rt); + } + + return (NULL); +} +#endif From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:45:57 2021 Return-Path: Delivered-To: dev-commits-src-main@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 506D066C5FB; Tue, 17 Aug 2021 21:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4N447hgz4TqF; Tue, 17 Aug 2021 21:45:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52FA225517; Tue, 17 Aug 2021 21:45:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLju9c017721; Tue, 17 Aug 2021 21:45:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLjuvm017720; Tue, 17 Aug 2021 21:45:56 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:45:56 GMT Message-Id: <202108172145.17HLjuvm017720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 334d228a204c - main - OpenSSL: Correct the return value of BIO_get_ktls_*(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 334d228a204c16d1384a978ab9b209e4e7e33275 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:45:57 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=334d228a204c16d1384a978ab9b209e4e7e33275 commit 334d228a204c16d1384a978ab9b209e4e7e33275 Author: John Baldwin AuthorDate: 2021-08-17 21:37:47 +0000 Commit: John Baldwin CommitDate: 2021-08-17 21:41:12 +0000 OpenSSL: Correct the return value of BIO_get_ktls_*(). BIO_get_ktls_send() and BIO_get_ktls_recv() are documented as returning either 0 or 1. However, they were actually returning the internal value of the associated BIO flag for the true case instead of 1. Also trim redundant ternary operators. Reviewed by: jkim Obtained from: OpenSSL (f16e52b67c9261bdc7e1284a50502a802921ac6d) MFC after: 5 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31438 --- crypto/openssl/crypto/bio/bss_conn.c | 6 +++--- crypto/openssl/crypto/bio/bss_fd.c | 2 +- crypto/openssl/crypto/bio/bss_sock.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crypto/openssl/crypto/bio/bss_conn.c b/crypto/openssl/crypto/bio/bss_conn.c index d4786442803e..10cf20871cb0 100644 --- a/crypto/openssl/crypto/bio/bss_conn.c +++ b/crypto/openssl/crypto/bio/bss_conn.c @@ -539,7 +539,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) } break; case BIO_CTRL_EOF: - ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0; + ret = (b->flags & BIO_FLAGS_IN_EOF) != 0; break; # ifndef OPENSSL_NO_KTLS case BIO_CTRL_SET_KTLS: @@ -549,9 +549,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) BIO_set_ktls_flag(b, num); break; case BIO_CTRL_GET_KTLS_SEND: - return BIO_should_ktls_flag(b, 1); + return BIO_should_ktls_flag(b, 1) != 0; case BIO_CTRL_GET_KTLS_RECV: - return BIO_should_ktls_flag(b, 0); + return BIO_should_ktls_flag(b, 0) != 0; case BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG: BIO_set_ktls_ctrl_msg_flag(b); data->record_type = num; diff --git a/crypto/openssl/crypto/bio/bss_fd.c b/crypto/openssl/crypto/bio/bss_fd.c index ccbe1626baf2..8d03e48ce993 100644 --- a/crypto/openssl/crypto/bio/bss_fd.c +++ b/crypto/openssl/crypto/bio/bss_fd.c @@ -189,7 +189,7 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr) ret = 1; break; case BIO_CTRL_EOF: - ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0; + ret = (b->flags & BIO_FLAGS_IN_EOF) != 0; break; default: ret = 0; diff --git a/crypto/openssl/crypto/bio/bss_sock.c b/crypto/openssl/crypto/bio/bss_sock.c index a1fc23c7c938..8de1f5829207 100644 --- a/crypto/openssl/crypto/bio/bss_sock.c +++ b/crypto/openssl/crypto/bio/bss_sock.c @@ -191,9 +191,9 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) BIO_set_ktls_flag(b, num); break; case BIO_CTRL_GET_KTLS_SEND: - return BIO_should_ktls_flag(b, 1); + return BIO_should_ktls_flag(b, 1) != 0; case BIO_CTRL_GET_KTLS_RECV: - return BIO_should_ktls_flag(b, 0); + return BIO_should_ktls_flag(b, 0) != 0; case BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG: BIO_set_ktls_ctrl_msg_flag(b); b->ptr = (void *)num; @@ -205,7 +205,7 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) break; # endif case BIO_CTRL_EOF: - ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0; + ret = (b->flags & BIO_FLAGS_IN_EOF) != 0; break; default: ret = 0; From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:45:58 2021 Return-Path: Delivered-To: dev-commits-src-main@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 3065866C421; Tue, 17 Aug 2021 21:45:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4N5467fz4TVh; Tue, 17 Aug 2021 21:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7610025424; Tue, 17 Aug 2021 21:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLjvAP017745; Tue, 17 Aug 2021 21:45:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLjvHo017744; Tue, 17 Aug 2021 21:45:57 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:45:57 GMT Message-Id: <202108172145.17HLjvHo017744@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 63c6d3e283eb - main - OpenSSL: ktls: Initial support for ChaCha20-Poly1305 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63c6d3e283eb01d32f54e2a153e6719d19e4a80d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:45:58 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=63c6d3e283eb01d32f54e2a153e6719d19e4a80d commit 63c6d3e283eb01d32f54e2a153e6719d19e4a80d Author: John Baldwin AuthorDate: 2021-08-17 21:38:47 +0000 Commit: John Baldwin CommitDate: 2021-08-17 21:41:19 +0000 OpenSSL: ktls: Initial support for ChaCha20-Poly1305 Linux kernel is going to support ChaCha20-Poly1305 in TLS offload. Add support for this cipher. Reviewed by: jkim Obtained from: OpenSSL (3aa7212e0a4fd1533c8a28b8587dd8b022f3a66f) MFC after: 5 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31439 --- crypto/openssl/include/internal/ktls.h | 8 ++++++++ crypto/openssl/ssl/ktls.c | 21 ++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/crypto/openssl/include/internal/ktls.h b/crypto/openssl/include/internal/ktls.h index 622d7be76d1e..393794298ccd 100644 --- a/crypto/openssl/include/internal/ktls.h +++ b/crypto/openssl/include/internal/ktls.h @@ -219,6 +219,11 @@ static ossl_inline ossl_ssize_t ktls_sendfile(int s, int fd, off_t off, # define OPENSSL_KTLS_TLS13 # if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) # define OPENSSL_KTLS_AES_CCM_128 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) +# ifndef OPENSSL_NO_CHACHA +# define OPENSSL_KTLS_CHACHA20_POLY1305 +# endif +# endif # endif # endif @@ -251,6 +256,9 @@ struct tls_crypto_info_all { # endif # ifdef OPENSSL_KTLS_AES_CCM_128 struct tls12_crypto_info_aes_ccm_128 ccm128; +# endif +# ifdef OPENSSL_KTLS_CHACHA20_POLY1305 + struct tls12_crypto_info_chacha20_poly1305 chacha20poly1305; # endif }; size_t tls_crypto_info_len; diff --git a/crypto/openssl/ssl/ktls.c b/crypto/openssl/ssl/ktls.c index 7123ecac0051..f82946b260ab 100644 --- a/crypto/openssl/ssl/ktls.c +++ b/crypto/openssl/ssl/ktls.c @@ -126,7 +126,9 @@ int ktls_check_supported_cipher(const SSL *s, const EVP_CIPHER *c, return 0; } - /* check that cipher is AES_GCM_128, AES_GCM_256, AES_CCM_128 */ + /* check that cipher is AES_GCM_128, AES_GCM_256, AES_CCM_128 + * or Chacha20-Poly1305 + */ switch (EVP_CIPHER_nid(c)) { # ifdef OPENSSL_KTLS_AES_CCM_128 @@ -139,6 +141,9 @@ int ktls_check_supported_cipher(const SSL *s, const EVP_CIPHER *c, # endif # ifdef OPENSSL_KTLS_AES_GCM_256 case NID_aes_256_gcm: +# endif +# ifdef OPENSSL_KTLS_CHACHA20_POLY1305 + case NID_chacha20_poly1305: # endif return 1; default: @@ -211,6 +216,20 @@ int ktls_configure_crypto(const SSL *s, const EVP_CIPHER *c, EVP_CIPHER_CTX *dd, if (rec_seq != NULL) *rec_seq = crypto_info->ccm128.rec_seq; return 1; +# endif +# ifdef OPENSSL_KTLS_CHACHA20_POLY1305 + case NID_chacha20_poly1305: + crypto_info->chacha20poly1305.info.cipher_type = TLS_CIPHER_CHACHA20_POLY1305; + crypto_info->chacha20poly1305.info.version = s->version; + crypto_info->tls_crypto_info_len = sizeof(crypto_info->chacha20poly1305); + memcpy(crypto_info->chacha20poly1305.iv, iiv, + TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE); + memcpy(crypto_info->chacha20poly1305.key, key, EVP_CIPHER_key_length(c)); + memcpy(crypto_info->chacha20poly1305.rec_seq, rl_sequence, + TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE); + if (rec_seq != NULL) + *rec_seq = crypto_info->chacha20poly1305.rec_seq; + return 1; # endif default: return 0; From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:46:00 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6CC7366C422; Tue, 17 Aug 2021 21:46:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4N76WKVz4Tdc; Tue, 17 Aug 2021 21:45:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B725B251E0; Tue, 17 Aug 2021 21:45:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLjxxs017802; Tue, 17 Aug 2021 21:45:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLjxa4017801; Tue, 17 Aug 2021 21:45:59 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:45:59 GMT Message-Id: <202108172145.17HLjxa4017801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a208223130fb - main - OpenSSL: Update KTLS documentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a208223130fb12daac9b4f52be1b3477b03ac521 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:46:00 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a208223130fb12daac9b4f52be1b3477b03ac521 commit a208223130fb12daac9b4f52be1b3477b03ac521 Author: John Baldwin AuthorDate: 2021-08-17 21:39:32 +0000 Commit: John Baldwin CommitDate: 2021-08-17 21:41:31 +0000 OpenSSL: Update KTLS documentation KTLS support has been changed to be off by default, and configuration is via a single "option" rather two "modes". Documentation is updated accordingly. Reviewed by: jkim Obtained from: OpenSSL (6878f4300213cfd7d4f01e26a8b97f70344da100) MFC after: 5 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31441 --- crypto/openssl/doc/man3/SSL_CONF_cmd.pod | 4 ++++ crypto/openssl/doc/man3/SSL_CTX_set_mode.pod | 17 ----------------- crypto/openssl/doc/man3/SSL_CTX_set_options.pod | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/crypto/openssl/doc/man3/SSL_CONF_cmd.pod b/crypto/openssl/doc/man3/SSL_CONF_cmd.pod index 900c4f3a5648..a3f447a986e3 100644 --- a/crypto/openssl/doc/man3/SSL_CONF_cmd.pod +++ b/crypto/openssl/doc/man3/SSL_CONF_cmd.pod @@ -495,6 +495,10 @@ specification. Some applications may be able to mitigate the replay risks in other ways and in such cases the built-in OpenSSL functionality is not required. Disabling anti-replay is equivalent to setting B. +B: Enables kernel TLS if support has been compiled in, and it is supported +by the negotiated ciphersuites and extensions. Equivalent to +B. + =item B The B argument is a comma separated list of flags to set. diff --git a/crypto/openssl/doc/man3/SSL_CTX_set_mode.pod b/crypto/openssl/doc/man3/SSL_CTX_set_mode.pod index 27eaebad1ea0..85e3353e0e2c 100644 --- a/crypto/openssl/doc/man3/SSL_CTX_set_mode.pod +++ b/crypto/openssl/doc/man3/SSL_CTX_set_mode.pod @@ -114,22 +114,6 @@ enables this behaviour to allow interoperability with such broken implementations. Please note that setting this option breaks interoperability with correct implementations. This option only applies to DTLS over SCTP. -=item SSL_MODE_NO_KTLS_TX - -Disable the use of the kernel TLS egress data-path. -By default kernel TLS is enabled if it is supported by the negotiated ciphersuites -and extensions and OpenSSL has been compiled with support for it. -The kernel TLS data-path implements the record layer, -and the crypto algorithm. The kernel will utilize the best hardware -available for crypto. Using the kernel data-path should reduce the memory -footprint of OpenSSL because no buffering is required. Also, the throughput -should improve because data copy is avoided when user data is encrypted into -kernel memory instead of the usual encrypt than copy to kernel. - -Kernel TLS might not support all the features of OpenSSL. For instance, -renegotiation, and setting the maximum fragment size is not possible as of -Linux 4.20. - =back All modes are off by default except for SSL_MODE_AUTO_RETRY which is on by @@ -150,7 +134,6 @@ L, L =head1 HISTORY SSL_MODE_ASYNC was added in OpenSSL 1.1.0. -SSL_MODE_NO_KTLS_TX was first added to OpenSSL 3.0.0. =head1 COPYRIGHT diff --git a/crypto/openssl/doc/man3/SSL_CTX_set_options.pod b/crypto/openssl/doc/man3/SSL_CTX_set_options.pod index 969e0366c45a..231fe92d8e78 100644 --- a/crypto/openssl/doc/man3/SSL_CTX_set_options.pod +++ b/crypto/openssl/doc/man3/SSL_CTX_set_options.pod @@ -237,6 +237,29 @@ functionality is not required. Those applications can turn this feature off by setting this option. This is a server-side opton only. It is ignored by clients. +=item SSL_OP_ENABLE_KTLS + +Enable the use of kernel TLS. In order to benefit from kernel TLS OpenSSL must +have been compiled with support for it, and it must be supported by the +negotiated ciphersuites and extensions. The specific ciphersuites and extensions +that are supported may vary by platform and kernel version. + +The kernel TLS data-path implements the record layer, and the encryption +algorithm. The kernel will utilize the best hardware +available for encryption. Using the kernel data-path should reduce the memory +footprint of OpenSSL because no buffering is required. Also, the throughput +should improve because data copy is avoided when user data is encrypted into +kernel memory instead of the usual encrypt then copy to kernel. + +Kernel TLS might not support all the features of OpenSSL. For instance, +renegotiation, and setting the maximum fragment size is not possible as of +Linux 4.20. + +Note that with kernel TLS enabled some cryptographic operations are performed +by the kernel directly and not via any available OpenSSL Providers. This might +be undesirable if, for example, the application requires all cryptographic +operations to be performed by the FIPS provider. + =back The following options no longer have any effect but their identifiers are From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:46:01 2021 Return-Path: Delivered-To: dev-commits-src-main@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 80BAF66C03F; Tue, 17 Aug 2021 21:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4N91GJQz4TvF; Tue, 17 Aug 2021 21:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB63525426; Tue, 17 Aug 2021 21:46:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLk0Ze017826; Tue, 17 Aug 2021 21:46:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLk02v017825; Tue, 17 Aug 2021 21:46:00 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:46:00 GMT Message-Id: <202108172146.17HLk02v017825@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d6e78ecb0bcd - main - OpenSSL: Refactor KTLS tests to better support TLS 1.3. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d6e78ecb0bcd5af750c72745c4c51fe211046bff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:46:02 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d6e78ecb0bcd5af750c72745c4c51fe211046bff commit d6e78ecb0bcd5af750c72745c4c51fe211046bff Author: John Baldwin AuthorDate: 2021-08-17 21:39:58 +0000 Commit: John Baldwin CommitDate: 2021-08-17 21:41:37 +0000 OpenSSL: Refactor KTLS tests to better support TLS 1.3. Most of this upstream commit touched tests not included in the vendor import. The one change merged in is to remove a constant only present in an internal header to appease the older tests. Reviewed by: jkim Obtained from: OpenSSL (e1fdd5262e4a45ce3aaa631768e877ee7b6da21b) MFC after: 5 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31442 --- crypto/openssl/include/internal/ktls.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/crypto/openssl/include/internal/ktls.h b/crypto/openssl/include/internal/ktls.h index 393794298ccd..e824cf3f3f92 100644 --- a/crypto/openssl/include/internal/ktls.h +++ b/crypto/openssl/include/internal/ktls.h @@ -39,12 +39,6 @@ # define OPENSSL_KTLS_AES_GCM_256 # define OPENSSL_KTLS_TLS13 -/* - * Only used by the tests in sslapitest.c. - */ -# define TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE 8 -# define TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE 8 - typedef struct tls_enable ktls_crypto_info_t; /* From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:46:00 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E10DB66C14F; Tue, 17 Aug 2021 21:45:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4N658TNz4ThQ; Tue, 17 Aug 2021 21:45:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A61025425; Tue, 17 Aug 2021 21:45:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLjwvA017769; Tue, 17 Aug 2021 21:45:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLjwBn017768; Tue, 17 Aug 2021 21:45:58 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:45:58 GMT Message-Id: <202108172145.17HLjwBn017768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 62ca9fc1ad56 - main - OpenSSL: Only enable KTLS if it is explicitly configured MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62ca9fc1ad569eb3fafd281e03812a598b9856ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:46:00 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=62ca9fc1ad569eb3fafd281e03812a598b9856ee commit 62ca9fc1ad569eb3fafd281e03812a598b9856ee Author: John Baldwin AuthorDate: 2021-08-17 21:39:03 +0000 Commit: John Baldwin CommitDate: 2021-08-17 21:41:24 +0000 OpenSSL: Only enable KTLS if it is explicitly configured It has always been the case that KTLS is not compiled by default. However if it is compiled then it was automatically used unless specifically configured not to. This is problematic because it avoids any crypto implementations from providers. A user who configures all crypto to use the FIPS provider may unexpectedly find that TLS related crypto is actually being performed outside of the FIPS boundary. Instead we change KTLS so that it is disabled by default. We also swap to using a single "option" (i.e. SSL_OP_ENABLE_KTLS) rather than two separate "modes", (i.e. SSL_MODE_NO_KTLS_RX and SSL_MODE_NO_KTLS_TX). Reviewed by: jkim Obtained from: OpenSSL (a3a54179b6754fbed6d88e434baac710a83aaf80) MFC after: 5 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31440 --- crypto/openssl/include/openssl/ssl.h | 12 +++--------- crypto/openssl/ssl/ktls.c | 1 + crypto/openssl/ssl/ssl_conf.c | 3 ++- crypto/openssl/ssl/t1_enc.c | 6 +----- crypto/openssl/ssl/tls13_enc.c | 5 +++-- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/crypto/openssl/include/openssl/ssl.h b/crypto/openssl/include/openssl/ssl.h index 09620489bc20..cfb87e63226e 100644 --- a/crypto/openssl/include/openssl/ssl.h +++ b/crypto/openssl/include/openssl/ssl.h @@ -303,7 +303,9 @@ typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); /* Allow initial connection to servers that don't support RI */ # define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004U -/* Reserved value (until OpenSSL 1.2.0) 0x00000008U */ +/* Enable support for Kernel TLS */ +# define SSL_OP_ENABLE_KTLS 0x00000008U + # define SSL_OP_TLSEXT_PADDING 0x00000010U /* Reserved value (until OpenSSL 1.2.0) 0x00000020U */ # define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040U @@ -493,10 +495,6 @@ typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); * Support Asynchronous operation */ # define SSL_MODE_ASYNC 0x00000100U -/* - * Don't use the kernel TLS data-path for sending. - */ -# define SSL_MODE_NO_KTLS_TX 0x00000200U /* * When using DTLS/SCTP, include the terminating zero in the label @@ -510,10 +508,6 @@ typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); * - OpenSSL 1.1.1 and 1.1.1a */ # define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U -/* - * Don't use the kernel TLS data-path for receiving. - */ -# define SSL_MODE_NO_KTLS_RX 0x00000800U /* Cert related flags */ /* diff --git a/crypto/openssl/ssl/ktls.c b/crypto/openssl/ssl/ktls.c index f82946b260ab..47328a7c7c73 100644 --- a/crypto/openssl/ssl/ktls.c +++ b/crypto/openssl/ssl/ktls.c @@ -137,6 +137,7 @@ int ktls_check_supported_cipher(const SSL *s, const EVP_CIPHER *c, return 0; # endif # ifdef OPENSSL_KTLS_AES_GCM_128 + /* Fall through */ case NID_aes_128_gcm: # endif # ifdef OPENSSL_KTLS_AES_GCM_256 diff --git a/crypto/openssl/ssl/ssl_conf.c b/crypto/openssl/ssl/ssl_conf.c index 0a3fef7c8c14..8013c62f0770 100644 --- a/crypto/openssl/ssl/ssl_conf.c +++ b/crypto/openssl/ssl/ssl_conf.c @@ -391,7 +391,8 @@ static int cmd_Options(SSL_CONF_CTX *cctx, const char *value) SSL_FLAG_TBL("AllowNoDHEKEX", SSL_OP_ALLOW_NO_DHE_KEX), SSL_FLAG_TBL("PrioritizeChaCha", SSL_OP_PRIORITIZE_CHACHA), SSL_FLAG_TBL("MiddleboxCompat", SSL_OP_ENABLE_MIDDLEBOX_COMPAT), - SSL_FLAG_TBL_INV("AntiReplay", SSL_OP_NO_ANTI_REPLAY) + SSL_FLAG_TBL_INV("AntiReplay", SSL_OP_NO_ANTI_REPLAY), + SSL_FLAG_TBL("KTLS", SSL_OP_ENABLE_KTLS) }; if (value == NULL) return -3; diff --git a/crypto/openssl/ssl/t1_enc.c b/crypto/openssl/ssl/t1_enc.c index d4614210685a..7d2eb381af1a 100644 --- a/crypto/openssl/ssl/t1_enc.c +++ b/crypto/openssl/ssl/t1_enc.c @@ -362,11 +362,7 @@ int tls1_change_cipher_state(SSL *s, int which) goto err; } #ifndef OPENSSL_NO_KTLS - if (s->compress) - goto skip_ktls; - - if (((which & SSL3_CC_READ) && (s->mode & SSL_MODE_NO_KTLS_RX)) - || ((which & SSL3_CC_WRITE) && (s->mode & SSL_MODE_NO_KTLS_TX))) + if (s->compress || (s->options & SSL_OP_ENABLE_KTLS) == 0) goto skip_ktls; /* ktls supports only the maximum fragment size */ diff --git a/crypto/openssl/ssl/tls13_enc.c b/crypto/openssl/ssl/tls13_enc.c index d9f050ee346d..39530237d897 100644 --- a/crypto/openssl/ssl/tls13_enc.c +++ b/crypto/openssl/ssl/tls13_enc.c @@ -724,8 +724,9 @@ int tls13_change_cipher_state(SSL *s, int which) s->statem.enc_write_state = ENC_WRITE_STATE_VALID; #ifndef OPENSSL_NO_KTLS # if defined(OPENSSL_KTLS_TLS13) - if (!(which & SSL3_CC_WRITE) || !(which & SSL3_CC_APPLICATION) - || ((which & SSL3_CC_WRITE) && (s->mode & SSL_MODE_NO_KTLS_TX))) + if (!(which & SSL3_CC_WRITE) + || !(which & SSL3_CC_APPLICATION) + || (s->options & SSL_OP_ENABLE_KTLS) == 0) goto skip_ktls; /* ktls supports only the maximum fragment size */ From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:46:04 2021 Return-Path: Delivered-To: dev-commits-src-main@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 58BCE66C1C4; Tue, 17 Aug 2021 21:46:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4NC3Xkfz4Tdv; Tue, 17 Aug 2021 21:46:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C6F325590; Tue, 17 Aug 2021 21:46:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLk3fT017876; Tue, 17 Aug 2021 21:46:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLk3aK017875; Tue, 17 Aug 2021 21:46:03 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:46:03 GMT Message-Id: <202108172146.17HLk3aK017875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 671a35b176e4 - main - UPDATING: Add a note about OpenSSL defaulting KTLS to off. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 671a35b176e4b3c445696a8b423db5f8de26c285 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:46:04 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=671a35b176e4b3c445696a8b423db5f8de26c285 commit 671a35b176e4b3c445696a8b423db5f8de26c285 Author: John Baldwin AuthorDate: 2021-08-17 21:40:33 +0000 Commit: John Baldwin CommitDate: 2021-08-17 21:43:46 +0000 UPDATING: Add a note about OpenSSL defaulting KTLS to off. Sponsored by: Netflix MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D31444 --- UPDATING | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/UPDATING b/UPDATING index 512f33e9b43d..7293a336c99c 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20210817: + As of commit 62ca9fc1ad56 OpenSSL no longer enables kernel TLS + by default. Users can enable kernel TLS via the "KTLS" SSL + option. This can be enabled globally by using a custom + OpenSSL config file via OPENSSL_CONF or via an + application-specific configuration option for applications + which permit setting SSL options via SSL_CONF_cmd(3). + 20210811: Commit 3ad1e1c1ce20 changed the internal KAPI between the NFS modules. Therefore, all need to be rebuilt from sources. From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:46:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 81C2366C15C; Tue, 17 Aug 2021 21:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4NB1Mlpz4Thh; Tue, 17 Aug 2021 21:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07214251E1; Tue, 17 Aug 2021 21:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLk1vo017850; Tue, 17 Aug 2021 21:46:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLk1IO017849; Tue, 17 Aug 2021 21:46:01 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:46:01 GMT Message-Id: <202108172146.17HLk1IO017849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 6372fd253e32 - main - OpenSSL: Add support for Chacha20-Poly1305 to kernel TLS on FreeBSD. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6372fd253e3266c6eb271f49159f1632d527c9bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:46:02 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6372fd253e3266c6eb271f49159f1632d527c9bd commit 6372fd253e3266c6eb271f49159f1632d527c9bd Author: John Baldwin AuthorDate: 2021-08-17 21:40:16 +0000 Commit: John Baldwin CommitDate: 2021-08-17 21:41:42 +0000 OpenSSL: Add support for Chacha20-Poly1305 to kernel TLS on FreeBSD. FreeBSD's kernel TLS supports Chacha20 for both TLS 1.2 and TLS 1.3. NB: This commit has not yet been merged upstream as it is deemed a new feature and did not make the feature freeze cutoff for OpenSSL 3.0. Reviewed by: jkim MFC after: 5 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31443 --- crypto/openssl/include/internal/ktls.h | 5 +++++ crypto/openssl/ssl/ktls.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/crypto/openssl/include/internal/ktls.h b/crypto/openssl/include/internal/ktls.h index e824cf3f3f92..5f9e3f91edb2 100644 --- a/crypto/openssl/include/internal/ktls.h +++ b/crypto/openssl/include/internal/ktls.h @@ -38,6 +38,11 @@ # define OPENSSL_KTLS_AES_GCM_128 # define OPENSSL_KTLS_AES_GCM_256 # define OPENSSL_KTLS_TLS13 +# ifdef TLS_CHACHA20_IV_LEN +# ifndef OPENSSL_NO_CHACHA +# define OPENSSL_KTLS_CHACHA20_POLY1305 +# endif +# endif typedef struct tls_enable ktls_crypto_info_t; diff --git a/crypto/openssl/ssl/ktls.c b/crypto/openssl/ssl/ktls.c index 47328a7c7c73..c7a440b79bd2 100644 --- a/crypto/openssl/ssl/ktls.c +++ b/crypto/openssl/ssl/ktls.c @@ -37,6 +37,10 @@ int ktls_check_supported_cipher(const SSL *s, const EVP_CIPHER *c, case SSL_AES128GCM: case SSL_AES256GCM: return 1; +# ifdef OPENSSL_KTLS_CHACHA20_POLY1305 + case SSL_CHACHA20POLY1305: + return 1; +# endif case SSL_AES128: case SSL_AES256: if (s->ext.use_etm) @@ -71,6 +75,12 @@ int ktls_configure_crypto(const SSL *s, const EVP_CIPHER *c, EVP_CIPHER_CTX *dd, else crypto_info->iv_len = EVP_GCM_TLS_FIXED_IV_LEN; break; +# ifdef OPENSSL_KTLS_CHACHA20_POLY1305 + case SSL_CHACHA20POLY1305: + crypto_info->cipher_algorithm = CRYPTO_CHACHA20_POLY1305; + crypto_info->iv_len = EVP_CIPHER_CTX_iv_length(dd); + break; +# endif case SSL_AES128: case SSL_AES256: switch (s->s3->tmp.new_cipher->algorithm_mac) { From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:50:11 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E274B66CA98; Tue, 17 Aug 2021 21:50:11 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4Sz66rMz4VFd; Tue, 17 Aug 2021 21:50:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.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 5E20522C3F; Tue, 17 Aug 2021 21:50:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 671a35b176e4 - main - UPDATING: Add a note about OpenSSL defaulting KTLS to off. From: John Baldwin To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202108172146.17HLk3aK017875@gitrepo.freebsd.org> Message-ID: Date: Tue, 17 Aug 2021 14:50:10 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <202108172146.17HLk3aK017875@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:50:12 -0000 On 8/17/21 2:46 PM, John Baldwin wrote: > The branch main has been updated by jhb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=671a35b176e4b3c445696a8b423db5f8de26c285 > > commit 671a35b176e4b3c445696a8b423db5f8de26c285 > Author: John Baldwin > AuthorDate: 2021-08-17 21:40:33 +0000 > Commit: John Baldwin > CommitDate: 2021-08-17 21:43:46 +0000 > > UPDATING: Add a note about OpenSSL defaulting KTLS to off. > > Sponsored by: Netflix > MFC after: 5 days > Differential Revision: https://reviews.freebsd.org/D31444 The NFS TLS daemons have been patched to enable KTLS explicitly. For other applications, a config file that can be used with OPENSSL_CONF to enable KTLS is below: openssl_conf = openssl_init [openssl_init] ssl_conf = ssl_sect [ssl_sect] system_default = system_default_sect [system_default_sect] Options = KTLS -- John Baldwin From owner-dev-commits-src-main@freebsd.org Tue Aug 17 21:54:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 960AD66CABD; Tue, 17 Aug 2021 21:54:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq4ZF3jKWz4Vbr; Tue, 17 Aug 2021 21:54:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67607256A5; Tue, 17 Aug 2021 21:54:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17HLsjaJ031781; Tue, 17 Aug 2021 21:54:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17HLsjg7031780; Tue, 17 Aug 2021 21:54:45 GMT (envelope-from git) Date: Tue, 17 Aug 2021 21:54:45 GMT Message-Id: <202108172154.17HLsjg7031780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Scott Long Subject: git: 045001075ed1 - main - - Fix the growfs rc script to cope with diskid labels. - Fix a warning in growfs. gpart commit is supposed to be called on disk device. - Silence a gpart commit warning in growfs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: scottl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 045001075ed18295288176211456dde3df7faf46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 21:54:45 -0000 The branch main has been updated by scottl: URL: https://cgit.FreeBSD.org/src/commit/?id=045001075ed18295288176211456dde3df7faf46 commit 045001075ed18295288176211456dde3df7faf46 Author: Scott Long AuthorDate: 2021-08-17 21:50:18 +0000 Commit: Scott Long CommitDate: 2021-08-17 21:50:18 +0000 - Fix the growfs rc script to cope with diskid labels. - Fix a warning in growfs. gpart commit is supposed to be called on disk device. - Silence a gpart commit warning in growfs. Submitted by: loos Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31587 Sponsored by: Rubicon Communications, LLC ("Netgate") --- libexec/rc/rc.d/growfs | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/libexec/rc/rc.d/growfs b/libexec/rc/rc.d/growfs index c2955c740d43..5402bd442279 100755 --- a/libexec/rc/rc.d/growfs +++ b/libexec/rc/rc.d/growfs @@ -48,6 +48,19 @@ start_cmd="growfs_start" stop_cmd=":" rcvar="growfs_enable" +growfs_get_diskdev () +{ + local _search=${1} + sysctl -b kern.geom.conftxt | + while read x1 _type _dev line + do + if [ "${_type}" = "DISK" -a -n "$(echo ${_search} | grep ${_dev})" ]; then + echo -n ${_dev} + break + fi + done +} + growfs_start () { echo "Growing root partition to fill device" @@ -69,13 +82,24 @@ growfs_start () # raw device rawdev="$rootdev" else - rawdev=$(glabel status | awk '$1 == "'"$rootdev"'" { print $3 }') + rawdev=$(glabel status | awk -v rootdev=$rootdev 'index(rootdev, $1) { print $3; }') if [ x"$rawdev" = x"" ]; then echo "Can't figure out device for: $rootdev" return fi fi + if [ x"diskid" = x"${rootdev%/*}" ]; then + search=$rootdev + else + search=$rawdev + fi + + diskdev=$(growfs_get_diskdev ${search}) + if [ -z "${diskdev}" ]; then + diskdev=${rootdev} + fi + sysctl -b kern.geom.conftxt | awk ' { lvl=$1 @@ -104,8 +128,8 @@ growfs_start () } exit 0 } -}' dev="$rawdev" - gpart commit "$rootdev" +}' dev="$search" + gpart commit "$diskdev" 2> /dev/null case "$FSTYPE" in ufs) growfs -y /dev/"$rootdev" From owner-dev-commits-src-main@freebsd.org Tue Aug 17 22:17:57 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2B6C566CF8F; Tue, 17 Aug 2021 22:17:57 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4Gq5510JwGz4WQF; Tue, 17 Aug 2021 22:17:57 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ed1-f42.google.com with SMTP id cq23so16350533edb.12; Tue, 17 Aug 2021 15:17:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oYL/tPfagGbxJCg794ae2ErsaZ0D3kYt8cclbDceYoM=; b=fnOcESp3N5zsyct/WDzBc3cs1aECMwDMUWknrlxBImqJEd8uJyEHvvNp2dgDYpn4U+ mbWV9YUhSVhfigXnmUrOt2jV7s1VS5YlxPeIZErPxi6S28x3KcQejqzXaJ2Oe9cvTMev STuvdzObAhguUQL9zUdDyDqvazn1Pv6upN90iq3LoAreAkKCi6E9g73AXypLtt2O56/d 4dldt8qTB5Hj0QgWBdoMrYHAz0VBE8buQeOW3JIiTXZ6VFXXDMu/VkrJ6vx0xYtszuc6 abxfWF29dKikVgbtmXupJtFWf1yKmFrv7m3boxOZ3az+svHZPt1U82VHOO+Z3hmPfVwq OfQw== X-Gm-Message-State: AOAM532Gba/eMr3Vh+N/bSGGKrpmZXjEuiE6tazikwMONFPbLNm8e3qx EpaGWtKEJ402URlvnGoW+GP4HcJ2F0E= X-Google-Smtp-Source: ABdhPJyG6TErtDY4TY9wPpGqkN1t/gK8ZCHTSFQ7gqwcdJ0As0tjlLMExSystW53ekLs5HJa5HDdjw== X-Received: by 2002:a05:6402:13c5:: with SMTP id a5mr6178191edx.132.1629238669990; Tue, 17 Aug 2021 15:17:49 -0700 (PDT) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com. [209.85.221.51]) by smtp.gmail.com with ESMTPSA id b5sm1254031ejq.56.2021.08.17.15.17.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Aug 2021 15:17:49 -0700 (PDT) Received: by mail-wr1-f51.google.com with SMTP id q6so312577wrv.6; Tue, 17 Aug 2021 15:17:49 -0700 (PDT) X-Received: by 2002:a5d:618c:: with SMTP id j12mr6702476wru.374.1629238669511; Tue, 17 Aug 2021 15:17:49 -0700 (PDT) MIME-Version: 1.0 References: <202108171645.17HGjNL3012769@gitrepo.freebsd.org> <4C25E4D8-D33E-4397-956E-D21B80239EBA@freebsd.org> In-Reply-To: <4C25E4D8-D33E-4397-956E-D21B80239EBA@freebsd.org> From: Alexander Richardson Date: Tue, 17 Aug 2021 23:17:36 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d9f25575a29f - main - Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now To: Jessica Clarke Cc: src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4Gq5510JwGz4WQF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 22:17:57 -0000 On Tue, 17 Aug 2021, 18:00 Jessica Clarke, wrote: > On 17 Aug 2021, at 17:45, Alex Richardson wrote: > > > > The branch main has been updated by arichardson: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=d9f25575a29ff7c83f226349a10a37b9aaf75ad5 > > > > commit d9f25575a29ff7c83f226349a10a37b9aaf75ad5 > > Author: Alex Richardson > > AuthorDate: 2021-08-17 16:44:40 +0000 > > Commit: Alex Richardson > > CommitDate: 2021-08-17 16:44:52 +0000 > > > > Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for > now > > > > I enabled these options again in > 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3, > > but unfortunately only my specific build configuration worked whereas > the > > build with default options is still broken. > > Insta-MFC to fix stable/13 cross-builds? > > Jess Oh yes good point. For some reason I thought I hadn't MFCd the broken commit. Will do that first thing tomorrow morning. Alex From owner-dev-commits-src-main@freebsd.org Wed Aug 18 06:25:19 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E1D31672464; Wed, 18 Aug 2021 06:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqHvM5mFBz3DJ1; Wed, 18 Aug 2021 06:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9D9646C5; Wed, 18 Aug 2021 06:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17I6PJci010785; Wed, 18 Aug 2021 06:25:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17I6PJmQ010784; Wed, 18 Aug 2021 06:25:19 GMT (envelope-from git) Date: Wed, 18 Aug 2021 06:25:19 GMT Message-Id: <202108180625.17I6PJmQ010784@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: e3500c602b13 - main - ipmi: fix negative logic in watchdog control flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3500c602b13f8252eb8bb779849c41d47306cee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 06:25:19 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=e3500c602b13f8252eb8bb779849c41d47306cee commit e3500c602b13f8252eb8bb779849c41d47306cee Author: Wojciech Macek AuthorDate: 2021-08-18 06:21:14 +0000 Commit: Wojciech Macek CommitDate: 2021-08-18 06:21:14 +0000 ipmi: fix negative logic in watchdog control flag Use wd_enable instead of wd_disable --- sys/dev/ipmi/ipmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index 77fd4b68ae96..77baf652b4bc 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -96,14 +96,14 @@ static int wd_shutdown_countdown = 0; /* sec */ static int wd_startup_countdown = 0; /* sec */ static int wd_pretimeout_countdown = 120; /* sec */ static int cycle_wait = 10; /* sec */ -static int wd_init_disable = 0; +static int wd_init_enable = 1; static SYSCTL_NODE(_hw, OID_AUTO, ipmi, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "IPMI driver parameters"); SYSCTL_INT(_hw_ipmi, OID_AUTO, on, CTLFLAG_RWTUN, &on, 0, ""); -SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_init_disable, CTLFLAG_RWTUN, - &wd_init_disable, 0, ""); +SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_init_enable, CTLFLAG_RWTUN, + &wd_init_enable, 1, "Enable watchdog initialization"); SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_timer_actions, CTLFLAG_RW, &wd_timer_actions, 0, "IPMI watchdog timer actions (including pre-timeout interrupt)"); @@ -912,7 +912,7 @@ ipmi_startup(void *arg) * Probe for watchdog, but only for backends which support * polled driver requests. */ - if (!wd_init_disable && sc->ipmi_driver_requests_polled) { + if (wd_init_enable && sc->ipmi_driver_requests_polled) { IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_GET_WDOG, 0, 0); From owner-dev-commits-src-main@freebsd.org Wed Aug 18 07:19:55 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D3E45672F27; Wed, 18 Aug 2021 07:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqK6M5QKsz3Gxd; Wed, 18 Aug 2021 07:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 977AD4BE3; Wed, 18 Aug 2021 07:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17I7Jtff077850; Wed, 18 Aug 2021 07:19:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17I7JtxQ077849; Wed, 18 Aug 2021 07:19:55 GMT (envelope-from git) Date: Wed, 18 Aug 2021 07:19:55 GMT Message-Id: <202108180719.17I7JtxQ077849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 66fa12d8fb61 - main - iflib: emulate counters in netmap mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66fa12d8fb61485780f32f0226e79d3389567496 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 07:19:55 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=66fa12d8fb61485780f32f0226e79d3389567496 commit 66fa12d8fb61485780f32f0226e79d3389567496 Author: Stephan de Wit AuthorDate: 2021-08-18 07:17:43 +0000 Commit: Kevin Bowling CommitDate: 2021-08-18 07:17:43 +0000 iflib: emulate counters in netmap mode When iflib devices are in netmap mode the driver counters are no longer updated making it look from userspace tools that traffic has stopped. Reported by: Franco Fichtner Reviewed by: vmaffione, iflib (erj, gallatin) Obtained from: OPNsense MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31550 --- sys/net/iflib.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index abd6bd32cd4e..8c8cc6936f7e 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -993,6 +993,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) u_int const lim = kring->nkr_num_slots - 1; u_int const head = kring->rhead; struct if_pkt_info pi; + int tx_pkts = 0, tx_bytes = 0; /* * interrupts on every tx packet are expensive so request @@ -1077,6 +1078,10 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) ctx->isc_txd_encap(ctx->ifc_softc, &pi); DBG_COUNTER_INC(tx_encap); + /* Update transmit counters */ + tx_bytes += pi.ipi_len; + tx_pkts++; + /* Reinit per-packet info for the next one. */ flags = seg_idx = pkt_len = 0; nic_i_start = -1; @@ -1135,6 +1140,10 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) iflib_netmap_timer, txq, txq->ift_netmap_timer.c_cpu, 0); } + + if_inc_counter(ifp, IFCOUNTER_OBYTES, tx_bytes); + if_inc_counter(ifp, IFCOUNTER_OPACKETS, tx_pkts); + return (0); } @@ -1162,7 +1171,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) u_int n; u_int const lim = kring->nkr_num_slots - 1; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; - int i = 0; + int i = 0, rx_bytes = 0, rx_pkts = 0; if_ctx_t ctx = ifp->if_softc; if_shared_ctx_t sctx = ctx->ifc_sctx; @@ -1233,6 +1242,10 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) if (i == (ri.iri_nfrags - 1)) { ring->slot[nm_i].len -= crclen; ring->slot[nm_i].flags = 0; + + /* Update receive counters */ + rx_bytes += ri.iri_len; + rx_pkts++; } else ring->slot[nm_i].flags = NS_MOREFRAG; } @@ -1270,6 +1283,9 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) */ netmap_fl_refill(rxq, kring, false); + if_inc_counter(ifp, IFCOUNTER_IBYTES, rx_bytes); + if_inc_counter(ifp, IFCOUNTER_IPACKETS, rx_pkts); + return (0); } From owner-dev-commits-src-main@freebsd.org Wed Aug 18 08:52:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E27676740B5; Wed, 18 Aug 2021 08:52:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqM8f5vMcz3R4V; Wed, 18 Aug 2021 08:52:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2CF35BFD; Wed, 18 Aug 2021 08:52:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17I8q2C8009886; Wed, 18 Aug 2021 08:52:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17I8q2Wl009885; Wed, 18 Aug 2021 08:52:02 GMT (envelope-from git) Date: Wed, 18 Aug 2021 08:52:02 GMT Message-Id: <202108180852.17I8q2Wl009885@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: a051ca72e281 - main - Introduce m_get3() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a051ca72e2815b9bbba1e422f5abf22bc2a01551 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 08:52:03 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a051ca72e2815b9bbba1e422f5abf22bc2a01551 commit a051ca72e2815b9bbba1e422f5abf22bc2a01551 Author: Kristof Provost AuthorDate: 2021-08-07 18:02:21 +0000 Commit: Kristof Provost CommitDate: 2021-08-18 06:48:27 +0000 Introduce m_get3() Introduce m_get3() which is similar to m_get2(), but can allocate up to MJUM16BYTES bytes (m_get2() can only allocate up to MJUMPAGESIZE). This simplifies the bpf improvement in f13da24715. Suggested by: glebius Differential Revision: https://reviews.freebsd.org/D31455 --- share/man/man9/mbuf.9 | 11 ++++++++++- sys/kern/kern_mbuf.c | 38 ++++++++++++++++++++++++++++++++++++++ sys/net/bpf.c | 9 +-------- sys/sys/mbuf.h | 1 + 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9 index f6361cdc7c06..ea3f66e3e218 100644 --- a/share/man/man9/mbuf.9 +++ b/share/man/man9/mbuf.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 8, 2021 +.Dd August 8, 2021 .Dt MBUF 9 .Os .\" @@ -73,6 +73,8 @@ .Ft struct mbuf * .Fn m_get2 "int size" "int how" "short type" "int flags" .Ft struct mbuf * +.Fn m_get3 "int size" "int how" "short type" "int flags" +.Ft struct mbuf * .Fn m_getm "struct mbuf *orig" "int len" "int how" "short type" .Ft struct mbuf * .Fn m_getjcl "int how" "short type" "int flags" "int size" @@ -577,6 +579,13 @@ with enough space to hold specified amount of data. If the size is is larger than .Dv MJUMPAGESIZE , NULL will be returned. +.It Fn m_get3 size how type flags +Allocate an +.Vt mbuf +with enough space to hold specified amount of data. +If the size is is larger than +.Dv MJUM16BYTES, NULL +will be returned. .It Fn m_getm orig len how type Allocate .Fa len diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index ae4aa7d7e96a..123985a7dec2 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1371,6 +1371,44 @@ m_get2(int size, int how, short type, int flags) return (m); } +/* + * m_get3() allocates minimum mbuf that would fit "size" argument. + * Unlike m_get2() it can allocate clusters up to MJUM16BYTES. + */ +struct mbuf * +m_get3(int size, int how, short type, int flags) +{ + struct mb_args args; + struct mbuf *m, *n; + uma_zone_t zone; + + if (size <= MJUMPAGESIZE) + return (m_get2(size, how, type, flags)); + + if (size > MJUM16BYTES) + return (NULL); + + args.flags = flags; + args.type = type; + + m = uma_zalloc_arg(zone_mbuf, &args, how); + if (m == NULL) + return (NULL); + + if (size <= MJUM9BYTES) + zone = zone_jumbo9; + else + zone = zone_jumbo16; + + n = uma_zalloc_arg(zone_jumbop, m, how); + if (n == NULL) { + m_free_raw(m); + return (NULL); + } + + return (m); +} + /* * m_getjcl() returns an mbuf with a cluster of the specified size attached. * For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES. diff --git a/sys/net/bpf.c b/sys/net/bpf.c index ff14152c086c..77c85cc91aae 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -644,14 +644,7 @@ bpf_movein(struct uio *uio, int linktype, struct ifnet *ifp, struct mbuf **mp, return (EMSGSIZE); /* Allocate a mbuf for our write, since m_get2 fails if len >= to MJUMPAGESIZE, use m_getjcl for bigger buffers */ - if (len < MJUMPAGESIZE) - m = m_get2(len, M_WAITOK, MT_DATA, M_PKTHDR); - else if (len <= MJUM9BYTES) - m = m_getjcl(M_WAITOK, MT_DATA, M_PKTHDR, MJUM9BYTES); - else if (len <= MJUM16BYTES) - m = m_getjcl(M_WAITOK, MT_DATA, M_PKTHDR, MJUM16BYTES); - else - m = NULL; + m = m_get3(len, M_WAITOK, MT_DATA, M_PKTHDR); if (m == NULL) return (EIO); m->m_pkthdr.len = m->m_len = len; diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 2936966f6acc..58ada4d0b7b2 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -829,6 +829,7 @@ struct mbuf *m_fragment(struct mbuf *, int, int); void m_freem(struct mbuf *); void m_free_raw(struct mbuf *); struct mbuf *m_get2(int, int, short, int); +struct mbuf *m_get3(int, int, short, int); struct mbuf *m_getjcl(int, short, int, int); struct mbuf *m_getm2(struct mbuf *, int, int, short, int); struct mbuf *m_getptr(struct mbuf *, int, int *); From owner-dev-commits-src-main@freebsd.org Wed Aug 18 08:52:04 2021 Return-Path: Delivered-To: dev-commits-src-main@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 05C556740BA; Wed, 18 Aug 2021 08:52:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqM8g6cL9z3R01; Wed, 18 Aug 2021 08:52:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA62665B2; Wed, 18 Aug 2021 08:52:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17I8q3Cu009912; Wed, 18 Aug 2021 08:52:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17I8q3as009911; Wed, 18 Aug 2021 08:52:03 GMT (envelope-from git) Date: Wed, 18 Aug 2021 08:52:03 GMT Message-Id: <202108180852.17I8q3as009911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 07edc89c393c - main - witness: remove ifnet_rw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 07edc89c393c1c4f09e0afe8e528f5d091f0ae04 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 08:52:04 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=07edc89c393c1c4f09e0afe8e528f5d091f0ae04 commit 07edc89c393c1c4f09e0afe8e528f5d091f0ae04 Author: Kristof Provost AuthorDate: 2021-08-17 10:56:11 +0000 Commit: Kristof Provost CommitDate: 2021-08-18 06:51:26 +0000 witness: remove ifnet_rw This lock no longer exists. It was removed in a60100fdfc10 (if: Remove ifnet_rwlock, 2020-11-25) Reviewed by: mjg Pointed out by: Dheeraj Kandula Different Revision: https://reviews.freebsd.org/D31585 --- sys/kern/subr_witness.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index c849a191bf16..e3fcbbb31311 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -541,7 +541,6 @@ static struct witness_order_list_entry order_lists[] = { { "udpinp", &lock_class_rw }, { "in_multi_list_mtx", &lock_class_mtx_sleep }, { "igmp_mtx", &lock_class_mtx_sleep }, - { "ifnet_rw", &lock_class_rw }, { "if_addr_lock", &lock_class_mtx_sleep }, { NULL, NULL }, /* @@ -552,7 +551,6 @@ static struct witness_order_list_entry order_lists[] = { { "udpinp", &lock_class_rw }, { "in6_multi_list_mtx", &lock_class_mtx_sleep }, { "mld_mtx", &lock_class_mtx_sleep }, - { "ifnet_rw", &lock_class_rw }, { "if_addr_lock", &lock_class_mtx_sleep }, { NULL, NULL }, /* From owner-dev-commits-src-main@freebsd.org Wed Aug 18 09:43:17 2021 Return-Path: Delivered-To: dev-commits-src-main@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 30B9F674CB7; Wed, 18 Aug 2021 09:43:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqNHn0kHGz3lYm; Wed, 18 Aug 2021 09:43:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00918730B; Wed, 18 Aug 2021 09:43:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17I9hGJ6077706; Wed, 18 Aug 2021 09:43:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17I9hGPh077705; Wed, 18 Aug 2021 09:43:16 GMT (envelope-from git) Date: Wed, 18 Aug 2021 09:43:16 GMT Message-Id: <202108180943.17I9hGPh077705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 8a46f021c240 - main - Make sure the uftdi(4) driver doesn't start a USB transfer when being cancelled. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a46f021c2408c82375a1f5127efb7ac6b78596e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 09:43:17 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8a46f021c2408c82375a1f5127efb7ac6b78596e commit 8a46f021c2408c82375a1f5127efb7ac6b78596e Author: Hans Petter Selasky AuthorDate: 2021-08-18 09:41:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-08-18 09:42:37 +0000 Make sure the uftdi(4) driver doesn't start a USB transfer when being cancelled. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/serial/uftdi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c index 9dc00e82253f..eaf4a9e78086 100644 --- a/sys/dev/usb/serial/uftdi.c +++ b/sys/dev/usb/serial/uftdi.c @@ -1212,14 +1212,9 @@ uftdi_write_callback(struct usb_xfer *xfer, usb_error_t error) DPRINTFN(3, "\n"); switch (USB_GET_STATE(xfer)) { - default: /* Error */ - if (error != USB_ERR_CANCELLED) { - /* try to clear stall first */ - usbd_xfer_set_stall(xfer); - } - /* FALLTHROUGH */ case USB_ST_SETUP: case USB_ST_TRANSFERRED: +tr_setup: if (usbd_xfer_get_and_clr_zlp(xfer)) break; @@ -1257,6 +1252,13 @@ uftdi_write_callback(struct usb_xfer *xfer, usb_error_t error) usbd_transfer_submit(xfer); } break; + default: /* Error */ + if (error != USB_ERR_CANCELLED) { + /* try to clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + break; } } From owner-dev-commits-src-main@freebsd.org Wed Aug 18 09:56:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8E9926752A1; Wed, 18 Aug 2021 09:56:38 +0000 (UTC) (envelope-from kp@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqNbB3gtkz3nMw; Wed, 18 Aug 2021 09:56:38 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 4CD4128FEB; Wed, 18 Aug 2021 09:56:38 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id CCA6C496AA; Wed, 18 Aug 2021 11:56:36 +0200 (CEST) From: "Kristof Provost" To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: a051ca72e281 - main - Introduce m_get3() Date: Wed, 18 Aug 2021 11:56:36 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <3C4C4BD6-CBD6-4A35-BA4B-13070DCDC448@FreeBSD.org> In-Reply-To: <202108180852.17I8q2Wl009885@gitrepo.freebsd.org> References: <202108180852.17I8q2Wl009885@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 09:56:38 -0000 On 18 Aug 2021, at 10:52, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3Da051ca72e2815b9bbba1e422f5abf= 22bc2a01551 > > commit a051ca72e2815b9bbba1e422f5abf22bc2a01551 > Author: Kristof Provost > AuthorDate: 2021-08-07 18:02:21 +0000 > Commit: Kristof Provost > CommitDate: 2021-08-18 06:48:27 +0000 > > Introduce m_get3() > > Introduce m_get3() which is similar to m_get2(), but can allocate = > up to > MJUM16BYTES bytes (m_get2() can only allocate up to MJUMPAGESIZE). > > This simplifies the bpf improvement in f13da24715. > Reviewed by: glebius, np But I accidentally pushed this along with the = 07edc89c393c1c4f09e0afe8e528f5d091f0ae04 before I added the tag. Kristof From owner-dev-commits-src-main@freebsd.org Wed Aug 18 15:26:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BADAC650F50; Wed, 18 Aug 2021 15:26:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqWw94mY2z4cf6; Wed, 18 Aug 2021 15:26:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8865A1395D; Wed, 18 Aug 2021 15:26:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17IFQnhV029506; Wed, 18 Aug 2021 15:26:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17IFQnch029505; Wed, 18 Aug 2021 15:26:49 GMT (envelope-from git) Date: Wed, 18 Aug 2021 15:26:49 GMT Message-Id: <202108181526.17IFQnch029505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: aec8ad8a9e6a - main - arm: hide busdma statistics behind ifdef ARM_BUSDMA_MAPLOAD_STATS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aec8ad8a9e6aba2d73c98bd41f2994744aae3d01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 15:26:49 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=aec8ad8a9e6aba2d73c98bd41f2994744aae3d01 commit aec8ad8a9e6aba2d73c98bd41f2994744aae3d01 Author: Mateusz Guzik AuthorDate: 2021-07-21 03:34:32 +0000 Commit: Mateusz Guzik CommitDate: 2021-08-18 15:24:53 +0000 arm: hide busdma statistics behind ifdef ARM_BUSDMA_MAPLOAD_STATS Stat collection using counter(9) is quite expensive on this platform and these counters are normally not needed. In particular we see about 1.5% bump in packet rate using Cortex-A9 Reviewed by: ian Sponsored by: Rubicon Communications, LLC ("Netgate") Different Revision: https://reviews.freebsd.org/D31592 --- sys/arm/arm/busdma_machdep.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index 7d978ca0163d..8a06e7245cd9 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$"); #include #include +//#define ARM_BUSDMA_MAPLOAD_STATS + #define BUSDMA_DCACHE_ALIGN cpuinfo.dcache_line_size #define BUSDMA_DCACHE_MASK cpuinfo.dcache_line_mask @@ -139,12 +141,14 @@ static uint32_t tags_total; static uint32_t maps_total; static uint32_t maps_dmamem; static uint32_t maps_coherent; +#ifdef ARM_BUSDMA_MAPLOAD_STATS static counter_u64_t maploads_total; static counter_u64_t maploads_bounced; static counter_u64_t maploads_coherent; static counter_u64_t maploads_dmamem; static counter_u64_t maploads_mbuf; static counter_u64_t maploads_physmem; +#endif static STAILQ_HEAD(, bounce_zone) bounce_zone_list; @@ -158,6 +162,7 @@ SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_dmamem, CTLFLAG_RD, &maps_dmamem, 0, "Number of active maps for bus_dmamem_alloc buffers"); SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_coherent, CTLFLAG_RD, &maps_coherent, 0, "Number of active maps with BUS_DMA_COHERENT flag set"); +#ifdef ARM_BUSDMA_MAPLOAD_STATS SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, &maploads_total, "Number of load operations performed"); SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_bounced, CTLFLAG_RD, @@ -170,6 +175,7 @@ SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_mbuf, CTLFLAG_RD, &maploads_mbuf, "Number of load operations for mbufs"); SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_physmem, CTLFLAG_RD, &maploads_physmem, "Number of load operations on physical buffers"); +#endif SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, "Total bounce pages"); @@ -222,12 +228,14 @@ busdma_init(void *dummy) { int uma_flags; +#ifdef ARM_BUSDMA_MAPLOAD_STATS maploads_total = counter_u64_alloc(M_WAITOK); maploads_bounced = counter_u64_alloc(M_WAITOK); maploads_coherent = counter_u64_alloc(M_WAITOK); maploads_dmamem = counter_u64_alloc(M_WAITOK); maploads_mbuf = counter_u64_alloc(M_WAITOK); maploads_physmem = counter_u64_alloc(M_WAITOK); +#endif uma_flags = 0; @@ -1058,13 +1066,17 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf, if (segs == NULL) segs = map->segments; +#ifdef ARM_BUSDMA_MAPLOAD_STATS counter_u64_add(maploads_total, 1); counter_u64_add(maploads_physmem, 1); +#endif if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { +#ifdef ARM_BUSDMA_MAPLOAD_STATS counter_u64_add(maploads_bounced, 1); +#endif error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); @@ -1143,24 +1155,30 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, struct sync_list *sl; int error; +#ifdef ARM_BUSDMA_MAPLOAD_STATS counter_u64_add(maploads_total, 1); if (map->flags & DMAMAP_COHERENT) counter_u64_add(maploads_coherent, 1); if (map->flags & DMAMAP_DMAMEM_ALLOC) counter_u64_add(maploads_dmamem, 1); +#endif if (segs == NULL) segs = map->segments; if (flags & BUS_DMA_LOAD_MBUF) { +#ifdef ARM_BUSDMA_MAPLOAD_STATS counter_u64_add(maploads_mbuf, 1); +#endif map->flags |= DMAMAP_MBUF; } if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { _bus_dmamap_count_pages(dmat, pmap, map, buf, buflen, flags); if (map->pagesneeded != 0) { +#ifdef ARM_BUSDMA_MAPLOAD_STATS counter_u64_add(maploads_bounced, 1); +#endif error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); From owner-dev-commits-src-main@freebsd.org Wed Aug 18 15:46:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6256A6517BF; Wed, 18 Aug 2021 15:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqXM82Q7hz4dMq; Wed, 18 Aug 2021 15:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B2D3141E2; Wed, 18 Aug 2021 15:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17IFkiYl057190; Wed, 18 Aug 2021 15:46:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17IFkica057189; Wed, 18 Aug 2021 15:46:44 GMT (envelope-from git) Date: Wed, 18 Aug 2021 15:46:44 GMT Message-Id: <202108181546.17IFkica057189@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 89c0d2b1906d - main - truncate(1): main() return statement style fix MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 89c0d2b1906d166478949398a361edb22553c855 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 15:46:44 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=89c0d2b1906d166478949398a361edb22553c855 commit 89c0d2b1906d166478949398a361edb22553c855 Author: Ka Ho Ng AuthorDate: 2021-08-18 15:45:20 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-18 15:45:59 +0000 truncate(1): main() return statement style fix Sponsored by: The FreeBSD Foundation --- usr.bin/truncate/truncate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/truncate/truncate.c b/usr.bin/truncate/truncate.c index 0f6c14b15c16..a7579227f299 100644 --- a/usr.bin/truncate/truncate.c +++ b/usr.bin/truncate/truncate.c @@ -175,7 +175,7 @@ main(int argc, char **argv) if (fd != -1) close(fd); - return error ? EXIT_FAILURE : EXIT_SUCCESS; + return (error ? EXIT_FAILURE : EXIT_SUCCESS); } static void From owner-dev-commits-src-main@freebsd.org Wed Aug 18 15:57:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B6DF3651BD4; Wed, 18 Aug 2021 15:57:02 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4GqXb24Ygbz4f7S; Wed, 18 Aug 2021 15:57:02 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f175.google.com with SMTP id h29so2752012ila.2; Wed, 18 Aug 2021 08:57:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QWdq6Uxlyxyukoh36bOcJfRur6ZhWx6ZS/ahvcGG6eY=; b=DZt2+EH3DaqHPJvBXP997ZV0jy9nH5SFBqqJtWUg0HiZr2eaEyNcrhH3hUPsPbH9nE viXIbwGe4U8u+tJ3q2whH9uMLrUgJOZVxnwBzf59369hxJfxpUbxbRDIi+xIUBKwubJd HHJ53mDxHkalN5sJiPWcBHM40rZyv0aVVjA8+qe3RxEl6LKpQsNbUTUFivTQ/pVJ26mY pn+JMBkLq0ePzjjE1+ujzBsIIfbFdPzsfL+JLMAIqqE5SUkq5OpjhDNcJ76uuI2hCJsz ykWEaX9NQBld8KD4hKGLx0yrl75J2gm+gXKC86UNjbWjo/YGu94rf0tKDHimRRdVGH0h OsNw== X-Gm-Message-State: AOAM5315+AYNveHDRVk/PXtGm3rzo6Hc85toq6TiQSSWAuCVSlxmAhVd qDsvCaa5zwdJq4+7vvyBUiDmn1texXzQ5ZjL8TzLARnI X-Google-Smtp-Source: ABdhPJyZb91gnDUTl1yH8tu01SOj8nM7L5RMaeSdIoNAvkqJJdpkqae8nLAUEgtV0f5t3Qm9qg91/RzFHDCkZFuWVF0= X-Received: by 2002:a92:2e12:: with SMTP id v18mr6641035ile.100.1629302215660; Wed, 18 Aug 2021 08:56:55 -0700 (PDT) MIME-Version: 1.0 References: <202108180625.17I6PJmQ010784@gitrepo.freebsd.org> In-Reply-To: <202108180625.17I6PJmQ010784@gitrepo.freebsd.org> From: Ed Maste Date: Wed, 18 Aug 2021 11:56:35 -0400 Message-ID: Subject: Re: git: e3500c602b13 - main - ipmi: fix negative logic in watchdog control flag To: Wojciech Macek Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GqXb24Ygbz4f7S X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 15:57:02 -0000 On Wed, 18 Aug 2021 at 02:25, Wojciech Macek wrote: > > The branch main has been updated by wma: > > URL: https://cgit.FreeBSD.org/src/commit/?id=e3500c602b13f8252eb8bb779849c41d47306cee > > commit e3500c602b13f8252eb8bb779849c41d47306cee > Author: Wojciech Macek > AuthorDate: 2021-08-18 06:21:14 +0000 > Commit: Wojciech Macek > CommitDate: 2021-08-18 06:21:14 +0000 > > ipmi: fix negative logic in watchdog control flag Thanks! Avoiding negative logic is something that has been passed on as developer lore but isn't documented in a particularly obvious way. Yesterday I made a very small change to sysctl.9 to try to make the note about -ve logic stand out, but in the coming days I will try to take a more holistic look at style.9 to make guidance on sysctl naming and values more clear. From owner-dev-commits-src-main@freebsd.org Wed Aug 18 17:07:16 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C9BD2652CA9; Wed, 18 Aug 2021 17:07:16 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4GqZ844r42z4kbC; Wed, 18 Aug 2021 17:07:16 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x82a.google.com with SMTP id x5so2072719qtq.13; Wed, 18 Aug 2021 10:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GzpDQvGxr2J3YK312J/Ok9TmG5F8UfDT12PkQIT3Rws=; b=A59I2k3SblTggwx1gQxwrYfeEqeq0eTSh3wovoD4BK/ifJgvuUFFUrjq38dHZgfXIr gg708Sv/noSH+sZMSQXyPwdyTtJav16z3cnIuvrhR+33QJvCVjFqUqV1xjU1o9KoYyaC IC0uRSa551zhBZAfN27PFoPECtgNMRQgUMW8yH3+mh9IT9PdwODshyFgZRzMM90oFi2v 3V7m9LC4fRIDMk8+9lyuUc+xQkBAd2xaB7OO/QtnTRdihqAehm8vyQNvbwGJ80EZeanZ h1pMJWbvQmYBi1MbAz30xVsP6eaBjoBZ89ju7xMBdeJgyuI+pvQMU7KHHXRW4VUG57I0 7qhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=GzpDQvGxr2J3YK312J/Ok9TmG5F8UfDT12PkQIT3Rws=; b=ZS5VfzOVGwr6AuCekNpkjiFRO+ufmDwDFim59oIpF5JkWOEfQg5GkcDI+Ioc350kaJ Q3jI07kfTsmJP9Q8LpPmwC9ZBPVwJ2a9H0QlhJMDA58EQEgcBAc9xVZffh2tcLMUvjx1 KCEwD0Qp/dp6t0t8FAXunAM0/i6/VNp7fSHcVGhoBSFbpt0+3PpwlqAzGjAEuo404uRc VCvyXBbAFMoE0HNJwdpAP5xdZvEugGNnLKVXj7lpGOt8+JDE5SO3quVaO2+LRAiIAgyL U73ug4MIwOK+8EVNmFF4iHuyVDJvttowSzQVGa+c8E7vK2RBdsN4BZWzCHBu6W5cObg7 BbPw== X-Gm-Message-State: AOAM532YZxSwMrsvz32a8UNDEACeOve82CO2C7fPdoLS1fySA4v9bNtj uznWcXF970459OBO/NnIkUkxH6lfXOA= X-Google-Smtp-Source: ABdhPJyv+TXxugj7Ya+61byJi47yqkLgbhTcbCEPqme7+lzqZwC/ecmanS5ZDrewybNcRvmyszM1Hg== X-Received: by 2002:aed:2149:: with SMTP id 67mr8486935qtc.60.1629306435513; Wed, 18 Aug 2021 10:07:15 -0700 (PDT) Received: from nuc ([142.126.162.193]) by smtp.gmail.com with ESMTPSA id k8sm260669qtp.14.2021.08.18.10.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 10:07:15 -0700 (PDT) Sender: Mark Johnston Date: Wed, 18 Aug 2021 13:07:17 -0400 From: Mark Johnston To: Mateusz Guzik Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: e0a17c3f063f - main - uipc: create dedicated lists for fast and slow timeout callbacks Message-ID: References: <202108171959.17HJx16Z069832@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202108171959.17HJx16Z069832@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4GqZ844r42z4kbC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 17:07:16 -0000 On Tue, Aug 17, 2021 at 07:59:01PM +0000, Mateusz Guzik wrote: > The branch main has been updated by mjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=e0a17c3f063fd51430fb2b4f5bc667f79d2967c2 > > commit e0a17c3f063fd51430fb2b4f5bc667f79d2967c2 > Author: Mateusz Guzik > AuthorDate: 2021-08-15 21:41:47 +0000 > Commit: Mateusz Guzik > CommitDate: 2021-08-17 19:56:05 +0000 > > uipc: create dedicated lists for fast and slow timeout callbacks > > This avoids having to walk all possible protocols only to check if they > have one (vast majority does not). > > Original patch by kevans@. > > Reviewed by: kevans > Sponsored by: Rubicon Communications, LLC ("Netgate") > --- > sys/kern/uipc_domain.c | 59 +++++++++++++++++++++++++++++++++++--------------- > sys/sys/protosw.h | 4 ++++ > 2 files changed, 46 insertions(+), 17 deletions(-) > > diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c > index b6aefec9556a..0946a2a75326 100644 > --- a/sys/kern/uipc_domain.c > +++ b/sys/kern/uipc_domain.c > @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -76,6 +77,14 @@ static struct callout pfslow_callout; > static void pffasttimo(void *); > static void pfslowtimo(void *); > > +static struct rmlock pftimo_lock; > +RM_SYSINIT(pftimo_lock, &pftimo_lock, "pftimo"); > + > +static LIST_HEAD(, protosw) pffast_list = > + LIST_HEAD_INITIALIZER(pffast_list); > +static LIST_HEAD(, protosw) pfslow_list = > + LIST_HEAD_INITIALIZER(pfslow_list); > + > struct domain *domains; /* registered protocol domains */ > int domain_init_status = 0; > static struct mtx dom_mtx; /* domain list lock */ > @@ -183,8 +192,16 @@ domain_init(void *arg) > ("Premature initialization of domain in non-default vnet")); > if (dp->dom_init) > (*dp->dom_init)(); > - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) > + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { > protosw_init(pr); > + rm_wlock(&pftimo_lock); > + if (pr->pr_fasttimo != NULL) > + LIST_INSERT_HEAD(&pffast_list, pr, pr_fasttimos); > + if (pr->pr_slowtimo != NULL) > + LIST_INSERT_HEAD(&pfslow_list, pr, pr_slowtimos); > + rm_wunlock(&pftimo_lock); I think this is wrong for VNETs: each time a VNET is created, vnet_domain_init() calls domain_init() and re-inserts the callbacks into the global list. This results in a circular list, so a softclock thread just invokes callbacks in an infinite loop. > + } > + > /* > * update global information about maximums > */ > @@ -387,6 +404,13 @@ pf_proto_register(int family, struct protosw *npr) > /* Copy the new struct protosw over the spacer. */ > bcopy(npr, fpr, sizeof(*fpr)); > > + rm_wlock(&pftimo_lock); > + if (fpr->pr_fasttimo != NULL) > + LIST_INSERT_HEAD(&pffast_list, fpr, pr_fasttimos); > + if (fpr->pr_slowtimo != NULL) > + LIST_INSERT_HEAD(&pfslow_list, fpr, pr_slowtimos); > + rm_wunlock(&pftimo_lock); > + > /* Job is done, no more protection required. */ > mtx_unlock(&dom_mtx); > > @@ -447,6 +471,13 @@ pf_proto_unregister(int family, int protocol, int type) > return (EPROTONOSUPPORT); > } > > + rm_wlock(&pftimo_lock); > + if (dpr->pr_fasttimo != NULL) > + LIST_REMOVE(dpr, pr_fasttimos); > + if (dpr->pr_slowtimo != NULL) > + LIST_REMOVE(dpr, pr_slowtimos); > + rm_wunlock(&pftimo_lock); > + > /* De-orbit the protocol and make the slot available again. */ > dpr->pr_type = 0; > dpr->pr_domain = dp; > @@ -483,39 +514,33 @@ pfctlinput(int cmd, struct sockaddr *sa) > static void > pfslowtimo(void *arg) > { > + struct rm_priotracker tracker; > struct epoch_tracker et; > - struct domain *dp; > struct protosw *pr; > > + rm_rlock(&pftimo_lock, &tracker); > NET_EPOCH_ENTER(et); > - for (dp = domains; dp; dp = dp->dom_next) { > - if ((atomic_load_int(&dp->dom_flags) & DOMF_INITED) == 0) > - continue; > - atomic_thread_fence_acq(); > - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) > - if (pr->pr_slowtimo) > - (*pr->pr_slowtimo)(); > + LIST_FOREACH(pr, &pfslow_list, pr_slowtimos) { > + (*pr->pr_slowtimo)(); > } > NET_EPOCH_EXIT(et); > + rm_runlock(&pftimo_lock, &tracker); > callout_reset(&pfslow_callout, hz/2, pfslowtimo, NULL); > } > > static void > pffasttimo(void *arg) > { > + struct rm_priotracker tracker; > struct epoch_tracker et; > - struct domain *dp; > struct protosw *pr; > > + rm_rlock(&pftimo_lock, &tracker); > NET_EPOCH_ENTER(et); > - for (dp = domains; dp; dp = dp->dom_next) { > - if ((atomic_load_int(&dp->dom_flags) & DOMF_INITED) == 0) > - continue; > - atomic_thread_fence_acq(); > - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) > - if (pr->pr_fasttimo) > - (*pr->pr_fasttimo)(); > + LIST_FOREACH(pr, &pffast_list, pr_fasttimos) { > + (*pr->pr_fasttimo)(); > } > NET_EPOCH_EXIT(et); > + rm_runlock(&pftimo_lock, &tracker); > callout_reset(&pffast_callout, hz/5, pffasttimo, NULL); > } > diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h > index 5c2fa2d4077e..a929544501f4 100644 > --- a/sys/sys/protosw.h > +++ b/sys/sys/protosw.h > @@ -35,6 +35,8 @@ > #ifndef _SYS_PROTOSW_H_ > #define _SYS_PROTOSW_H_ > > +#include > + > /* Forward declare these structures referenced from prototypes below. */ > struct kaiocb; > struct mbuf; > @@ -93,6 +95,8 @@ struct protosw { > pr_drain_t *pr_drain; /* flush any excess space possible */ > > struct pr_usrreqs *pr_usrreqs; /* user-protocol hook */ > + LIST_ENTRY(protosw) pr_fasttimos; > + LIST_ENTRY(protosw) pr_slowtimos; > }; > /*#endif*/ > > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.org" From owner-dev-commits-src-main@freebsd.org Wed Aug 18 17:08:55 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7909A652E73; Wed, 18 Aug 2021 17:08:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqZ9z333Kz4ktC; Wed, 18 Aug 2021 17:08:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D01015294; Wed, 18 Aug 2021 17:08:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17IH8tkn064614; Wed, 18 Aug 2021 17:08:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17IH8trx064613; Wed, 18 Aug 2021 17:08:55 GMT (envelope-from git) Date: Wed, 18 Aug 2021 17:08:55 GMT Message-Id: <202108181708.17IH8trx064613@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: bb250fae9e9e - main - gre: simplify RSS ifdefs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb250fae9e9e278b681cf3a71ced718700ecf74c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 17:08:55 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bb250fae9e9e278b681cf3a71ced718700ecf74c commit bb250fae9e9e278b681cf3a71ced718700ecf74c Author: Franco Fichtner AuthorDate: 2021-08-18 17:05:29 +0000 Commit: Kevin Bowling CommitDate: 2021-08-18 17:05:29 +0000 gre: simplify RSS ifdefs Use the early break to avoid else definitions. When RSS gains a runtime option previous constructs would duplicate and convolute the existing code. While here init flowid and skip magic numbers and late default assignment. Reviewed by: melifaro, kbowling Obtained from: OPNsense MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31584 --- sys/net/if_gre.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index aa3e4062b060..19014f9fd3de 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -643,46 +643,37 @@ gre_setseqn(struct grehdr *gh, uint32_t seq) static uint32_t gre_flowid(struct gre_softc *sc, struct mbuf *m, uint32_t af) { - uint32_t flowid; + uint32_t flowid = 0; if ((sc->gre_options & GRE_UDPENCAP) == 0 || sc->gre_port != 0) - return (0); -#ifndef RSS - switch (af) { -#ifdef INET - case AF_INET: - flowid = mtod(m, struct ip *)->ip_src.s_addr ^ - mtod(m, struct ip *)->ip_dst.s_addr; - break; -#endif -#ifdef INET6 - case AF_INET6: - flowid = mtod(m, struct ip6_hdr *)->ip6_src.s6_addr32[3] ^ - mtod(m, struct ip6_hdr *)->ip6_dst.s6_addr32[3]; - break; -#endif - default: - flowid = 0; - } -#else /* RSS */ + return (flowid); switch (af) { #ifdef INET case AF_INET: +#ifdef RSS flowid = rss_hash_ip4_2tuple(mtod(m, struct ip *)->ip_src, mtod(m, struct ip *)->ip_dst); break; +#endif + flowid = mtod(m, struct ip *)->ip_src.s_addr ^ + mtod(m, struct ip *)->ip_dst.s_addr; + break; #endif #ifdef INET6 case AF_INET6: +#ifdef RSS flowid = rss_hash_ip6_2tuple( &mtod(m, struct ip6_hdr *)->ip6_src, &mtod(m, struct ip6_hdr *)->ip6_dst); break; +#endif + flowid = mtod(m, struct ip6_hdr *)->ip6_src.s6_addr32[3] ^ + mtod(m, struct ip6_hdr *)->ip6_dst.s6_addr32[3]; + break; #endif default: - flowid = 0; + break; } -#endif return (flowid); } From owner-dev-commits-src-main@freebsd.org Wed Aug 18 17:16:04 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B2730652B1C; Wed, 18 Aug 2021 17:16:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqZLD4ffDz4lMg; Wed, 18 Aug 2021 17:16:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87E7C153AD; Wed, 18 Aug 2021 17:16:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17IHG4V2077372; Wed, 18 Aug 2021 17:16:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17IHG4Ca077371; Wed, 18 Aug 2021 17:16:04 GMT (envelope-from git) Date: Wed, 18 Aug 2021 17:16:04 GMT Message-Id: <202108181716.17IHG4Ca077371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 0a539a0f005e - main - dhclient: support supersede statement for option 54 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a539a0f005e8acbe4974ede30aa928099c988b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 17:16:04 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0a539a0f005e8acbe4974ede30aa928099c988b9 commit 0a539a0f005e8acbe4974ede30aa928099c988b9 Author: Fabian Kurtz AuthorDate: 2021-08-18 17:12:48 +0000 Commit: Kevin Bowling CommitDate: 2021-08-18 17:15:28 +0000 dhclient: support supersede statement for option 54 PR: 217978 Reported by: Franco Fichtner Reviewed by: markj Obtained from: OPNsense MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31503 --- sbin/dhclient/dhclient.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 8c2615e4c3dc..a1628f0ee22f 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -931,6 +931,8 @@ void state_bound(void *ipp) { struct interface_info *ip = ipp; + u_int8_t *dp = NULL; + int len; ASSERT_STATE(state, S_BOUND); @@ -938,10 +940,17 @@ state_bound(void *ipp) make_request(ip, ip->client->active); ip->client->xid = ip->client->packet.xid; - if (ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len == 4) { - memcpy(ip->client->destination.iabuf, ip->client->active-> - options[DHO_DHCP_SERVER_IDENTIFIER].data, 4); - ip->client->destination.len = 4; + if (ip->client->config->default_actions[DHO_DHCP_SERVER_IDENTIFIER] == + ACTION_SUPERSEDE) { + dp = ip->client->config->defaults[DHO_DHCP_SERVER_IDENTIFIER].data; + len = ip->client->config->defaults[DHO_DHCP_SERVER_IDENTIFIER].len; + } else { + dp = ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].data; + len = ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len; + } + if (len == 4) { + memcpy(ip->client->destination.iabuf, dp, len); + ip->client->destination.len = len; } else ip->client->destination = iaddr_broadcast; From owner-dev-commits-src-main@freebsd.org Wed Aug 18 17:21:27 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7A783653227; Wed, 18 Aug 2021 17:21:27 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqZSR31Vqz4pDp; Wed, 18 Aug 2021 17:21:27 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (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 491572CA18; Wed, 18 Aug 2021 17:21:27 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f43.google.com with SMTP id dt3so2061643qvb.6; Wed, 18 Aug 2021 10:21:27 -0700 (PDT) X-Gm-Message-State: AOAM533+NsppPVUSHhKmXKPWh/rRpgUHEt6KwG8zCOcIcrGgJ/e5erSg xDm8W4pCIq0Q+FJH8t9V+mSjICmJm/i7Ka2LkwU= X-Google-Smtp-Source: ABdhPJy9yfAQgfZCgWKqDNr4G6kPGOGRduzYLpWVpRJw6Bd3uUJ2HJvQCoRojlXeFaVBIpyrBO88MV7YkASvTKyFNLY= X-Received: by 2002:a05:6214:892:: with SMTP id cz18mr10023416qvb.60.1629307286791; Wed, 18 Aug 2021 10:21:26 -0700 (PDT) MIME-Version: 1.0 References: <202108171959.17HJx16Z069832@gitrepo.freebsd.org> In-Reply-To: From: Kyle Evans Date: Wed, 18 Aug 2021 12:21:13 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: e0a17c3f063f - main - uipc: create dedicated lists for fast and slow timeout callbacks To: Mark Johnston Cc: Mateusz Guzik , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 17:21:27 -0000 On Wed, Aug 18, 2021 at 12:07 PM Mark Johnston wrote: > > On Tue, Aug 17, 2021 at 07:59:01PM +0000, Mateusz Guzik wrote: > > The branch main has been updated by mjg: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=e0a17c3f063fd51430fb2b4f5bc667f79d2967c2 > > > > commit e0a17c3f063fd51430fb2b4f5bc667f79d2967c2 > > Author: Mateusz Guzik > > AuthorDate: 2021-08-15 21:41:47 +0000 > > Commit: Mateusz Guzik > > CommitDate: 2021-08-17 19:56:05 +0000 > > > > uipc: create dedicated lists for fast and slow timeout callbacks > > > > This avoids having to walk all possible protocols only to check if they > > have one (vast majority does not). > > > > Original patch by kevans@. > > > > Reviewed by: kevans > > Sponsored by: Rubicon Communications, LLC ("Netgate") > > --- > > sys/kern/uipc_domain.c | 59 +++++++++++++++++++++++++++++++++++--------------- > > sys/sys/protosw.h | 4 ++++ > > 2 files changed, 46 insertions(+), 17 deletions(-) > > > > diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c > > index b6aefec9556a..0946a2a75326 100644 > > --- a/sys/kern/uipc_domain.c > > +++ b/sys/kern/uipc_domain.c > > @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > #include > > > > @@ -76,6 +77,14 @@ static struct callout pfslow_callout; > > static void pffasttimo(void *); > > static void pfslowtimo(void *); > > > > +static struct rmlock pftimo_lock; > > +RM_SYSINIT(pftimo_lock, &pftimo_lock, "pftimo"); > > + > > +static LIST_HEAD(, protosw) pffast_list = > > + LIST_HEAD_INITIALIZER(pffast_list); > > +static LIST_HEAD(, protosw) pfslow_list = > > + LIST_HEAD_INITIALIZER(pfslow_list); > > + > > struct domain *domains; /* registered protocol domains */ > > int domain_init_status = 0; > > static struct mtx dom_mtx; /* domain list lock */ > > @@ -183,8 +192,16 @@ domain_init(void *arg) > > ("Premature initialization of domain in non-default vnet")); > > if (dp->dom_init) > > (*dp->dom_init)(); > > - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) > > + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { > > protosw_init(pr); > > + rm_wlock(&pftimo_lock); > > + if (pr->pr_fasttimo != NULL) > > + LIST_INSERT_HEAD(&pffast_list, pr, pr_fasttimos); > > + if (pr->pr_slowtimo != NULL) > > + LIST_INSERT_HEAD(&pfslow_list, pr, pr_slowtimos); > > + rm_wunlock(&pftimo_lock); > > I think this is wrong for VNETs: each time a VNET is created, > vnet_domain_init() calls domain_init() and re-inserts the callbacks into > the global list. This results in a circular list, so a softclock thread > just invokes callbacks in an infinite loop. > The latest version I have locally gated this segment behind IS_DEFAULT_VNET(curvnet), but it appears that I hadn't updated the previous review and forgot about it... I'll fix it? From owner-dev-commits-src-main@freebsd.org Wed Aug 18 17:39:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A79B865347E; Wed, 18 Aug 2021 17:39:50 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqZsf48RXz4pm9; Wed, 18 Aug 2021 17:39:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.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 E56652C544; Wed, 18 Aug 2021 17:39:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: a051ca72e281 - main - Introduce m_get3() To: Kristof Provost , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202108180852.17I8q2Wl009885@gitrepo.freebsd.org> Cc: Navdeep Parhar From: John Baldwin Message-ID: Date: Wed, 18 Aug 2021 10:39:45 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <202108180852.17I8q2Wl009885@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 17:39:50 -0000 On 8/18/21 1:52 AM, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=a051ca72e2815b9bbba1e422f5abf22bc2a01551 > > commit a051ca72e2815b9bbba1e422f5abf22bc2a01551 > Author: Kristof Provost > AuthorDate: 2021-08-07 18:02:21 +0000 > Commit: Kristof Provost > CommitDate: 2021-08-18 06:48:27 +0000 > > Introduce m_get3() > > Introduce m_get3() which is similar to m_get2(), but can allocate up to > MJUM16BYTES bytes (m_get2() can only allocate up to MJUMPAGESIZE). > > This simplifies the bpf improvement in f13da24715. > > Suggested by: glebius > Differential Revision: https://reviews.freebsd.org/D31455 Hmm, if this looped the way m_getm2() does I could use this in icl_cxgbei_conn_pdu_append_data() in sys/dev/cxgbe/cxgbei/icl_cxgbei.c where the code currently allocates 16k jumbo's by hand and then uses m_getm2() for the trailer. One almost wants a variant of m_getm*() where you can give an explicit "max cluster size" perhaps instead of having to know the magic implicit sizes for m_getm2 vs m_getm3. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Wed Aug 18 17:44:04 2021 Return-Path: Delivered-To: dev-commits-src-main@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 643F4653AA6; Wed, 18 Aug 2021 17:44:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqZyX2CQ3z4qC4; Wed, 18 Aug 2021 17:44:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33F58155D1; Wed, 18 Aug 2021 17:44:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17IHi4IE017258; Wed, 18 Aug 2021 17:44:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17IHi4ub017257; Wed, 18 Aug 2021 17:44:04 GMT (envelope-from git) Date: Wed, 18 Aug 2021 17:44:04 GMT Message-Id: <202108181744.17IHi4ub017257@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a85404906bc8 - main - vmm: Add credential to cdev object MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a85404906bc8f402318524b4ccd196712fc09fbd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 17:44:04 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a85404906bc8f402318524b4ccd196712fc09fbd commit a85404906bc8f402318524b4ccd196712fc09fbd Author: Cyril Zhang AuthorDate: 2021-08-18 17:41:33 +0000 Commit: Mark Johnston CommitDate: 2021-08-18 17:41:33 +0000 vmm: Add credential to cdev object Add a credential to the cdev object in sysctl_vmm_create(), then check that we have the correct credentials in sysctl_vmm_destroy(). This prevents a process in one jail from opening or destroying the /dev/vmm file corresponding to a VM in a sibling jail. Add regression tests. Reviewed by: jhb, markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31156 --- etc/mtree/BSD.tests.dist | 2 ++ sys/amd64/vmm/vmm_dev.c | 15 ++++++-- tests/sys/Makefile | 1 + tests/sys/vmm/Makefile | 11 ++++++ tests/sys/vmm/utils.subr | 47 +++++++++++++++++++++++++ tests/sys/vmm/vmm_cred_jail.sh | 80 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 154 insertions(+), 2 deletions(-) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 60cdca439887..f7965dac2884 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -866,6 +866,8 @@ .. vm .. + vmm + .. .. usr.bin apply diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c index 2da6225fdddd..2ce9470cf6dd 100644 --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -80,6 +80,7 @@ struct devmem_softc { struct vmmdev_softc { struct vm *vm; /* vm instance cookie */ struct cdev *cdev; + struct ucred *ucred; SLIST_ENTRY(vmmdev_softc) link; SLIST_HEAD(, devmem_softc) devmem; int flags; @@ -182,6 +183,12 @@ vmmdev_lookup(const char *name) break; } + if (sc == NULL) + return (NULL); + + if (cr_cansee(curthread->td_ucred, sc->ucred)) + return (NULL); + return (sc); } @@ -979,6 +986,9 @@ vmmdev_destroy(void *arg) if (sc->vm != NULL) vm_destroy(sc->vm); + if (sc->ucred != NULL) + crfree(sc->ucred); + if ((sc->flags & VSC_LINKED) != 0) { mtx_lock(&vmmdev_mtx); SLIST_REMOVE(&head, sc, vmmdev_softc, link); @@ -1096,6 +1106,7 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) goto out; sc = malloc(sizeof(struct vmmdev_softc), M_VMMDEV, M_WAITOK | M_ZERO); + sc->ucred = crhold(curthread->td_ucred); sc->vm = vm; SLIST_INIT(&sc->devmem); @@ -1117,8 +1128,8 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) goto out; } - error = make_dev_p(MAKEDEV_CHECKNAME, &cdev, &vmmdevsw, NULL, - UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf); + error = make_dev_p(MAKEDEV_CHECKNAME, &cdev, &vmmdevsw, sc->ucred, + UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf); if (error != 0) { vmmdev_destroy(sc); goto out; diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 2781f7fb4ded..2ba60f41b76c 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -31,6 +31,7 @@ TESTS_SUBDIRS+= posixshm TESTS_SUBDIRS+= sys TESTS_SUBDIRS+= vfs TESTS_SUBDIRS+= vm +TESTS_SUBDIRS+= vmm .if ${MK_AUDIT} != "no" _audit= audit diff --git a/tests/sys/vmm/Makefile b/tests/sys/vmm/Makefile new file mode 100644 index 000000000000..544d98421a95 --- /dev/null +++ b/tests/sys/vmm/Makefile @@ -0,0 +1,11 @@ +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/vmm + +BINDIR= ${TESTSDIR} + +ATF_TESTS_SH+= vmm_cred_jail + +${PACKAGE}FILES+= utils.subr + +.include diff --git a/tests/sys/vmm/utils.subr b/tests/sys/vmm/utils.subr new file mode 100644 index 000000000000..0de9c6c671ea --- /dev/null +++ b/tests/sys/vmm/utils.subr @@ -0,0 +1,47 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 The FreeBSD Foundation +# +# This software was developed by Cyril Zhang under sponsorship from +# the FreeBSD Foundation. +# +# 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. +# + +vmm_mkjail() +{ + jailname=$1 + jail -c name=${jailname} persist allow.vmm + echo $jailname >> created_jails.lst +} +vmm_cleanup() +{ + if [ -f created_jails.lst ] + then + for jailname in `cat created_jails.lst` + do + jail -r ${jailname} + done + rm created_jails.lst + fi +} diff --git a/tests/sys/vmm/vmm_cred_jail.sh b/tests/sys/vmm/vmm_cred_jail.sh new file mode 100644 index 000000000000..5dcb30e628c2 --- /dev/null +++ b/tests/sys/vmm/vmm_cred_jail.sh @@ -0,0 +1,80 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 The FreeBSD Foundation +# +# This software was developed by Cyril Zhang under sponsorship from +# the FreeBSD Foundation. +# +# 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. +# + +. $(atf_get_srcdir)/utils.subr + +atf_test_case vmm_cred_jail_host cleanup +vmm_cred_jail_host_head() +{ + atf_set "descr" "Tests deleting the host's VM from within a jail" + atf_set "require.user" "root" +} +vmm_cred_jail_host_body() +{ + if ! kldstat -qn vmm; then + atf_skip "vmm is not loaded" + fi + bhyvectl --vm=testvm --create + vmm_mkjail myjail + atf_check -s exit:1 -e ignore jexec myjail bhyvectl --vm=testvm --destroy +} +vmm_cred_jail_host_cleanup() +{ + bhyvectl --vm=testvm --destroy + vmm_cleanup +} + +atf_test_case vmm_cred_jail_other cleanup +vmm_cred_jail_other_head() +{ + atf_set "descr" "Tests deleting a jail's VM from within another jail" + atf_set "require.user" "root" +} +vmm_cred_jail_other_body() +{ + if ! kldstat -qn vmm; then + atf_skip "vmm is not loaded" + fi + vmm_mkjail myjail1 + vmm_mkjail myjail2 + atf_check -s exit:0 jexec myjail1 bhyvectl --vm=testvm --create + atf_check -s exit:1 -e ignore jexec myjail2 bhyvectl --vm=testvm --destroy +} +vmm_cred_jail_other_cleanup() +{ + bhyvectl --vm=testvm --destroy + vmm_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case vmm_cred_jail_host + atf_add_test_case vmm_cred_jail_other +} From owner-dev-commits-src-main@freebsd.org Wed Aug 18 17:54:01 2021 Return-Path: Delivered-To: dev-commits-src-main@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 67FCC653A48; Wed, 18 Aug 2021 17:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqbB12DJ8z4r45; Wed, 18 Aug 2021 17:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34BEA15A58; Wed, 18 Aug 2021 17:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17IHs161030990; Wed, 18 Aug 2021 17:54:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17IHs1Ub030989; Wed, 18 Aug 2021 17:54:01 GMT (envelope-from git) Date: Wed, 18 Aug 2021 17:54:01 GMT Message-Id: <202108181754.17IHs1Ub030989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d7e1bdfebacc - main - uipc: avoid circular pr_{slow,fast}timos MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7e1bdfebacc4de25dc51e14a91d66bb429677c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 17:54:01 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d7e1bdfebacc4de25dc51e14a91d66bb429677c9 commit d7e1bdfebacc4de25dc51e14a91d66bb429677c9 Author: Kyle Evans AuthorDate: 2021-08-18 17:31:45 +0000 Commit: Kyle Evans CommitDate: 2021-08-18 17:46:54 +0000 uipc: avoid circular pr_{slow,fast}timos domain_init() gets reinvoked for each vnet on a system, so we must not alter global state. Practically speaking, we were creating circular lists and tying up a softclock thread into an infinite loop. The breakage here was most easily observed by simply creating a jail in a new vnet and watching the system suddenly become erratic. Reported by: markj Fixes: e0a17c3f063f ("uipc: create dedicated lists for fast ...") Pointy hat: kevans --- sys/kern/uipc_domain.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 0946a2a75326..d572e0ec19db 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -194,12 +194,23 @@ domain_init(void *arg) (*dp->dom_init)(); for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { protosw_init(pr); - rm_wlock(&pftimo_lock); - if (pr->pr_fasttimo != NULL) - LIST_INSERT_HEAD(&pffast_list, pr, pr_fasttimos); - if (pr->pr_slowtimo != NULL) - LIST_INSERT_HEAD(&pfslow_list, pr, pr_slowtimos); - rm_wunlock(&pftimo_lock); + + /* + * Note that with VIMAGE enabled, domain_init() will be + * re-invoked for each new vnet that's created. The below lists + * are intended to be system-wide, so avoid altering global + * state for non-default vnets. + */ + if (IS_DEFAULT_VNET(curvnet)) { + rm_wlock(&pftimo_lock); + if (pr->pr_fasttimo != NULL) + LIST_INSERT_HEAD(&pffast_list, pr, + pr_fasttimos); + if (pr->pr_slowtimo != NULL) + LIST_INSERT_HEAD(&pfslow_list, pr, + pr_slowtimos); + rm_wunlock(&pftimo_lock); + } } /* From owner-dev-commits-src-main@freebsd.org Wed Aug 18 17:55:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AF455653D28 for ; Wed, 18 Aug 2021 17:55:02 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqbCB4SZRz4r6w for ; Wed, 18 Aug 2021 17:55:02 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 7CFF02C977 for ; Wed, 18 Aug 2021 17:55:02 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f177.google.com with SMTP id m21so3931530qkm.13 for ; Wed, 18 Aug 2021 10:55:02 -0700 (PDT) X-Gm-Message-State: AOAM532ZldvXVRJNnQH3doivxPqUtIfCXUxRqkxQWmvtwuW6o7J2m4/6 KweAlKhRklJnKNp+oSzwf8mHNLsy7pL+mk1b2tc= X-Received: by 2002:a37:a58b:: with SMTP id o133mt11334822qke.120.1629309302075; Wed, 18 Aug 2021 10:55:02 -0700 (PDT) MIME-Version: 1.0 References: <202108181754.17IHs1Ub030989@gitrepo.freebsd.org> In-Reply-To: <202108181754.17IHs1Ub030989@gitrepo.freebsd.org> From: Kyle Evans Date: Wed, 18 Aug 2021 12:54:49 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d7e1bdfebacc - main - uipc: avoid circular pr_{slow, fast}timos Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 17:55:02 -0000 On Wed, Aug 18, 2021 at 12:54 PM Kyle Evans wrote: > > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d7e1bdfebacc4de25dc51e14a91d66bb429677c9 > > commit d7e1bdfebacc4de25dc51e14a91d66bb429677c9 > Author: Kyle Evans > AuthorDate: 2021-08-18 17:31:45 +0000 > Commit: Kyle Evans > CommitDate: 2021-08-18 17:46:54 +0000 > > uipc: avoid circular pr_{slow,fast}timos > This should read "avoid circular pf{fast,slow}_list", sorry. > domain_init() gets reinvoked for each vnet on a system, so we must not > alter global state. Practically speaking, we were creating circular > lists and tying up a softclock thread into an infinite loop. > > The breakage here was most easily observed by simply creating a jail > in a new vnet and watching the system suddenly become erratic. > > Reported by: markj > Fixes: e0a17c3f063f ("uipc: create dedicated lists for fast ...") > Pointy hat: kevans > --- > sys/kern/uipc_domain.c | 23 +++++++++++++++++------ > 1 file changed, 17 insertions(+), 6 deletions(-) > > diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c > index 0946a2a75326..d572e0ec19db 100644 > --- a/sys/kern/uipc_domain.c > +++ b/sys/kern/uipc_domain.c > @@ -194,12 +194,23 @@ domain_init(void *arg) > (*dp->dom_init)(); > for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { > protosw_init(pr); > - rm_wlock(&pftimo_lock); > - if (pr->pr_fasttimo != NULL) > - LIST_INSERT_HEAD(&pffast_list, pr, pr_fasttimos); > - if (pr->pr_slowtimo != NULL) > - LIST_INSERT_HEAD(&pfslow_list, pr, pr_slowtimos); > - rm_wunlock(&pftimo_lock); > + > + /* > + * Note that with VIMAGE enabled, domain_init() will be > + * re-invoked for each new vnet that's created. The below lists > + * are intended to be system-wide, so avoid altering global > + * state for non-default vnets. > + */ > + if (IS_DEFAULT_VNET(curvnet)) { > + rm_wlock(&pftimo_lock); > + if (pr->pr_fasttimo != NULL) > + LIST_INSERT_HEAD(&pffast_list, pr, > + pr_fasttimos); > + if (pr->pr_slowtimo != NULL) > + LIST_INSERT_HEAD(&pfslow_list, pr, > + pr_slowtimos); > + rm_wunlock(&pftimo_lock); > + } > } > > /* From owner-dev-commits-src-main@freebsd.org Wed Aug 18 18:05:33 2021 Return-Path: Delivered-To: dev-commits-src-main@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 83C9E654634; Wed, 18 Aug 2021 18:05:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqbRK3BNJz4rfk; Wed, 18 Aug 2021 18:05:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4786316066; Wed, 18 Aug 2021 18:05:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17II5Xs8045677; Wed, 18 Aug 2021 18:05:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17II5XqV045676; Wed, 18 Aug 2021 18:05:33 GMT (envelope-from git) Date: Wed, 18 Aug 2021 18:05:33 GMT Message-Id: <202108181805.17II5XqV045676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c261b6ea4e2e - main - iscsi: Teach the iSCSI stack about "large" received PDUs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c261b6ea4e2ef1fc6a446443ee594ad76f392350 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 18:05:33 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c261b6ea4e2ef1fc6a446443ee594ad76f392350 commit c261b6ea4e2ef1fc6a446443ee594ad76f392350 Author: John Baldwin AuthorDate: 2021-08-18 17:56:28 +0000 Commit: John Baldwin CommitDate: 2021-08-18 17:56:28 +0000 iscsi: Teach the iSCSI stack about "large" received PDUs. When using iSCSI PDU offload (cxgbei) on T6 adapters, a burst of received PDUs can be reported via a single message to the driver. Previously the driver passed these multi-PDU bursts up to the iSCSI stack up as a single "large" PDU by rewriting the buffer offset, data segment length, and DataSN fields in the iSCSI header. The DataSN field in particular was rewritten so that each of the "large" PDUs used consecutively increasing values. While this worked, the forged DataSN values did not match the ExpDataSN value in the subsequent SCSI Response PDU. The initiator does not currently verify this value, but the forged DataSN values prevent adding a check. To avoid this, allow a logical iSCSI PDU (struct icl_pdu) to describe a burst of PDUs via a new 'ip_additional_pdus' field. Normally this field is set to zero when 'struct icl_pdu' represents a single PDU. If logical PDU represents a burst of on-the-wire PDUs, then 'ip_npdus' contains the count of additional on-the-wire PDUs. The header of this "large" PDU is still modified, but the DataSN field now contains the DataSN value of the first on-the-wire PDU in the burst. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31577 --- sys/cam/ctl/ctl_frontend_iscsi.c | 2 +- sys/dev/cxgbe/cxgbei/cxgbei.c | 18 +++++++++++------- sys/dev/cxgbe/cxgbei/cxgbei.h | 1 - sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 1 - sys/dev/iscsi/icl.h | 8 ++++++++ 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index b8fafcea69ed..0cbe3bcefc73 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -917,7 +917,7 @@ cfiscsi_pdu_handle_data_out(struct icl_pdu *request) cfiscsi_session_terminate(cs); return; } - cdw->cdw_datasn++; + cdw->cdw_datasn += request->ip_additional_pdus + 1; io = cdw->cdw_ctl_io; KASSERT((io->io_hdr.flags & CTL_FLAG_DATA_MASK) != CTL_FLAG_DATA_IN, diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 8dc580d65770..6af7043460fb 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -583,10 +583,12 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) cmp->next_buffer_offset; if (prev_seg_len != 0) { + uint32_t orig_datasn; + /* - * Since cfiscsi doesn't know about previous - * headers, pretend that the entire r2t data - * length was received in this single segment. + * Return a "large" PDU representing the burst + * of PDUs. Adjust the offset and length of + * this PDU to represent the entire burst. */ ip->ip_data_len += prev_seg_len; bhsdo->bhsdo_data_segment_len[2] = ip->ip_data_len; @@ -595,17 +597,19 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) bhsdo->bhsdo_buffer_offset = htobe32(cmp->next_buffer_offset); - npdus = htobe32(bhsdo->bhsdo_datasn) - cmp->last_datasn; + orig_datasn = htobe32(bhsdo->bhsdo_datasn); + npdus = orig_datasn - cmp->last_datasn; + bhsdo->bhsdo_datasn = htobe32(cmp->last_datasn + 1); + cmp->last_datasn = orig_datasn; + ip->ip_additional_pdus = npdus - 1; } else { MPASS(htobe32(bhsdo->bhsdo_datasn) == cmp->last_datasn + 1); npdus = 1; + cmp->last_datasn = htobe32(bhsdo->bhsdo_datasn); } cmp->next_buffer_offset += ip->ip_data_len; - cmp->last_datasn = htobe32(bhsdo->bhsdo_datasn); - bhsdo->bhsdo_datasn = htobe32(cmp->next_datasn); - cmp->next_datasn++; toep->ofld_rxq->rx_iscsi_ddp_pdus += npdus; toep->ofld_rxq->rx_iscsi_ddp_octets += ip->ip_data_len; } else { diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 20754fa893a8..09d556988091 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -58,7 +58,6 @@ struct cxgbei_cmp { uint32_t tt; /* Transfer tag. */ - uint32_t next_datasn; uint32_t next_buffer_offset; uint32_t last_datasn; }; diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index a6e7f8b95815..687fc545cebd 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -1346,7 +1346,6 @@ no_ddp: prsv->prsv_tag &= ~pr->pr_alias_mask; prsv->prsv_tag |= alias << pr->pr_alias_shift & pr->pr_alias_mask; - ddp->cmp.next_datasn = 0; ddp->cmp.last_datasn = -1; cxgbei_insert_cmp(icc, &ddp->cmp, prsv->prsv_tag); *tttp = htobe32(prsv->prsv_tag); diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index bd12569a8957..07dcbbf2a0b5 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -75,6 +75,14 @@ struct icl_pdu { size_t ip_data_len; struct mbuf *ip_data_mbuf; + /* + * When a "large" received PDU represents multiple on-the-wire + * PDUs, this is the count of additional on-the-wire PDUs. + * For PDUs that match on-the-wire PDUs, this should be set to + * zero. + */ + u_int ip_additional_pdus; + /* * User (initiator or provider) private fields. */ From owner-dev-commits-src-main@freebsd.org Wed Aug 18 21:21:01 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BEEE06562F3; Wed, 18 Aug 2021 21:21:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gqgms55VRz3L4r; Wed, 18 Aug 2021 21:21:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 971C318AC1; Wed, 18 Aug 2021 21:21:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17ILL1Qb010177; Wed, 18 Aug 2021 21:21:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17ILL1Oa010176; Wed, 18 Aug 2021 21:21:01 GMT (envelope-from git) Date: Wed, 18 Aug 2021 21:21:01 GMT Message-Id: <202108182121.17ILL1Oa010176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: c7cf100aafb4 - main - geli(8): Do not report error on resize to the same size. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7cf100aafb4cb881e05a5153de152907f6c07f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 21:21:01 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c7cf100aafb4cb881e05a5153de152907f6c07f3 commit c7cf100aafb4cb881e05a5153de152907f6c07f3 Author: Alexander Motin AuthorDate: 2021-08-18 21:11:03 +0000 Commit: Alexander Motin CommitDate: 2021-08-18 21:11:03 +0000 geli(8): Do not report error on resize to the same size. Just validate the old metadata and exit. Originally the check was added to not thash the only copy of metadata, but we can achieve the same just by skipping the writing/trashing. The metadata validation should protect user from wrongly specifying new size instead of old. MFC after: 1 month Sponsored by: iXsystems, Inc. --- lib/geom/eli/geom_eli.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/geom/eli/geom_eli.c b/lib/geom/eli/geom_eli.c index 8ee4643e3c91..4c04a9256b5e 100644 --- a/lib/geom/eli/geom_eli.c +++ b/lib/geom/eli/geom_eli.c @@ -1823,10 +1823,6 @@ eli_resize(struct gctl_req *req) gctl_error(req, "Invalid oldsize: Out of range."); goto out; } - if (oldsize == mediasize) { - gctl_error(req, "Size hasn't changed."); - goto out; - } /* Read metadata from the 'oldsize' offset. */ if (pread(provfd, sector, secsize, oldsize - secsize) != secsize) { @@ -1865,6 +1861,10 @@ eli_resize(struct gctl_req *req) goto out; } + /* The metadata is valid and nothing has changed. Just exit. */ + if (oldsize == mediasize) + goto out; + /* * Update the old metadata with the current provider size and write * it back to the correct place on the provider. From owner-dev-commits-src-main@freebsd.org Wed Aug 18 22:33:46 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0F5BC657F20; Wed, 18 Aug 2021 22:33:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqjNn6r4Lz3PQP; Wed, 18 Aug 2021 22:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2C2019A42; Wed, 18 Aug 2021 22:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17IMXjMp007620; Wed, 18 Aug 2021 22:33:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17IMXjhI007619; Wed, 18 Aug 2021 22:33:45 GMT (envelope-from git) Date: Wed, 18 Aug 2021 22:33:45 GMT Message-Id: <202108182233.17IMXjhI007619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: eba8e643b19c - main - sctp: improve handling of INIT chunks with invalid parameters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eba8e643b19cb7acd7c9a79acfab376b3967f20d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 22:33:46 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=eba8e643b19cb7acd7c9a79acfab376b3967f20d commit eba8e643b19cb7acd7c9a79acfab376b3967f20d Author: Michael Tuexen AuthorDate: 2021-08-18 22:31:35 +0000 Commit: Michael Tuexen CommitDate: 2021-08-18 22:33:28 +0000 sctp: improve handling of INIT chunks with invalid parameters MFC after: 3 days --- sys/netinet/sctp_input.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index ed15b81ba3e5..66ec2d6a577a 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -86,7 +86,7 @@ static void sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_init_chunk *cp, struct sctp_inpcb *inp, - struct sctp_tcb *stcb, struct sctp_nets *net, int *abort_no_unlock, + struct sctp_tcb *stcb, struct sctp_nets *net, uint8_t mflowtype, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { @@ -100,17 +100,17 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, } /* Validate parameters */ init = &cp->init; - if ((ntohl(init->initiate_tag) == 0) || - (ntohl(init->a_rwnd) < SCTP_MIN_RWND) || + if (ntohl(init->initiate_tag) == 0) { + goto outnow; + } + if ((ntohl(init->a_rwnd) < SCTP_MIN_RWND) || (ntohs(init->num_inbound_streams) == 0) || (ntohs(init->num_outbound_streams) == 0)) { /* protocol error... send abort */ op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, ""); - sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err, - mflowtype, mflowid, + sctp_send_abort(m, iphlen, src, dst, sh, init->initiate_tag, op_err, + mflowtype, mflowid, inp->fibnum, vrf_id, port); - if (stcb) - *abort_no_unlock = 1; goto outnow; } if (sctp_validate_init_auth_params(m, offset + sizeof(*cp), @@ -118,11 +118,9 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, /* auth parameter(s) error... send abort */ op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Problem with AUTH parameters"); - sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err, - mflowtype, mflowid, + sctp_send_abort(m, iphlen, src, dst, sh, init->initiate_tag, op_err, + mflowtype, mflowid, inp->fibnum, vrf_id, port); - if (stcb) - *abort_no_unlock = 1; goto outnow; } /* We are only accepting if we have a listening socket. */ @@ -4613,20 +4611,22 @@ process_control_chunks: /* Honor our resource limit. */ if (chk_length > SCTP_LARGEST_INIT_ACCEPTED) { op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, ""); - sctp_abort_association(inp, stcb, m, iphlen, - src, dst, sh, op_err, - mflowtype, mflowid, + sctp_send_abort(m, iphlen, src, dst, sh, 0, op_err, + mflowtype, mflowid, inp->fibnum, vrf_id, port); *offset = length; + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } return (NULL); } sctp_handle_init(m, iphlen, *offset, src, dst, sh, (struct sctp_init_chunk *)ch, inp, - stcb, *netp, &abort_no_unlock, + stcb, *netp, mflowtype, mflowid, vrf_id, port); *offset = length; - if ((!abort_no_unlock) && (stcb != NULL)) { + if (stcb != NULL) { SCTP_TCB_UNLOCK(stcb); } return (NULL); From owner-dev-commits-src-main@freebsd.org Thu Aug 19 04:58:59 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AF25465D7AE; Thu, 19 Aug 2021 04:58:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqsxH3LJ8z3Csj; Thu, 19 Aug 2021 04:58:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B8FF1F373; Thu, 19 Aug 2021 04:58:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17J4wx7A014248; Thu, 19 Aug 2021 04:58:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17J4wxDY014247; Thu, 19 Aug 2021 04:58:59 GMT (envelope-from git) Date: Thu, 19 Aug 2021 04:58:59 GMT Message-Id: <202108190458.17J4wxDY014247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 35b253d9d238 - main - sh: fix NO_HISTORY build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35b253d9d238c46a710a0cd7ba027ec87ba7c8ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 04:58:59 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=35b253d9d238c46a710a0cd7ba027ec87ba7c8ba commit 35b253d9d238c46a710a0cd7ba027ec87ba7c8ba Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-18 20:40:39 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-08-19 04:57:06 +0000 sh: fix NO_HISTORY build Move code added in b315a7296d2a ("autocomplete commands") to conditionally compiled part under #ifndef NO_HISTORY. Reported by: bdrewery Fixes: b315a7296d2a --- bin/sh/histedit.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 596145790f31..bd82016c33cb 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -565,27 +565,6 @@ bindcmd(int argc, char **argv) return ret; } -#else -#include "error.h" - -int -histcmd(int argc __unused, char **argv __unused) -{ - - error("not compiled with history support"); - /*NOTREACHED*/ - return (0); -} - -int -bindcmd(int argc __unused, char **argv __unused) -{ - - error("not compiled with line editing support"); - return (0); -} -#endif - /* * Comparator function for qsort(). The use of curpos here is to skip * characters that we already know to compare equal (common prefix). @@ -706,3 +685,24 @@ sh_complete(EditLine *sel, int ch __unused) L" \t\n\"\\'`@$><=;|&{(", NULL, NULL, (size_t)100, NULL, &((int) {0}), NULL, NULL, FN_QUOTE_MATCH); } + +#else +#include "error.h" + +int +histcmd(int argc __unused, char **argv __unused) +{ + + error("not compiled with history support"); + /*NOTREACHED*/ + return (0); +} + +int +bindcmd(int argc __unused, char **argv __unused) +{ + + error("not compiled with line editing support"); + return (0); +} +#endif From owner-dev-commits-src-main@freebsd.org Thu Aug 19 09:46:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9B86A661D91; Thu, 19 Aug 2021 09:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr0KJ3l1Xz4XK2; Thu, 19 Aug 2021 09:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6819A2333D; Thu, 19 Aug 2021 09:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17J9kiho002592; Thu, 19 Aug 2021 09:46:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17J9kimE002591; Thu, 19 Aug 2021 09:46:44 GMT (envelope-from git) Date: Thu, 19 Aug 2021 09:46:44 GMT Message-Id: <202108190946.17J9kimE002591@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 20ffd88ed54f - main - ipfw: use unsigned int for dummynet bandwidth MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20ffd88ed54fe3fd098ac30bd221275b2a14f52c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 09:46:44 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=20ffd88ed54fe3fd098ac30bd221275b2a14f52c commit 20ffd88ed54fe3fd098ac30bd221275b2a14f52c Author: Luiz Otavio O Souza AuthorDate: 2021-08-17 07:54:40 +0000 Commit: Kristof Provost CommitDate: 2021-08-19 08:48:53 +0000 ipfw: use unsigned int for dummynet bandwidth This allows the maximum value of 4294967295 (~4Gb/s) instead of previous value of 2147483647 (~2Gb/s). Reviewed by: np, scottl Obtained from: pfSense MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31582 --- sbin/ipfw/dummynet.c | 13 +++++++------ sys/netinet/ip_dummynet.h | 4 ++-- sys/netpfil/ipfw/ip_dn_glue.c | 4 ++-- sys/netpfil/ipfw/ip_dn_io.c | 3 ++- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/sbin/ipfw/dummynet.c b/sbin/ipfw/dummynet.c index 24d835fbb98e..88367694a404 100644 --- a/sbin/ipfw/dummynet.c +++ b/sbin/ipfw/dummynet.c @@ -23,6 +23,7 @@ */ #define NEW_AQM +#include #include #include /* XXX there are several sysctl leftover here */ @@ -794,9 +795,9 @@ is_valid_number(const char *s) * set clocking interface or bandwidth value */ static void -read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen) +read_bandwidth(char *arg, uint32_t *bandwidth, char *if_name, int namelen) { - if (*bandwidth != -1) + if (*bandwidth != (uint32_t)-1) warnx("duplicate token, override bandwidth value!"); if (arg[0] >= 'a' && arg[0] <= 'z') { @@ -810,7 +811,7 @@ read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen) strlcpy(if_name, arg, namelen); *bandwidth = 0; } else { /* read bandwidth value */ - int bw; + uint64_t bw; char *end = NULL; bw = strtoul(arg, &end, 0); @@ -829,10 +830,10 @@ read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen) _substrcmp2(end, "by", "bytes") == 0) bw *= 8; - if (bw < 0) + if (bw > UINT_MAX) errx(EX_DATAERR, "bandwidth too large"); - *bandwidth = bw; + *bandwidth = (uint32_t)bw; if (if_name) if_name[0] = '\0'; } @@ -1737,7 +1738,7 @@ end_mask: if (p) { if (p->delay > 10000) errx(EX_DATAERR, "delay must be < 10000"); - if (p->bandwidth == -1) + if (p->bandwidth == (uint32_t)-1) p->bandwidth = 0; } if (fs) { diff --git a/sys/netinet/ip_dummynet.h b/sys/netinet/ip_dummynet.h index de38ed9fbedf..533dc5ccd85f 100644 --- a/sys/netinet/ip_dummynet.h +++ b/sys/netinet/ip_dummynet.h @@ -131,7 +131,7 @@ struct dn_link { * XXX what about burst ? */ int32_t link_nr; - int bandwidth; /* bit/s or bits/tick. */ + uint32_t bandwidth; /* bit/s or bits/tick. */ int delay; /* ms and ticks */ uint64_t burst; /* scaled. bits*Hz XXX */ }; @@ -214,7 +214,7 @@ struct dn_profile { char name[ED_MAX_NAME_LEN]; int link_nr; int loss_level; - int bandwidth; // XXX use link bandwidth? + uint32_t bandwidth; // XXX use link bandwidth? int samples_no; /* actual len of samples[] */ int samples[ED_MAX_SAMPLES_NO]; /* may be shorter */ }; diff --git a/sys/netpfil/ipfw/ip_dn_glue.c b/sys/netpfil/ipfw/ip_dn_glue.c index e035fedaaf91..a690aa0290d7 100644 --- a/sys/netpfil/ipfw/ip_dn_glue.c +++ b/sys/netpfil/ipfw/ip_dn_glue.c @@ -166,7 +166,7 @@ struct dn_pipe7 { /* a pipe */ SLIST_ENTRY(dn_pipe7) next; /* linked list in a hash slot */ int pipe_nr ; /* number */ - int bandwidth; /* really, bytes/tick. */ + uint32_t bandwidth; /* really, bytes/tick. */ int delay ; /* really, ticks */ struct mbuf *head, *tail ; /* packets in delay line */ @@ -231,7 +231,7 @@ struct dn_pipe8 { /* a pipe */ SLIST_ENTRY(dn_pipe8) next; /* linked list in a hash slot */ int pipe_nr ; /* number */ - int bandwidth; /* really, bytes/tick. */ + uint32_t bandwidth; /* really, bytes/tick. */ int delay ; /* really, ticks */ struct mbuf *head, *tail ; /* packets in delay line */ diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index 11357b44e05e..dad5cb087b39 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -591,7 +591,8 @@ serve_sched(struct mq *q, struct dn_sch_inst *si, uint64_t now) struct dn_schk *s = si->sched; struct mbuf *m = NULL; int delay_line_idle = (si->dline.mq.head == NULL); - int done, bw; + int done; + uint32_t bw; if (q == NULL) { q = &def_q; From owner-dev-commits-src-main@freebsd.org Thu Aug 19 09:46:46 2021 Return-Path: Delivered-To: dev-commits-src-main@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 18F8A661EB9; Thu, 19 Aug 2021 09:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr0KK4qJKz4X8D; Thu, 19 Aug 2021 09:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A133232AE; Thu, 19 Aug 2021 09:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17J9kjkk002616; Thu, 19 Aug 2021 09:46:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17J9kjuh002615; Thu, 19 Aug 2021 09:46:45 GMT (envelope-from git) Date: Thu, 19 Aug 2021 09:46:45 GMT Message-Id: <202108190946.17J9kjuh002615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c138424148f9 - main - lagg: don't update link layer addresses on destroy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c138424148f900dc449c757869453120ae3277f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 09:46:46 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c138424148f900dc449c757869453120ae3277f3 commit c138424148f900dc449c757869453120ae3277f3 Author: Luiz Otavio O Souza AuthorDate: 2021-08-17 14:23:50 +0000 Commit: Kristof Provost CommitDate: 2021-08-19 08:49:32 +0000 lagg: don't update link layer addresses on destroy When the lagg is being destroyed it is not necessary update the lladdr of all the lagg members every time we update the primary interface. Reviewed by: scottl Obtained from: pfSense MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31586 --- sys/net/if_lagg.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 9a3c22789fa5..c53e5b283b76 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -969,14 +969,16 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport) bcopy(lladdr, IF_LLADDR(sc->sc_ifp), sc->sc_ifp->if_addrlen); lagg_proto_lladdr(sc); EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); - } - /* - * Update lladdr for each port (new primary needs update - * as well, to switch from old lladdr to its 'real' one) - */ - CK_SLIST_FOREACH(lp_ptr, &sc->sc_ports, lp_entries) - if_setlladdr(lp_ptr->lp_ifp, lladdr, lp_ptr->lp_ifp->if_addrlen); + /* + * Update lladdr for each port (new primary needs update + * as well, to switch from old lladdr to its 'real' one). + * We can skip this if the lagg is being destroyed. + */ + CK_SLIST_FOREACH(lp_ptr, &sc->sc_ports, lp_entries) + if_setlladdr(lp_ptr->lp_ifp, lladdr, + lp_ptr->lp_ifp->if_addrlen); + } } if (lp->lp_ifflags) From owner-dev-commits-src-main@freebsd.org Thu Aug 19 10:08:24 2021 Return-Path: Delivered-To: dev-commits-src-main@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 CD30466256A; Thu, 19 Aug 2021 10:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr0pJ5BdHz4Yc7; Thu, 19 Aug 2021 10:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A40623854; Thu, 19 Aug 2021 10:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JA8OSG031467; Thu, 19 Aug 2021 10:08:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JA8OnT031466; Thu, 19 Aug 2021 10:08:24 GMT (envelope-from git) Date: Thu, 19 Aug 2021 10:08:24 GMT Message-Id: <202108191008.17JA8OnT031466@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 0a7d1fc6f632 - main - pf: implement set-tos for IPv6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a7d1fc6f6324e62458e72546cc06ac8c76c494b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 10:08:24 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0a7d1fc6f6324e62458e72546cc06ac8c76c494b commit 0a7d1fc6f6324e62458e72546cc06ac8c76c494b Author: Samuel Robinette AuthorDate: 2021-08-15 18:26:41 +0000 Commit: Kristof Provost CommitDate: 2021-08-19 08:07:56 +0000 pf: implement set-tos for IPv6 Extend the existing set-tos keyword to also be able to set traffic class on IPv6 traffic. Add tests for this as well. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D31564 --- sys/netpfil/pf/pf_norm.c | 12 +++-- tests/sys/netpfil/common/pft_ping.py | 29 +++++++++++- tests/sys/netpfil/pf/set_tos.sh | 88 ++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 4 deletions(-) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index e9674d21ec5a..796d445607e7 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -157,7 +157,7 @@ static int pf_reassemble(struct mbuf **, struct ip *, int, u_short *); #ifdef INET6 static int pf_reassemble6(struct mbuf **, struct ip6_hdr *, struct ip6_frag *, uint16_t, uint16_t, u_short *); -static void pf_scrub_ip6(struct mbuf **, uint8_t); +static void pf_scrub_ip6(struct mbuf **, uint32_t, uint8_t, uint8_t); #endif /* INET6 */ #define DPFPRINTF(x) do { \ @@ -1283,7 +1283,7 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kkif *kif, if (sizeof(struct ip6_hdr) + plen > m->m_pkthdr.len) goto shortpkt; - pf_scrub_ip6(&m, r->min_ttl); + pf_scrub_ip6(&m, r->rule_flag, r->min_ttl, r->set_tos); return (PF_PASS); @@ -2032,7 +2032,7 @@ pf_scrub_ip(struct mbuf **m0, u_int32_t flags, u_int8_t min_ttl, u_int8_t tos) #ifdef INET6 static void -pf_scrub_ip6(struct mbuf **m0, u_int8_t min_ttl) +pf_scrub_ip6(struct mbuf **m0, u_int32_t flags, u_int8_t min_ttl, u_int8_t tos) { struct mbuf *m = *m0; struct ip6_hdr *h = mtod(m, struct ip6_hdr *); @@ -2040,5 +2040,11 @@ pf_scrub_ip6(struct mbuf **m0, u_int8_t min_ttl) /* Enforce a minimum ttl, may cause endless packet loops */ if (min_ttl && h->ip6_hlim < min_ttl) h->ip6_hlim = min_ttl; + + /* Enforce tos. Set traffic class bits */ + if (flags & PFRULE_SET_TOS) { + h->ip6_flow &= IPV6_FLOWLABEL_MASK | IPV6_VERSION_MASK; + h->ip6_flow |= htonl((tos | IPV6_ECN(h)) << 20); + } } #endif diff --git a/tests/sys/netpfil/common/pft_ping.py b/tests/sys/netpfil/common/pft_ping.py index 9cc7c5d5c5c0..9ed6a00cab34 100644 --- a/tests/sys/netpfil/common/pft_ping.py +++ b/tests/sys/netpfil/common/pft_ping.py @@ -115,6 +115,14 @@ def check_ping6_request(args, packet): if icmp.data != PAYLOAD_MAGIC: return False + # Wait to check expectations until we've established this is the packet we + # sent. + if args.expect_tc: + if ip.tc != int(args.expect_tc[0]): + print("Unexpected traffic class value %d, expected %d" \ + % (ip.tc, int(args.expect_tc[0]))) + return False + return True def check_ping_reply(args, packet): @@ -147,6 +155,12 @@ def check_ping4_reply(args, packet): if raw.load != PAYLOAD_MAGIC: return False + if args.expect_tos: + if ip.tos != int(args.expect_tos[0]): + print("Unexpected ToS value %d, expected %d" \ + % (ip.tos, int(args.expect_tos[0]))) + return False + return True def check_ping6_reply(args, packet): @@ -170,6 +184,12 @@ def check_ping6_reply(args, packet): print("data mismatch") return False + if args.expect_tc: + if ip.tc != int(args.expect_tc[0]): + print("Unexpected traffic class value %d, expected %d" \ + % (ip.tc, int(args.expect_tc[0]))) + return False + return True def ping(send_if, dst_ip, args): @@ -192,8 +212,11 @@ def ping6(send_if, dst_ip, args): ip6 = sp.IPv6(dst=dst_ip) icmp = sp.ICMPv6EchoRequest(data=sp.raw(PAYLOAD_MAGIC)) + if args.send_tc: + ip6.tc = int(args.send_tc[0]) + if args.fromaddr: - ip.src = args.fromaddr[0] + ip6.src = args.fromaddr[0] req = ether / ip6 / icmp sp.sendp(req, iface=send_if, verbose=False) @@ -274,10 +297,14 @@ def main(): # Packet settings parser.add_argument('--send-tos', nargs=1, help='Set the ToS value for the transmitted packet') + parser.add_argument('--send-tc', nargs=1, + help='Set the traffic class value for the transmitted packet') # Expectations parser.add_argument('--expect-tos', nargs=1, help='The expected ToS value in the received packet') + parser.add_argument('--expect-tc', nargs=1, + help='The expected traffic class value in the received packet') args = parser.parse_args() diff --git a/tests/sys/netpfil/pf/set_tos.sh b/tests/sys/netpfil/pf/set_tos.sh index 55d0059aa133..2dbca54a1ee9 100644 --- a/tests/sys/netpfil/pf/set_tos.sh +++ b/tests/sys/netpfil/pf/set_tos.sh @@ -4,6 +4,8 @@ # # Copyright (c) 2017 Kristof Provost # +# Copyright (c) 2021 Samuel Robinette +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: @@ -114,7 +116,93 @@ v4_cleanup() pft_cleanup } +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'set-tos6 test' + atf_set require.user root + + # We need scapy to be installed for out test scripts to work + atf_set require.progs scapy +} + +v6_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a inet6 add 2001:db8:192::1 + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b inet6 add 2001:db8:192::2 + + route -6 add 2001:db8:192::2 2001:db8:192::1 + jexec alcatraz route -6 add 2001:db8:192::1 2001:db8:192::2 + + jexec alcatraz pfctl -e + + # No change is done if not requested + pft_set_rules alcatraz "scrub out proto ipv6-icmp" + atf_check -s exit:1 -o ignore -e ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8:192::2 \ + --replyif ${epair}a \ + --expect-tc 42 + + # The requested ToS is set + pft_set_rules alcatraz "scrub out proto ipv6-icmp set-tos 42" + atf_check -s exit:0 -o ignore -e ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8:192::2 \ + --replyif ${epair}a \ + --expect-tc 42 + + # ToS is not changed if the scrub rule does not match + pft_set_rules alcatraz "scrub out from 2001:db8:192::3 set-tos 42" + atf_check -s exit:1 -o ignore -e ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8:192::2 \ + --replyif ${epair}a \ + --expect-tc 42 + + # Multiple scrub rules match as expected + pft_set_rules alcatraz "scrub out from 2001:db8:192::3 set-tos 13" \ + "scrub out proto ipv6-icmp set-tos 14" + atf_check -s exit:0 -o ignore -e ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8:192::2 \ + --replyif ${epair}a \ + --expect-tc 14 + + # And this works even if the packet already has ToS values set + atf_check -s exit:0 -o ignore -e ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8:192::2 \ + --replyif ${epair}a \ + --send-tc 42 \ + --expect-tc 14 + + # ToS values are unmolested if the packets do not match a scrub rule + pft_set_rules alcatraz "scrub out from 2001:db8:192::3 set-tos 13" + atf_check -s exit:0 -o ignore -e ignore ${common_dir}/pft_ping.py \ + --ip6 \ + --sendif ${epair}a \ + --to 2001:db8:192::2 \ + --replyif ${epair}a \ + --expect-tc 0 +} + +v6_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" + atf_add_test_case "v6" } From owner-dev-commits-src-main@freebsd.org Thu Aug 19 10:31:43 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B394866269C; Thu, 19 Aug 2021 10:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr1KC4ZrBz4Zxl; Thu, 19 Aug 2021 10:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AD8423BB8; Thu, 19 Aug 2021 10:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JAVhW0067448; Thu, 19 Aug 2021 10:31:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JAVhdJ067447; Thu, 19 Aug 2021 10:31:43 GMT (envelope-from git) Date: Thu, 19 Aug 2021 10:31:43 GMT Message-Id: <202108191031.17JAVhdJ067447@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 78267c2e703c - main - md: Replace BIO_DELETE emulation with vn_deallocate(9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 78267c2e703c236d37692da77a4ee92da9502943 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 10:31:43 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=78267c2e703c236d37692da77a4ee92da9502943 commit 78267c2e703c236d37692da77a4ee92da9502943 Author: Ka Ho Ng AuthorDate: 2021-08-19 10:30:13 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-19 10:30:13 +0000 md: Replace BIO_DELETE emulation with vn_deallocate(9) Both zero-filling and/or deallocation can be done with vn_deallocate(9). Sponsored by: The FreeBSD Foundation Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D28899 --- sys/dev/md/md.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index c5c90d9173ad..1627ee2e5fa6 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -875,7 +875,7 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) struct buf *pb; bus_dma_segment_t *vlist; struct thread *td; - off_t iolen, iostart, len, zerosize; + off_t iolen, iostart, off, len; int ma_offs, npages; switch (bp->bio_cmd) { @@ -883,9 +883,9 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) auio.uio_rw = UIO_READ; break; case BIO_WRITE: - case BIO_DELETE: auio.uio_rw = UIO_WRITE; break; + case BIO_DELETE: case BIO_FLUSH: break; default: @@ -897,6 +897,7 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) pb = NULL; piov = NULL; ma_offs = bp->bio_ma_offset; + off = bp->bio_offset; len = bp->bio_length; /* @@ -914,6 +915,11 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) VOP_UNLOCK(vp); vn_finished_write(mp); return (error); + } else if (bp->bio_cmd == BIO_DELETE) { + error = vn_deallocate(vp, &off, &len, 0, + sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred, NOCRED); + bp->bio_resid = len; + return (error); } auio.uio_offset = (vm_ooffset_t)bp->bio_offset; @@ -921,25 +927,7 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) auio.uio_segflg = UIO_SYSSPACE; auio.uio_td = td; - if (bp->bio_cmd == BIO_DELETE) { - /* - * Emulate BIO_DELETE by writing zeros. - */ - zerosize = ZERO_REGION_SIZE - - (ZERO_REGION_SIZE % sc->sectorsize); - auio.uio_iovcnt = howmany(bp->bio_length, zerosize); - piov = malloc(sizeof(*piov) * auio.uio_iovcnt, M_MD, M_WAITOK); - auio.uio_iov = piov; - while (len > 0) { - piov->iov_base = __DECONST(void *, zero_region); - piov->iov_len = len; - if (len > zerosize) - piov->iov_len = zerosize; - len -= piov->iov_len; - piov++; - } - piov = auio.uio_iov; - } else if ((bp->bio_flags & BIO_VLIST) != 0) { + if ((bp->bio_flags & BIO_VLIST) != 0) { piov = malloc(sizeof(*piov) * bp->bio_ma_n, M_MD, M_WAITOK); auio.uio_iov = piov; vlist = (bus_dma_segment_t *)bp->bio_data; From owner-dev-commits-src-main@freebsd.org Thu Aug 19 10:31:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D85FA662B16; Thu, 19 Aug 2021 10:31:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr1KD5YgLz4bQK; Thu, 19 Aug 2021 10:31:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9980E23D2C; Thu, 19 Aug 2021 10:31:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JAViiC067472; Thu, 19 Aug 2021 10:31:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JAViPg067471; Thu, 19 Aug 2021 10:31:44 GMT (envelope-from git) Date: Thu, 19 Aug 2021 10:31:44 GMT Message-Id: <202108191031.17JAViPg067471@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 5ee2c35751ef - main - truncate(1): Add hole-punching support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ee2c35751ef5d131222423bf3e25073f997c337 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 10:31:45 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=5ee2c35751ef5d131222423bf3e25073f997c337 commit 5ee2c35751ef5d131222423bf3e25073f997c337 Author: Ka Ho Ng AuthorDate: 2021-08-19 10:30:41 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-19 10:30:41 +0000 truncate(1): Add hole-punching support This commit adds hole-punching support to the truncate(1) utility. If the option -d is specified, truncate(1) performs zeroing, and if possible hole-punching in case the operation is supported by the underlying file system of the specified files. Sponsored by: The FreeBSD Foundation Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31556 --- usr.bin/truncate/truncate.1 | 63 +++++++++++++++++++++++++++++++----- usr.bin/truncate/truncate.c | 79 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 115 insertions(+), 27 deletions(-) diff --git a/usr.bin/truncate/truncate.1 b/usr.bin/truncate/truncate.1 index 2058530162c5..54780ccbca83 100644 --- a/usr.bin/truncate/truncate.1 +++ b/usr.bin/truncate/truncate.1 @@ -1,6 +1,10 @@ .\" .\" Copyright (c) 2000 Sheldon Hearn . .\" All rights reserved. +.\" Copyright (c) 2021 The FreeBSD Foundation +.\" +.\" Portions of this manual page were written by Ka Ho Ng +.\" under sponsorship from the FreeBSD Foundation. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -25,12 +29,12 @@ .\" .\" $FreeBSD$ .\" -.Dd July 27, 2020 +.Dd August 18, 2021 .Dt TRUNCATE 1 .Os .Sh NAME .Nm truncate -.Nd truncate or extend the length of files +.Nd truncate, extend the length of files, or perform space management in files .Sh SYNOPSIS .Nm .Op Fl c @@ -39,7 +43,7 @@ .Sm off .Op Cm + | - | % | / .Ar size -.Op Cm K | k | M | m | G | g | T | t +.Op Cm SUFFIX .Sm on .Xc .Ek @@ -50,10 +54,32 @@ .Fl r Ar rfile .Ek .Ar +.Nm +.Op Fl c +.Bk -words +.Fl d +.Oo +.Fl o Xo +.Sm off +.Ar offset +.Op Cm SUFFIX +.Sm on +.Xc +.Oc +.Fl l Xo +.Sm off +.Ar length +.Op Cm SUFFIX +.Sm on +.Xc +.Ek +.Ar .Sh DESCRIPTION The .Nm -utility adjusts the length of each regular file given on the command-line. +utility adjusts the length of each regular file given on the command-line, or +performs space management with the given offset and the length over a regular +file given on the command-line. .Pp The following options are available: .Bl -tag -width indent @@ -71,7 +97,7 @@ Truncate or extend files to the length of the file .Sm off .Op Cm + | - | % | / .Ar size -.Op Cm K | k | M | m | G | g | T | t +.Op Cm SUFFIX .Sm on .Xc If the @@ -100,10 +126,28 @@ Otherwise, the .Ar size argument specifies an absolute length to which all files should be extended or reduced as appropriate. +.It Fl d +Zero a region in the specified file. +If the underlying file system of the given file supports hole-punching, +file system space deallocation may be performed in the operation region. +.It Fl o Ar offset +The space management operation is performed at the given +.Ar offset +bytes in the file. +If this option is not specified, the operation is performed at the beginning of the file. +.It Fl l Ar length +The length of the operation range in bytes. +This option must always be specified if option +.Fl d +is specified, and must be greater than 0. +.El .Pp The -.Ar size -argument may be suffixed with one of +.Ar size , +.Ar offset +and +.Ar length +arguments may be suffixed with one of .Cm K , .Cm M , .Cm G @@ -112,7 +156,6 @@ or (either upper or lower case) to indicate a multiple of Kilobytes, Megabytes, Gigabytes or Terabytes respectively. -.El .Pp Exactly one of the .Fl r @@ -183,6 +226,7 @@ ls -l test_file* .Sh SEE ALSO .Xr dd 1 , .Xr touch 1 , +.Xr fspacectl 2 , .Xr truncate 2 .Sh STANDARDS The @@ -198,3 +242,6 @@ The .Nm utility was written by .An Sheldon Hearn Aq Mt sheldonh@starjuice.net . +Hole-punching support of this +utility was developed by +.An Ka Ho Ng Aq Mt khng@FreeBSD.org . diff --git a/usr.bin/truncate/truncate.c b/usr.bin/truncate/truncate.c index a7579227f299..529d2c7e6dab 100644 --- a/usr.bin/truncate/truncate.c +++ b/usr.bin/truncate/truncate.c @@ -4,6 +4,11 @@ * Copyright (c) 2000 Sheldon Hearn . * All rights reserved. * + * Copyright (c) 2021 The FreeBSD Foundation + * + * Portions of this software were developed by Ka Ho Ng + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -49,26 +54,36 @@ main(int argc, char **argv) { struct stat sb; mode_t omode; - off_t oflow, rsize, sz, tsize, round; + off_t oflow, rsize, sz, tsize, round, off, len; uint64_t usz; - int ch, error, fd, oflags; + int ch, error, fd, oflags, r; + int do_dealloc; + int do_truncate; int no_create; int do_relative; int do_round; int do_refer; int got_size; char *fname, *rname; + struct spacectl_range sr; fd = -1; - rsize = tsize = sz = 0; - no_create = do_relative = do_round = do_refer = got_size = 0; - error = 0; + rsize = tsize = sz = off = 0; + len = -1; + do_dealloc = no_create = do_relative = do_round = do_refer = + got_size = 0; + do_truncate = 1; + error = r = 0; rname = NULL; - while ((ch = getopt(argc, argv, "cr:s:")) != -1) + while ((ch = getopt(argc, argv, "cdr:s:o:l:")) != -1) switch (ch) { case 'c': no_create = 1; break; + case 'd': + do_dealloc = 1; + do_truncate = 0; + break; case 'r': do_refer = 1; rname = optarg; @@ -89,6 +104,22 @@ main(int argc, char **argv) -(off_t)usz : (off_t)usz; got_size = 1; break; + case 'o': + if (expand_number(optarg, &usz) == -1 || + (off_t)usz < 0) + errx(EXIT_FAILURE, + "invalid offset argument `%s'", optarg); + + off = usz; + break; + case 'l': + if (expand_number(optarg, &usz) == -1 || + (off_t)usz <= 0) + errx(EXIT_FAILURE, + "invalid length argument `%s'", optarg); + + len = usz; + break; default: usage(); /* NOTREACHED */ @@ -98,19 +129,22 @@ main(int argc, char **argv) argc -= optind; /* - * Exactly one of do_refer or got_size must be specified. Since - * do_relative implies got_size, do_relative and do_refer are - * also mutually exclusive. See usage() for allowed invocations. + * Exactly one of do_refer, got_size or do_dealloc must be specified. + * Since do_relative implies got_size, do_relative, do_refer and + * do_dealloc are also mutually exclusive. If do_dealloc is specified, + * the length argument must be set. See usage() for allowed + * invocations. */ - if (do_refer + got_size != 1 || argc < 1) + if (argc < 1 || do_refer + got_size + do_dealloc != 1 || + (do_dealloc == 1 && len == -1)) usage(); - if (do_refer) { + if (do_refer == 1) { if (stat(rname, &sb) == -1) err(EXIT_FAILURE, "%s", rname); tsize = sb.st_size; - } else if (do_relative || do_round) + } else if (do_relative == 1 || do_round == 1) rsize = sz; - else + else if (do_dealloc == 0) tsize = sz; if (no_create) @@ -129,7 +163,7 @@ main(int argc, char **argv) } continue; } - if (do_relative) { + if (do_relative == 1) { if (fstat(fd, &sb) == -1) { warn("%s", fname); error++; @@ -144,7 +178,7 @@ main(int argc, char **argv) } tsize = oflow; } - if (do_round) { + if (do_round == 1) { if (fstat(fd, &sb) == -1) { warn("%s", fname); error++; @@ -166,10 +200,16 @@ main(int argc, char **argv) if (tsize < 0) tsize = 0; - if (ftruncate(fd, tsize) == -1) { + if (do_dealloc == 1) { + sr.r_offset = off; + sr.r_len = len; + r = fspacectl(fd, SPACECTL_DEALLOC, &sr, 0, &sr); + } + if (do_truncate == 1) + r = ftruncate(fd, tsize); + if (r == -1) { warn("%s", fname); error++; - continue; } } if (fd != -1) @@ -181,8 +221,9 @@ main(int argc, char **argv) static void usage(void) { - fprintf(stderr, "%s\n%s\n", + fprintf(stderr, "%s\n%s\n%s\n", "usage: truncate [-c] -s [+|-|%|/]size[K|k|M|m|G|g|T|t] file ...", - " truncate [-c] -r rfile file ..."); + " truncate [-c] -r rfile file ...", + " truncate [-c] -d [-o offset[K|k|M|m|G|g|T|t]] -l length[K|k|M|m|G|g|T|t] file ..."); exit(EXIT_FAILURE); } From owner-dev-commits-src-main@freebsd.org Thu Aug 19 10:45:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 20A0C662E0B; Thu, 19 Aug 2021 10:45:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr1dP0Dhhz4cSX; Thu, 19 Aug 2021 10:45:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4E29242F5; Thu, 19 Aug 2021 10:45:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JAjiGe083876; Thu, 19 Aug 2021 10:45:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JAjiv5083875; Thu, 19 Aug 2021 10:45:44 GMT (envelope-from git) Date: Thu, 19 Aug 2021 10:45:44 GMT Message-Id: <202108191045.17JAjiv5083875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: a54abe119e3b - main - truncate(1): Fix missing -d option manpage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a54abe119e3b4c6e000a1058afab4904d205850b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 10:45:45 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=a54abe119e3b4c6e000a1058afab4904d205850b commit a54abe119e3b4c6e000a1058afab4904d205850b Author: Ka Ho Ng AuthorDate: 2021-08-19 10:45:25 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-19 10:45:25 +0000 truncate(1): Fix missing -d option manpage Mention that either one of the -r, -s and -d options must be specified. Sponsored by: The FreeBSD Foundation --- usr.bin/truncate/truncate.1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/truncate/truncate.1 b/usr.bin/truncate/truncate.1 index 54780ccbca83..0ea224deaff5 100644 --- a/usr.bin/truncate/truncate.1 +++ b/usr.bin/truncate/truncate.1 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 18, 2021 +.Dd August 19, 2021 .Dt TRUNCATE 1 .Os .Sh NAME @@ -158,9 +158,10 @@ Kilobytes, Megabytes, Gigabytes or Terabytes respectively. .Pp Exactly one of the -.Fl r -and +.Fl r , .Fl s +and +.Fl d options must be specified. .Pp If a file is made smaller, its extra data is lost. From owner-dev-commits-src-main@freebsd.org Thu Aug 19 12:43:19 2021 Return-Path: Delivered-To: dev-commits-src-main@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 167F1664DC5; Thu, 19 Aug 2021 12:43:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr4F30348z4jk4; Thu, 19 Aug 2021 12:43:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDB5C25C13; Thu, 19 Aug 2021 12:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JChIua043165; Thu, 19 Aug 2021 12:43:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JChI7F043164; Thu, 19 Aug 2021 12:43:18 GMT (envelope-from git) Date: Thu, 19 Aug 2021 12:43:18 GMT Message-Id: <202108191243.17JChI7F043164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 1a4d7030bbfe - main - rtsold: make it work on if_vlan interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a4d7030bbfec0f830e87bf7c2810f049f8ca8ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 12:43:19 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1a4d7030bbfec0f830e87bf7c2810f049f8ca8ac commit 1a4d7030bbfec0f830e87bf7c2810f049f8ca8ac Author: Luiz Otavio O Souza AuthorDate: 2021-08-19 09:48:04 +0000 Commit: Kristof Provost CommitDate: 2021-08-19 12:31:13 +0000 rtsold: make it work on if_vlan interfaces Reviewed by: kp Obtained from: pfsense MFC after: 1 week --- usr.sbin/rtsold/if.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/rtsold/if.c b/usr.sbin/rtsold/if.c index b2f2c640b175..0f7f2ce7cba5 100644 --- a/usr.sbin/rtsold/if.c +++ b/usr.sbin/rtsold/if.c @@ -262,6 +262,7 @@ lladdropt_length(struct sockaddr_dl *sdl) { switch (sdl->sdl_type) { case IFT_ETHER: + case IFT_L2VLAN: return (ROUNDUP8(ETHER_ADDR_LEN + 2)); default: return (0); @@ -277,6 +278,7 @@ lladdropt_fill(struct sockaddr_dl *sdl, struct nd_opt_hdr *ndopt) switch (sdl->sdl_type) { case IFT_ETHER: + case IFT_L2VLAN: ndopt->nd_opt_len = (ROUNDUP8(ETHER_ADDR_LEN + 2)) >> 3; addr = (char *)(ndopt + 1); memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN); From owner-dev-commits-src-main@freebsd.org Thu Aug 19 13:13:31 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AF49E66570A; Thu, 19 Aug 2021 13:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr4vv4S3Dz4l7y; Thu, 19 Aug 2021 13:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80F1226051; Thu, 19 Aug 2021 13:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JDDV62083566; Thu, 19 Aug 2021 13:13:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JDDVsB083565; Thu, 19 Aug 2021 13:13:31 GMT (envelope-from git) Date: Thu, 19 Aug 2021 13:13:31 GMT Message-Id: <202108191313.17JDDVsB083565@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5851803f4bca - main - dhclient: remove patching of static values in BPF programs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5851803f4bcab48bddfe1600bda3906c4f83fad5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 13:13:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5851803f4bcab48bddfe1600bda3906c4f83fad5 commit 5851803f4bcab48bddfe1600bda3906c4f83fad5 Author: Franco Fichtner AuthorDate: 2021-08-19 13:08:59 +0000 Commit: Mark Johnston CommitDate: 2021-08-19 13:10:42 +0000 dhclient: remove patching of static values in BPF programs Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31502 --- sbin/dhclient/bpf.c | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index a50abca62fd3..41eb4f402e66 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -105,7 +105,7 @@ if_register_bpf(struct interface_info *info, int flags) * Packet write filter program: * 'ip and udp and src port bootps and dst port (bootps or bootpc)' */ -static struct bpf_insn dhcp_bpf_wfilter[] = { +static const struct bpf_insn dhcp_bpf_wfilter[] = { BPF_STMT(BPF_LD + BPF_B + BPF_IND, 14), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, (IPVERSION << 4) + 5, 0, 12), @@ -119,18 +119,18 @@ static struct bpf_insn dhcp_bpf_wfilter[] = { /* Make sure this isn't a fragment... */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20), - BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 6, 0), /* patched */ + BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, IP_MF|IP_OFFMASK, 6, 0), /* Get the IP header length... */ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 14), /* Make sure it's from the right port... */ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 14), - BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 68, 0, 3), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, LOCAL_PORT, 0, 3), /* Make sure it is to the right ports ... */ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 16), - BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, REMOTE_PORT, 0, 1), /* If we passed all the tests, ask for the whole packet. */ BPF_STMT(BPF_RET+BPF_K, (u_int)-1), @@ -139,8 +139,6 @@ static struct bpf_insn dhcp_bpf_wfilter[] = { BPF_STMT(BPF_RET+BPF_K, 0), }; -static int dhcp_bpf_wfilter_len = nitems(dhcp_bpf_wfilter); - void if_register_send(struct interface_info *info) { @@ -161,11 +159,8 @@ if_register_send(struct interface_info *info) error("Kernel BPF version out of range - recompile dhcpd!"); /* Set up the bpf write filter program structure. */ - p.bf_len = dhcp_bpf_wfilter_len; - p.bf_insns = dhcp_bpf_wfilter; - - if (dhcp_bpf_wfilter[7].k == 0x1fff) - dhcp_bpf_wfilter[7].k = htons(IP_MF|IP_OFFMASK); + p.bf_insns = __DECONST(struct bpf_insn *, dhcp_bpf_wfilter); + p.bf_len = nitems(dhcp_bpf_wfilter); if (ioctl(info->wfdesc, BIOCSETWF, &p) < 0) error("Can't install write filter program: %m"); @@ -190,11 +185,8 @@ if_register_send(struct interface_info *info) /* * Packet filter program... - * - * XXX: Changes to the filter program may require changes to the - * constant offsets used in if_register_send to patch the BPF program! */ -static struct bpf_insn dhcp_bpf_filter[] = { +static const struct bpf_insn dhcp_bpf_filter[] = { /* Make sure this is an IP packet... */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 12), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_IP, 0, 8), @@ -205,14 +197,14 @@ static struct bpf_insn dhcp_bpf_filter[] = { /* Make sure this isn't a fragment... */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20), - BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0), + BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, IP_MF|IP_OFFMASK, 4, 0), /* Get the IP header length... */ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 14), /* Make sure it's to the right port... */ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 16), - BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), /* patch */ + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, LOCAL_PORT, 0, 1), /* If we passed all the tests, ask for the whole packet. */ BPF_STMT(BPF_RET+BPF_K, (u_int)-1), @@ -221,8 +213,6 @@ static struct bpf_insn dhcp_bpf_filter[] = { BPF_STMT(BPF_RET+BPF_K, 0), }; -static int dhcp_bpf_filter_len = nitems(dhcp_bpf_filter); - void if_register_receive(struct interface_info *info) { @@ -263,15 +253,8 @@ if_register_receive(struct interface_info *info) info->rbuf_len = 0; /* Set up the bpf filter program structure. */ - p.bf_len = dhcp_bpf_filter_len; - p.bf_insns = dhcp_bpf_filter; - - /* Patch the server port into the BPF program... - * - * XXX: changes to filter program may require changes to the - * insn number(s) used below! - */ - dhcp_bpf_filter[8].k = LOCAL_PORT; + p.bf_insns = __DECONST(struct bpf_insn *, dhcp_bpf_filter); + p.bf_len = nitems(dhcp_bpf_filter); if (ioctl(info->rfdesc, BIOCSETF, &p) < 0) error("Can't install packet filter program: %m"); From owner-dev-commits-src-main@freebsd.org Thu Aug 19 13:13:33 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1228B66570B; Thu, 19 Aug 2021 13:13:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr4vw6SgSz4l5K; Thu, 19 Aug 2021 13:13:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0AC726149; Thu, 19 Aug 2021 13:13:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JDDWbR083590; Thu, 19 Aug 2021 13:13:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JDDWCW083589; Thu, 19 Aug 2021 13:13:32 GMT (envelope-from git) Date: Thu, 19 Aug 2021 13:13:32 GMT Message-Id: <202108191313.17JDDWCW083589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a313b5240a47 - main - dhclient: skip_to_semi() consumes semicolon already MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a313b5240a477e0d04294ffd170408d954181daa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 13:13:33 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a313b5240a477e0d04294ffd170408d954181daa commit a313b5240a477e0d04294ffd170408d954181daa Author: Franco Fichtner AuthorDate: 2021-08-19 13:11:38 +0000 Commit: Mark Johnston CommitDate: 2021-08-19 13:11:38 +0000 dhclient: skip_to_semi() consumes semicolon already When invalid statement is found the next statement is skipped even if it is valid. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31527 --- sbin/dhclient/clparse.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 58ece525f8d1..c7b02a073aa3 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -199,7 +199,6 @@ void parse_client_statement(FILE *cfile, struct interface_info *ip, struct client_config *config) { - int token; char *val; struct option *option; time_t tmp; @@ -290,15 +289,11 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, parse_reject_statement(cfile, config); return; default: - parse_warn("expecting a statement."); - skip_to_semi(cfile); break; } - token = next_token(&val, cfile); - if (token != SEMI) { - parse_warn("semicolon expected."); - skip_to_semi(cfile); - } + + parse_warn("expecting a statement."); + skip_to_semi(cfile); } unsigned @@ -637,7 +632,7 @@ parse_client_lease_declaration(FILE *cfile, struct client_lease *lease, if (token != STRING) { parse_warn("expecting interface name (in quotes)."); skip_to_semi(cfile); - break; + return; } ip = interface_or_dummy(val); *ipp = ip; @@ -674,7 +669,7 @@ parse_client_lease_declaration(FILE *cfile, struct client_lease *lease, default: parse_warn("expecting lease declaration."); skip_to_semi(cfile); - break; + return; } token = next_token(&val, cfile); if (token != SEMI) { From owner-dev-commits-src-main@freebsd.org Thu Aug 19 14:36:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 664426663FA; Thu, 19 Aug 2021 14:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr6m52P1Rz4pvR; Thu, 19 Aug 2021 14:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3560C270CC; Thu, 19 Aug 2021 14:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JEarR3089775; Thu, 19 Aug 2021 14:36:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JEar7l089774; Thu, 19 Aug 2021 14:36:53 GMT (envelope-from git) Date: Thu, 19 Aug 2021 14:36:53 GMT Message-Id: <202108191436.17JEar7l089774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 3ec0714d6db0 - main - libsa: cstyle cleanup of dosfs.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ec0714d6db0060113f6cadac6f4e44640603e8f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 14:36:53 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=3ec0714d6db0060113f6cadac6f4e44640603e8f commit 3ec0714d6db0060113f6cadac6f4e44640603e8f Author: Toomas Soome AuthorDate: 2021-08-19 14:33:24 +0000 Commit: Toomas Soome CommitDate: 2021-08-19 14:36:25 +0000 libsa: cstyle cleanup of dosfs.c No functional changes intended. MFC after: 1 week --- stand/libsa/dosfs.c | 1175 ++++++++++++++++++++++++++------------------------- 1 file changed, 595 insertions(+), 580 deletions(-) diff --git a/stand/libsa/dosfs.c b/stand/libsa/dosfs.c index 2d6029be837e..656af3642c88 100644 --- a/stand/libsa/dosfs.c +++ b/stand/libsa/dosfs.c @@ -69,40 +69,40 @@ struct fs_ops dosfs_fsops = { /* DOS "BIOS Parameter Block" */ typedef struct { - u_char secsiz[2]; /* sector size */ - u_char spc; /* sectors per cluster */ - u_char ressec[2]; /* reserved sectors */ - u_char fats; /* FATs */ - u_char dirents[2]; /* root directory entries */ - u_char secs[2]; /* total sectors */ - u_char media; /* media descriptor */ - u_char spf[2]; /* sectors per FAT */ - u_char spt[2]; /* sectors per track */ - u_char heads[2]; /* drive heads */ - u_char hidsec[4]; /* hidden sectors */ - u_char lsecs[4]; /* huge sectors */ - u_char lspf[4]; /* huge sectors per FAT */ - u_char xflg[2]; /* flags */ - u_char vers[2]; /* filesystem version */ - u_char rdcl[4]; /* root directory start cluster */ - u_char infs[2]; /* filesystem info sector */ - u_char bkbs[2]; /* backup boot sector */ + u_char secsiz[2]; /* sector size */ + u_char spc; /* sectors per cluster */ + u_char ressec[2]; /* reserved sectors */ + u_char fats; /* FATs */ + u_char dirents[2]; /* root directory entries */ + u_char secs[2]; /* total sectors */ + u_char media; /* media descriptor */ + u_char spf[2]; /* sectors per FAT */ + u_char spt[2]; /* sectors per track */ + u_char heads[2]; /* drive heads */ + u_char hidsec[4]; /* hidden sectors */ + u_char lsecs[4]; /* huge sectors */ + u_char lspf[4]; /* huge sectors per FAT */ + u_char xflg[2]; /* flags */ + u_char vers[2]; /* filesystem version */ + u_char rdcl[4]; /* root directory start cluster */ + u_char infs[2]; /* filesystem info sector */ + u_char bkbs[2]; /* backup boot sector */ } DOS_BPB; /* Initial portion of DOS boot sector */ typedef struct { - u_char jmp[3]; /* usually 80x86 'jmp' opcode */ - u_char oem[8]; /* OEM name and version */ - DOS_BPB bpb; /* BPB */ + u_char jmp[3]; /* usually 80x86 'jmp' opcode */ + u_char oem[8]; /* OEM name and version */ + DOS_BPB bpb; /* BPB */ } DOS_BS; /* Supply missing "." and ".." root directory entries */ static const char *const dotstr[2] = {".", ".."}; static DOS_DE dot[2] = { - {". ", " ", FA_DIR, {0, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, - {0, 0}, {0x21, 0}, {0, 0}, {0, 0, 0, 0}}, - {".. ", " ", FA_DIR, {0, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, - {0, 0}, {0x21, 0}, {0, 0}, {0, 0, 0, 0}} + {". ", " ", FA_DIR, {0, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {0, 0}, {0x21, 0}, {0, 0}, {0, 0, 0, 0}}, + {".. ", " ", FA_DIR, {0, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {0, 0}, {0x21, 0}, {0, 0}, {0, 0, 0, 0}} }; /* The usual conversion macros to avoid multiplication and division */ @@ -148,31 +148,31 @@ static int ioget(struct open_file *, daddr_t, void *, size_t); static int dos_read_fatblk(DOS_FS *fs, struct open_file *fd, u_int blknum) { - int err; - size_t io_size; - daddr_t offset_in_fat, max_offset_in_fat; - - offset_in_fat = ((daddr_t)blknum) * FATBLKSZ; - max_offset_in_fat = secbyt(fs->spf); - io_size = FATBLKSZ; - if (offset_in_fat > max_offset_in_fat) - offset_in_fat = max_offset_in_fat; - if (offset_in_fat + io_size > max_offset_in_fat) - io_size = ((size_t)(max_offset_in_fat - offset_in_fat)); - - if (io_size != 0) { - err = ioget(fd, fs->lsnfat + bytsec(offset_in_fat), - fs->fatbuf, io_size); - if (err != 0) { - fs->fatbuf_blknum = ((u_int)(-1)); - return (err); - } - } - if (io_size < FATBLKSZ) - memset(fs->fatbuf + io_size, 0, FATBLKSZ - io_size); - - fs->fatbuf_blknum = blknum; - return (0); + int err; + size_t io_size; + daddr_t offset_in_fat, max_offset_in_fat; + + offset_in_fat = ((daddr_t)blknum) * FATBLKSZ; + max_offset_in_fat = secbyt(fs->spf); + io_size = FATBLKSZ; + if (offset_in_fat > max_offset_in_fat) + offset_in_fat = max_offset_in_fat; + if (offset_in_fat + io_size > max_offset_in_fat) + io_size = ((size_t)(max_offset_in_fat - offset_in_fat)); + + if (io_size != 0) { + err = ioget(fd, fs->lsnfat + bytsec(offset_in_fat), + fs->fatbuf, io_size); + if (err != 0) { + fs->fatbuf_blknum = ((u_int)(-1)); + return (err); + } + } + if (io_size < FATBLKSZ) + memset(fs->fatbuf + io_size, 0, FATBLKSZ - io_size); + + fs->fatbuf_blknum = blknum; + return (0); } /* @@ -181,38 +181,38 @@ dos_read_fatblk(DOS_FS *fs, struct open_file *fd, u_int blknum) static int dos_mount(DOS_FS *fs, struct open_file *fd) { - int err; - u_char *buf; - - bzero(fs, sizeof(DOS_FS)); - fs->fd = fd; - - if ((buf = malloc(secbyt(1))) == NULL) - return (errno); - if ((err = ioget(fs->fd, 0, buf, secbyt(1))) || - (err = parsebs(fs, (DOS_BS *)buf))) { - free(buf); - return (err); - } - free(buf); - - if ((fs->fatbuf = malloc(FATBLKSZ)) == NULL) - return (errno); - err = dos_read_fatblk(fs, fd, 0); - if (err != 0) { - free(fs->fatbuf); - return (err); - } - - fs->root = dot[0]; - fs->root.name[0] = ' '; - if (fs->fatsz == 32) { - fs->root.clus[0] = fs->rdcl & 0xff; - fs->root.clus[1] = (fs->rdcl >> 8) & 0xff; - fs->root.dex.h_clus[0] = (fs->rdcl >> 16) & 0xff; - fs->root.dex.h_clus[1] = (fs->rdcl >> 24) & 0xff; - } - return (0); + int err; + u_char *buf; + + bzero(fs, sizeof(DOS_FS)); + fs->fd = fd; + + if ((buf = malloc(secbyt(1))) == NULL) + return (errno); + if ((err = ioget(fs->fd, 0, buf, secbyt(1))) || + (err = parsebs(fs, (DOS_BS *)buf))) { + free(buf); + return (err); + } + free(buf); + + if ((fs->fatbuf = malloc(FATBLKSZ)) == NULL) + return (errno); + err = dos_read_fatblk(fs, fd, 0); + if (err != 0) { + free(fs->fatbuf); + return (err); + } + + fs->root = dot[0]; + fs->root.name[0] = ' '; + if (fs->fatsz == 32) { + fs->root.clus[0] = fs->rdcl & 0xff; + fs->root.clus[1] = (fs->rdcl >> 8) & 0xff; + fs->root.dex.h_clus[0] = (fs->rdcl >> 16) & 0xff; + fs->root.dex.h_clus[1] = (fs->rdcl >> 24) & 0xff; + } + return (0); } /* @@ -221,11 +221,11 @@ dos_mount(DOS_FS *fs, struct open_file *fd) static int dos_unmount(DOS_FS *fs) { - if (fs->links) - return (EBUSY); - free(fs->fatbuf); - free(fs); - return (0); + if (fs->links) + return (EBUSY); + free(fs->fatbuf); + free(fs); + return (0); } /* @@ -234,45 +234,45 @@ dos_unmount(DOS_FS *fs) static int dos_open(const char *path, struct open_file *fd) { - DOS_DE *de; - DOS_FILE *f; - DOS_FS *fs; - u_int size, clus; - int err; - - /* Allocate mount structure, associate with open */ - if ((fs = malloc(sizeof(DOS_FS))) == NULL) - return (errno); - if ((err = dos_mount(fs, fd))) { - free(fs); - return (err); - } - - if ((err = namede(fs, path, &de))) { - dos_unmount(fs); - return (err); - } - - clus = stclus(fs->fatsz, de); - size = cv4(de->size); - - if ((!(de->attr & FA_DIR) && (!clus != !size)) || - ((de->attr & FA_DIR) && size) || - (clus && !okclus(fs, clus))) { - dos_unmount(fs); - return (EINVAL); - } - if ((f = malloc(sizeof(DOS_FILE))) == NULL) { - err = errno; - dos_unmount(fs); - return (err); - } - bzero(f, sizeof(DOS_FILE)); - f->fs = fs; - fs->links++; - f->de = *de; - fd->f_fsdata = (void *)f; - return (0); + DOS_DE *de; + DOS_FILE *f; + DOS_FS *fs; + u_int size, clus; + int err; + + /* Allocate mount structure, associate with open */ + if ((fs = malloc(sizeof(DOS_FS))) == NULL) + return (errno); + if ((err = dos_mount(fs, fd))) { + free(fs); + return (err); + } + + if ((err = namede(fs, path, &de))) { + dos_unmount(fs); + return (err); + } + + clus = stclus(fs->fatsz, de); + size = cv4(de->size); + + if ((!(de->attr & FA_DIR) && (!clus != !size)) || + ((de->attr & FA_DIR) && size) || + (clus && !okclus(fs, clus))) { + dos_unmount(fs); + return (EINVAL); + } + if ((f = malloc(sizeof(DOS_FILE))) == NULL) { + err = errno; + dos_unmount(fs); + return (err); + } + bzero(f, sizeof(DOS_FILE)); + f->fs = fs; + fs->links++; + f->de = *de; + fd->f_fsdata = (void *)f; + return (0); } /* @@ -281,57 +281,58 @@ dos_open(const char *path, struct open_file *fd) static int dos_read(struct open_file *fd, void *buf, size_t nbyte, size_t *resid) { - off_t size; - u_int nb, off, clus, c, cnt, n; - DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; - int err = 0; - - /* - * as ioget() can be called *a lot*, use twiddle here. - * also 4 seems to be good value not to slow loading down too much: - * with 270MB file (~540k ioget() calls, twiddle can easily waste 4-5sec. - */ - twiddle(4); - nb = (u_int)nbyte; - if ((size = fsize(f->fs, &f->de)) == -1) - return (EINVAL); - if (nb > (n = size - f->offset)) - nb = n; - off = f->offset; - if ((clus = stclus(f->fs->fatsz, &f->de))) - off &= f->fs->bsize - 1; - c = f->c; - cnt = nb; - while (cnt) { - n = 0; - if (!c) { - if ((c = clus)) - n = bytblk(f->fs, f->offset); - } else if (!off) - n++; - while (n--) { - if ((err = fatget(f->fs, &c))) - goto out; - if (!okclus(f->fs, c)) { - err = EINVAL; - goto out; - } + off_t size; + u_int nb, off, clus, c, cnt, n; + DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; + int err = 0; + + /* + * as ioget() can be called *a lot*, use twiddle here. + * also 4 seems to be good value not to slow loading down too much: + * with 270MB file (~540k ioget() calls, twiddle can easily waste + * 4-5 sec. + */ + twiddle(4); + nb = (u_int)nbyte; + if ((size = fsize(f->fs, &f->de)) == -1) + return (EINVAL); + if (nb > (n = size - f->offset)) + nb = n; + off = f->offset; + if ((clus = stclus(f->fs->fatsz, &f->de))) + off &= f->fs->bsize - 1; + c = f->c; + cnt = nb; + while (cnt) { + n = 0; + if (!c) { + if ((c = clus)) + n = bytblk(f->fs, f->offset); + } else if (!off) + n++; + while (n--) { + if ((err = fatget(f->fs, &c))) + goto out; + if (!okclus(f->fs, c)) { + err = EINVAL; + goto out; + } + } + if (!clus || (n = f->fs->bsize - off) > cnt) + n = cnt; + if ((err = ioread(f->fs, (c ? blkoff(f->fs, c) : + secbyt(f->fs->lsndir)) + off, buf, n))) + goto out; + f->offset += n; + f->c = c; + off = 0; + buf = (char *)buf + n; + cnt -= n; } - if (!clus || (n = f->fs->bsize - off) > cnt) - n = cnt; - if ((err = ioread(f->fs, (c ? blkoff(f->fs, c) : - secbyt(f->fs->lsndir)) + off, buf, n))) - goto out; - f->offset += n; - f->c = c; - off = 0; - buf = (char *)buf + n; - cnt -= n; - } - out: - if (resid) - *resid = nbyte - nb + cnt; - return (err); +out: + if (resid) + *resid = nbyte - nb + cnt; + return (err); } /* @@ -340,33 +341,33 @@ dos_read(struct open_file *fd, void *buf, size_t nbyte, size_t *resid) static off_t dos_seek(struct open_file *fd, off_t offset, int whence) { - off_t off; - u_int size; - DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; - - size = cv4(f->de.size); - switch (whence) { - case SEEK_SET: - off = 0; - break; - case SEEK_CUR: - off = f->offset; - break; - case SEEK_END: - off = size; - break; - default: - errno = EINVAL; - return (-1); - } - off += offset; - if (off < 0 || off > size) { - errno = EINVAL; - return (-1); - } - f->offset = (u_int)off; - f->c = 0; - return (off); + off_t off; + u_int size; + DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; + + size = cv4(f->de.size); + switch (whence) { + case SEEK_SET: + off = 0; + break; + case SEEK_CUR: + off = f->offset; + break; + case SEEK_END: + off = size; + break; + default: + errno = EINVAL; + return (-1); + } + off += offset; + if (off < 0 || off > size) { + errno = EINVAL; + return (-1); + } + f->offset = (u_int)off; + f->c = 0; + return (off); } /* @@ -375,13 +376,13 @@ dos_seek(struct open_file *fd, off_t offset, int whence) static int dos_close(struct open_file *fd) { - DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; - DOS_FS *fs = f->fs; + DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; + DOS_FS *fs = f->fs; - f->fs->links--; - free(f); - dos_unmount(fs); - return (0); + f->fs->links--; + free(f); + dos_unmount(fs); + return (0); } /* @@ -390,105 +391,106 @@ dos_close(struct open_file *fd) static int dos_stat(struct open_file *fd, struct stat *sb) { - DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; - - /* only important stuff */ - sb->st_mode = f->de.attr & FA_DIR ? S_IFDIR | 0555 : S_IFREG | 0444; - sb->st_nlink = 1; - sb->st_uid = 0; - sb->st_gid = 0; - if ((sb->st_size = fsize(f->fs, &f->de)) == -1) - return (EINVAL); - return (0); + DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; + + /* only important stuff */ + sb->st_mode = f->de.attr & FA_DIR ? S_IFDIR | 0555 : S_IFREG | 0444; + sb->st_nlink = 1; + sb->st_uid = 0; + sb->st_gid = 0; + if ((sb->st_size = fsize(f->fs, &f->de)) == -1) + return (EINVAL); + return (0); } static int dos_checksum(unsigned char *name, unsigned char *ext) { - int x, i; - char buf[11]; - - bcopy(name, buf, 8); - bcopy(ext, buf+8, 3); - x = 0; - for (i = 0; i < 11; i++) { - x = ((x & 1) << 7) | (x >> 1); - x += buf[i]; - x &= 0xff; - } - return (x); + int x, i; + char buf[11]; + + bcopy(name, buf, 8); + bcopy(ext, buf+8, 3); + x = 0; + for (i = 0; i < 11; i++) { + x = ((x & 1) << 7) | (x >> 1); + x += buf[i]; + x &= 0xff; + } + return (x); } static int dos_readdir(struct open_file *fd, struct dirent *d) { - /* DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; */ - u_char fn[261]; - DOS_DIR dd; - size_t res; - u_int chk, x, xdn; - int err; - - x = chk = 0; - while (1) { - xdn = x; - x = 0; - err = dos_read(fd, &dd, sizeof(dd), &res); - if (err) - return (err); - if (res == sizeof(dd)) - return (ENOENT); - if (dd.de.name[0] == 0) - return (ENOENT); - - /* Skip deleted entries */ - if (dd.de.name[0] == 0xe5) - continue; - - /* Check if directory entry is volume label */ - if (dd.de.attr & FA_LABEL) { - /* - * If volume label set, check if the current entry is - * extended entry (FA_XDE) for long file names. - */ - if ((dd.de.attr & FA_MASK) == FA_XDE) { - /* - * Read through all following extended entries - * to get the long file name. 0x40 marks the - * last entry containing part of long file name. - */ - if (dd.xde.seq & 0x40) - chk = dd.xde.chk; - else if (dd.xde.seq != xdn - 1 || dd.xde.chk != chk) - continue; - x = dd.xde.seq & ~0x40; - if (x < 1 || x > 20) { - x = 0; - continue; + /* DOS_FILE *f = (DOS_FILE *)fd->f_fsdata; */ + u_char fn[261]; + DOS_DIR dd; + size_t res; + u_int chk, x, xdn; + int err; + + x = chk = 0; + for (;;) { + xdn = x; + x = 0; + err = dos_read(fd, &dd, sizeof(dd), &res); + if (err) + return (err); + if (res == sizeof(dd)) + return (ENOENT); + if (dd.de.name[0] == 0) + return (ENOENT); + + /* Skip deleted entries */ + if (dd.de.name[0] == 0xe5) + continue; + + /* Check if directory entry is volume label */ + if (dd.de.attr & FA_LABEL) { + /* + * If volume label set, check if the current entry is + * extended entry (FA_XDE) for long file names. + */ + if ((dd.de.attr & FA_MASK) == FA_XDE) { + /* + * Read through all following extended entries + * to get the long file name. 0x40 marks the + * last entry containing part of long file name. + */ + if (dd.xde.seq & 0x40) + chk = dd.xde.chk; + else if (dd.xde.seq != xdn - 1 || + dd.xde.chk != chk) + continue; + x = dd.xde.seq & ~0x40; + if (x < 1 || x > 20) { + x = 0; + continue; + } + cp_xdnm(fn, &dd.xde); + } else { + /* skip only volume label entries */ + continue; + } + } else { + if (xdn == 1) { + x = dos_checksum(dd.de.name, dd.de.ext); + if (x == chk) + break; + } else { + cp_sfn(fn, &dd.de); + break; + } + x = 0; } - cp_xdnm(fn, &dd.xde); - } else { - /* skip only volume label entries */ - continue; - } - } else { - if (xdn == 1) { - x = dos_checksum(dd.de.name, dd.de.ext); - if (x == chk) - break; - } else { - cp_sfn(fn, &dd.de); - break; - } - x = 0; } - } - d->d_fileno = (dd.de.clus[1] << 8) + dd.de.clus[0]; - d->d_reclen = sizeof(*d); - d->d_type = (dd.de.attr & FA_DIR) ? DT_DIR : DT_REG; - memcpy(d->d_name, fn, sizeof(d->d_name)); - return (0); + d->d_fileno = (dd.de.clus[1] << 8) + dd.de.clus[0]; + d->d_reclen = sizeof(*d); + d->d_type = (dd.de.attr & FA_DIR) ? DT_DIR : DT_REG; + memcpy(d->d_name, fn, sizeof(d->d_name)); + return (0); } /* @@ -497,47 +499,47 @@ dos_readdir(struct open_file *fd, struct dirent *d) static int parsebs(DOS_FS *fs, DOS_BS *bs) { - u_int sc; - - if ((bs->jmp[0] != 0x69 && - bs->jmp[0] != 0xe9 && - (bs->jmp[0] != 0xeb || bs->jmp[2] != 0x90)) || - bs->bpb.media < 0xf0) - return (EINVAL); - if (cv2(bs->bpb.secsiz) != SECSIZ) - return (EINVAL); - if (!(fs->spc = bs->bpb.spc) || fs->spc & (fs->spc - 1)) - return (EINVAL); - fs->bsize = secbyt(fs->spc); - fs->bshift = ffs(fs->bsize) - 1; - if ((fs->spf = cv2(bs->bpb.spf))) { - if (bs->bpb.fats != 2) - return (EINVAL); - if (!(fs->dirents = cv2(bs->bpb.dirents))) - return (EINVAL); - } else { - if (!(fs->spf = cv4(bs->bpb.lspf))) - return (EINVAL); - if (!bs->bpb.fats || bs->bpb.fats > 16) - return (EINVAL); - if ((fs->rdcl = cv4(bs->bpb.rdcl)) < LOCLUS) - return (EINVAL); - } - if (!(fs->lsnfat = cv2(bs->bpb.ressec))) - return (EINVAL); - fs->lsndir = fs->lsnfat + fs->spf * bs->bpb.fats; - fs->lsndta = fs->lsndir + entsec(fs->dirents); - if (!(sc = cv2(bs->bpb.secs)) && !(sc = cv4(bs->bpb.lsecs))) - return (EINVAL); - if (fs->lsndta > sc) - return (EINVAL); - if ((fs->xclus = secblk(fs, sc - fs->lsndta) + 1) < LOCLUS) - return (EINVAL); - fs->fatsz = fs->dirents ? fs->xclus < 0xff6 ? 12 : 16 : 32; - sc = (secbyt(fs->spf) << 1) / (fs->fatsz >> 2) - 1; - if (fs->xclus > sc) - fs->xclus = sc; - return (0); + u_int sc; + + if ((bs->jmp[0] != 0x69 && + bs->jmp[0] != 0xe9 && + (bs->jmp[0] != 0xeb || bs->jmp[2] != 0x90)) || + bs->bpb.media < 0xf0) + return (EINVAL); + if (cv2(bs->bpb.secsiz) != SECSIZ) + return (EINVAL); + if (!(fs->spc = bs->bpb.spc) || fs->spc & (fs->spc - 1)) + return (EINVAL); + fs->bsize = secbyt(fs->spc); + fs->bshift = ffs(fs->bsize) - 1; + if ((fs->spf = cv2(bs->bpb.spf))) { + if (bs->bpb.fats != 2) + return (EINVAL); + if (!(fs->dirents = cv2(bs->bpb.dirents))) + return (EINVAL); + } else { + if (!(fs->spf = cv4(bs->bpb.lspf))) + return (EINVAL); + if (!bs->bpb.fats || bs->bpb.fats > 16) + return (EINVAL); + if ((fs->rdcl = cv4(bs->bpb.rdcl)) < LOCLUS) + return (EINVAL); + } + if (!(fs->lsnfat = cv2(bs->bpb.ressec))) + return (EINVAL); + fs->lsndir = fs->lsnfat + fs->spf * bs->bpb.fats; + fs->lsndta = fs->lsndir + entsec(fs->dirents); + if (!(sc = cv2(bs->bpb.secs)) && !(sc = cv4(bs->bpb.lsecs))) + return (EINVAL); + if (fs->lsndta > sc) + return (EINVAL); + if ((fs->xclus = secblk(fs, sc - fs->lsndta) + 1) < LOCLUS) + return (EINVAL); + fs->fatsz = fs->dirents ? fs->xclus < 0xff6 ? 12 : 16 : 32; + sc = (secbyt(fs->spf) << 1) / (fs->fatsz >> 2) - 1; + if (fs->xclus > sc) + fs->xclus = sc; + return (0); } /* @@ -546,33 +548,33 @@ parsebs(DOS_FS *fs, DOS_BS *bs) static int namede(DOS_FS *fs, const char *path, DOS_DE **dep) { - char name[256]; - DOS_DE *de; - char *s; - size_t n; - int err; - - err = 0; - de = &fs->root; - while (*path) { - while (*path == '/') - path++; - if (*path == '\0') - break; - if (!(s = strchr(path, '/'))) - s = strchr(path, 0); - if ((n = s - path) > 255) - return (ENAMETOOLONG); - memcpy(name, path, n); - name[n] = 0; - path = s; - if (!(de->attr & FA_DIR)) - return (ENOTDIR); - if ((err = lookup(fs, stclus(fs->fatsz, de), name, &de))) - return (err); - } - *dep = de; - return (0); + char name[256]; + DOS_DE *de; + char *s; + size_t n; + int err; + + err = 0; + de = &fs->root; + while (*path) { + while (*path == '/') + path++; + if (*path == '\0') + break; + if (!(s = strchr(path, '/'))) + s = strchr(path, 0); + if ((n = s - path) > 255) + return (ENAMETOOLONG); + memcpy(name, path, n); + name[n] = 0; + path = s; + if (!(de->attr & FA_DIR)) + return (ENOTDIR); + if ((err = lookup(fs, stclus(fs->fatsz, de), name, &de))) + return (err); + } + *dep = de; + return (0); } /* @@ -581,78 +583,85 @@ namede(DOS_FS *fs, const char *path, DOS_DE **dep) static int lookup(DOS_FS *fs, u_int clus, const char *name, DOS_DE **dep) { - static DOS_DIR dir[DEPSEC]; - u_char lfn[261]; - u_char sfn[13]; - u_int nsec, lsec, xdn, chk, sec, ent, x; - int err, ok; - - if (!clus) - for (ent = 0; ent < 2; ent++) - if (!strcasecmp(name, dotstr[ent])) { - *dep = dot + ent; - return (0); - } - if (!clus && fs->fatsz == 32) - clus = fs->rdcl; - nsec = !clus ? entsec(fs->dirents) : fs->spc; - lsec = 0; - xdn = chk = 0; - for (;;) { - if (!clus && !lsec) - lsec = fs->lsndir; - else if (okclus(fs, clus)) - lsec = blklsn(fs, clus); - else - return (EINVAL); - for (sec = 0; sec < nsec; sec++) { - if ((err = ioget(fs->fd, lsec + sec, dir, secbyt(1)))) - return (err); - for (ent = 0; ent < DEPSEC; ent++) { - if (!*dir[ent].de.name) - return (ENOENT); - if (*dir[ent].de.name != 0xe5) { - if ((dir[ent].de.attr & FA_MASK) == FA_XDE) { - x = dir[ent].xde.seq; - if (x & 0x40 || (x + 1 == xdn && - dir[ent].xde.chk == chk)) { - if (x & 0x40) { - chk = dir[ent].xde.chk; - x &= ~0x40; - } - if (x >= 1 && x <= 20) { - cp_xdnm(lfn, &dir[ent].xde); - xdn = x; - continue; - } - } - } else if (!(dir[ent].de.attr & FA_LABEL)) { - if ((ok = xdn == 1)) { - x = dos_checksum(dir[ent].de.name, dir[ent].de.ext); - ok = chk == x && - !strcasecmp(name, (const char *)lfn); - } - if (!ok) { - cp_sfn(sfn, &dir[ent].de); - ok = !strcasecmp(name, (const char *)sfn); - } - if (ok) { - *dep = &dir[ent].de; - return (0); - } - } + static DOS_DIR dir[DEPSEC]; + u_char lfn[261]; + u_char sfn[13]; + u_int nsec, lsec, xdn, chk, sec, ent, x; + int err, ok; + + if (!clus) + for (ent = 0; ent < 2; ent++) + if (!strcasecmp(name, dotstr[ent])) { + *dep = dot + ent; + return (0); } - xdn = 0; - } - } - if (!clus) - break; - if ((err = fatget(fs, &clus))) - return (err); - if (fatend(fs->fatsz, clus)) - break; - } - return (ENOENT); + if (!clus && fs->fatsz == 32) + clus = fs->rdcl; + nsec = !clus ? entsec(fs->dirents) : fs->spc; + lsec = 0; + xdn = chk = 0; + for (;;) { + if (!clus && !lsec) + lsec = fs->lsndir; + else if (okclus(fs, clus)) + lsec = blklsn(fs, clus); + else + return (EINVAL); + for (sec = 0; sec < nsec; sec++) { + if ((err = ioget(fs->fd, lsec + sec, dir, secbyt(1)))) + return (err); + for (ent = 0; ent < DEPSEC; ent++) { + if (!*dir[ent].de.name) + return (ENOENT); + if (*dir[ent].de.name != 0xe5) { + if ((dir[ent].de.attr & FA_MASK) == + FA_XDE) { + x = dir[ent].xde.seq; + if (x & 0x40 || (x + 1 == xdn && + dir[ent].xde.chk == chk)) { + if (x & 0x40) { + chk = dir[ent].xde.chk; + x &= ~0x40; + } + if (x >= 1 && x <= 20) { + cp_xdnm(lfn, &dir[ent].xde); + xdn = x; + continue; + } + } + } else if (!(dir[ent].de.attr & + FA_LABEL)) { + if ((ok = xdn == 1)) { + x = dos_checksum( + dir[ent].de.name, + dir[ent].de.ext); + ok = chk == x && + !strcasecmp(name, + (const char *)lfn); + } + if (!ok) { + cp_sfn(sfn, + &dir[ent].de); + ok = !strcasecmp(name, *** 375 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Aug 19 15:00:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AE25D66696E; Thu, 19 Aug 2021 15:00:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gr7HV4GJ9z4r0B; Thu, 19 Aug 2021 15:00:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79D7D2745F; Thu, 19 Aug 2021 15:00:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JF0cr8026227; Thu, 19 Aug 2021 15:00:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JF0c3s026226; Thu, 19 Aug 2021 15:00:38 GMT (envelope-from git) Date: Thu, 19 Aug 2021 15:00:38 GMT Message-Id: <202108191500.17JF0c3s026226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: fc7682b17f37 - main - e1000: Update intel shared code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc7682b17f3738573099b8b03f5628dcc8148adb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 15:00:38 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fc7682b17f3738573099b8b03f5628dcc8148adb commit fc7682b17f3738573099b8b03f5628dcc8148adb Author: Kevin Bowling AuthorDate: 2021-08-19 14:59:34 +0000 Commit: Kevin Bowling CommitDate: 2021-08-19 14:59:36 +0000 e1000: Update intel shared code Sync the e1000 shared code with DPDK shared code "cid-gigabit.2020.06.05.tar.gz released by ND" Primary focus was on client platforms (ich8lan). More work remains here but we need an Intel contact for client networking. Reviewed by: grehan, Intel Networking (erj, earlier rev) Obtained from: DPDK MFC after: 1 week Sponsored by: me Differential Revision: https://reviews.freebsd.org/D31547 --- sys/dev/e1000/e1000_80003es2lan.c | 36 ++--- sys/dev/e1000/e1000_80003es2lan.h | 38 ++--- sys/dev/e1000/e1000_82540.c | 40 ++--- sys/dev/e1000/e1000_82541.c | 40 ++--- sys/dev/e1000/e1000_82541.h | 40 ++--- sys/dev/e1000/e1000_82542.c | 40 ++--- sys/dev/e1000/e1000_82543.c | 40 ++--- sys/dev/e1000/e1000_82543.h | 40 ++--- sys/dev/e1000/e1000_82571.c | 42 ++--- sys/dev/e1000/e1000_82571.h | 40 ++--- sys/dev/e1000/e1000_82575.c | 40 ++--- sys/dev/e1000/e1000_82575.h | 40 ++--- sys/dev/e1000/e1000_api.c | 56 ++++--- sys/dev/e1000/e1000_api.h | 41 ++--- sys/dev/e1000/e1000_defines.h | 73 ++++++--- sys/dev/e1000/e1000_hw.h | 42 ++--- sys/dev/e1000/e1000_i210.c | 140 ++++++++++++++--- sys/dev/e1000/e1000_i210.h | 42 ++--- sys/dev/e1000/e1000_ich8lan.c | 316 ++++++++++++++++++++++++++++++-------- sys/dev/e1000/e1000_ich8lan.h | 47 +++--- sys/dev/e1000/e1000_mac.c | 40 ++--- sys/dev/e1000/e1000_mac.h | 40 ++--- sys/dev/e1000/e1000_manage.c | 40 ++--- sys/dev/e1000/e1000_manage.h | 40 ++--- sys/dev/e1000/e1000_mbx.c | 40 ++--- sys/dev/e1000/e1000_mbx.h | 40 ++--- sys/dev/e1000/e1000_nvm.c | 199 +++++++++++++++++++++--- sys/dev/e1000/e1000_nvm.h | 42 +++-- sys/dev/e1000/e1000_osdep.c | 40 ++--- sys/dev/e1000/e1000_osdep.h | 40 ++--- sys/dev/e1000/e1000_phy.c | 62 ++++---- sys/dev/e1000/e1000_phy.h | 49 +++--- sys/dev/e1000/e1000_regs.h | 55 ++++--- sys/dev/e1000/e1000_vf.c | 43 +++--- sys/dev/e1000/e1000_vf.h | 40 ++--- sys/dev/e1000/if_em.c | 10 +- 36 files changed, 1298 insertions(+), 755 deletions(-) diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index 5c0220adfc6f..c1aa47a73ac8 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its + + 3. Neither the name of the Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_80003es2lan.h b/sys/dev/e1000/e1000_80003es2lan.h index cbf0eafa9407..501cfc958819 100644 --- a/sys/dev/e1000/e1000_80003es2lan.h +++ b/sys/dev/e1000/e1000_80003es2lan.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_82540.c b/sys/dev/e1000/e1000_82540.c index adc944a8ebb4..720798260f8a 100644 --- a/sys/dev/e1000/e1000_82540.c +++ b/sys/dev/e1000/e1000_82540.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_82541.c b/sys/dev/e1000/e1000_82541.c index ead974cb1358..aaa3de7f02ce 100644 --- a/sys/dev/e1000/e1000_82541.c +++ b/sys/dev/e1000/e1000_82541.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_82541.h b/sys/dev/e1000/e1000_82541.h index ce29548a4d85..d31065d9a182 100644 --- a/sys/dev/e1000/e1000_82541.h +++ b/sys/dev/e1000/e1000_82541.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_82542.c b/sys/dev/e1000/e1000_82542.c index 09906699ab10..2fdf7066865b 100644 --- a/sys/dev/e1000/e1000_82542.c +++ b/sys/dev/e1000/e1000_82542.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_82543.c b/sys/dev/e1000/e1000_82543.c index e247b01f6cda..42c4726fa8c7 100644 --- a/sys/dev/e1000/e1000_82543.c +++ b/sys/dev/e1000/e1000_82543.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_82543.h b/sys/dev/e1000/e1000_82543.h index 98289524f6d8..27f8507fb63c 100644 --- a/sys/dev/e1000/e1000_82543.h +++ b/sys/dev/e1000/e1000_82543.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index 348a3daa3c05..8db1fcb921a9 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. @@ -515,7 +515,7 @@ e1000_get_hw_semaphore_82574(struct e1000_hw *hw) u32 extcnf_ctrl; s32 i = 0; /* XXX assert that mutex is held */ - DEBUGFUNC("e1000_get_hw_semaphore_82573"); + DEBUGFUNC("e1000_get_hw_semaphore_82574"); ASSERT_CTX_LOCK_HELD(hw); extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); diff --git a/sys/dev/e1000/e1000_82571.h b/sys/dev/e1000/e1000_82571.h index a39f63c53e2d..77303adb162f 100644 --- a/sys/dev/e1000/e1000_82571.h +++ b/sys/dev/e1000/e1000_82571.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 81bd419fcf0d..d588539ca8e8 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_82575.h b/sys/dev/e1000/e1000_82575.h index 36045556661b..22c2f8c4a2f5 100644 --- a/sys/dev/e1000/e1000_82575.h +++ b/sys/dev/e1000/e1000_82575.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index b1d5ef74c24f..b28ab77f3794 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. @@ -383,6 +383,7 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) break; case E1000_DEV_ID_I210_COPPER_FLASHLESS: case E1000_DEV_ID_I210_SERDES_FLASHLESS: + case E1000_DEV_ID_I210_SGMII_FLASHLESS: case E1000_DEV_ID_I210_COPPER: case E1000_DEV_ID_I210_COPPER_OEM1: case E1000_DEV_ID_I210_COPPER_IT: @@ -1268,6 +1269,21 @@ s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size) return e1000_read_pba_length_generic(hw, pba_num_size); } +/** + * e1000_read_pba_num - Read device part number + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + * Currently no func pointer exists and all implementations are handled in the + * generic version of this function. + **/ +s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num) +{ + return e1000_read_pba_num_generic(hw, pba_num); +} + /** * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index bf5f637cb3dd..b558b1cf5f23 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. @@ -100,6 +100,7 @@ void e1000_power_down_phy(struct e1000_hw *hw); s32 e1000_read_mac_addr(struct e1000_hw *hw); s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size); s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); +s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num); void e1000_reload_nvm(struct e1000_hw *hw); s32 e1000_update_nvm_checksum(struct e1000_hw *hw); s32 e1000_validate_nvm_checksum(struct e1000_hw *hw); diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index 262b01dd5b64..6c1138ed9335 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 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. @@ -1070,11 +1070,44 @@ /* NVM Word Offsets */ #define NVM_COMPAT 0x0003 #define NVM_ID_LED_SETTINGS 0x0004 +#define NVM_VERSION 0x0005 #define NVM_SERDES_AMPLITUDE 0x0006 /* SERDES output amplitude */ #define NVM_PHY_CLASS_WORD 0x0007 #define E1000_I210_NVM_FW_MODULE_PTR 0x0010 #define E1000_I350_NVM_FW_MODULE_PTR 0x0051 #define NVM_FUTURE_INIT_WORD1 0x0019 +#define NVM_ETRACK_WORD 0x0042 +#define NVM_ETRACK_HIWORD 0x0043 +#define NVM_COMB_VER_OFF 0x0083 +#define NVM_COMB_VER_PTR 0x003D + +/* NVM version defines */ +#define NVM_MAJOR_MASK 0xF000 +#define NVM_MINOR_MASK 0x0FF0 +#define NVM_IMAGE_ID_MASK 0x000F +#define NVM_COMB_VER_MASK 0x00FF +#define NVM_MAJOR_SHIFT 12 +#define NVM_MINOR_SHIFT 4 +#define NVM_COMB_VER_SHFT 8 +#define NVM_VER_INVALID 0xFFFF +#define NVM_ETRACK_SHIFT 16 +#define NVM_ETRACK_VALID 0x8000 *** 2216 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Aug 19 17:17:10 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0E67E6689E9; Thu, 19 Aug 2021 17:17:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrBK16Ydfz3H4g; Thu, 19 Aug 2021 17:17:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA28D15BB; Thu, 19 Aug 2021 17:17:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JHH93v003804; Thu, 19 Aug 2021 17:17:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JHH94b003803; Thu, 19 Aug 2021 17:17:09 GMT (envelope-from git) Date: Thu, 19 Aug 2021 17:17:09 GMT Message-Id: <202108191717.17JHH94b003803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: c81ea895b563 - main - Disable the accelerated arm64 sha25 in static libraries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c81ea895b563c4d1e39468a8525284b7474fe850 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 17:17:10 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c81ea895b563c4d1e39468a8525284b7474fe850 commit c81ea895b563c4d1e39468a8525284b7474fe850 Author: Andrew Turner AuthorDate: 2021-08-19 16:48:30 +0000 Commit: Andrew Turner CommitDate: 2021-08-19 16:48:30 +0000 Disable the accelerated arm64 sha25 in static libraries We don't have ifunc support in static arm64 binaries. Until we do disable the accelerated sha256 code in a static libmd as it uses an ifunc. Reported by: brd Sponsored by: The FreeBSD Foundation --- lib/libmd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libmd/Makefile b/lib/libmd/Makefile index 480796ae5029..ee92b7cb71ab 100644 --- a/lib/libmd/Makefile +++ b/lib/libmd/Makefile @@ -131,7 +131,7 @@ ACFLAGS+= -DELF -Wa,--noexecstack .endif .if ${MACHINE_CPUARCH} == "aarch64" SRCS+= sha256c_arm64.c -CFLAGS+= -DARM64_SHA2 +SHARED_CFLAGS+= -DARM64_SHA2 CFLAGS.sha256c_arm64.c+= -march=armv8-a+crypto .endif .endif # ${USE_ASM_SOURCES} != 0 From owner-dev-commits-src-main@freebsd.org Thu Aug 19 17:38:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5BE66668E26; Thu, 19 Aug 2021 17:38:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrBp11rzlz3JcM; Thu, 19 Aug 2021 17:38:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2787C1B9E; Thu, 19 Aug 2021 17:38:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JHcnCQ030498; Thu, 19 Aug 2021 17:38:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JHcn3A030497; Thu, 19 Aug 2021 17:38:49 GMT (envelope-from git) Date: Thu, 19 Aug 2021 17:38:49 GMT Message-Id: <202108191738.17JHcn3A030497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 298ee47e1988 - main - localedef: unbreak WITHOUT_LOCALES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 298ee47e1988a120249b24470c2c7c45f8c4359f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 17:38:49 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=298ee47e1988a120249b24470c2c7c45f8c4359f commit 298ee47e1988a120249b24470c2c7c45f8c4359f Author: Bjoern A. Zeeb AuthorDate: 2021-08-19 17:27:04 +0000 Commit: Kyle Evans CommitDate: 2021-08-19 17:38:17 +0000 localedef: unbreak WITHOUT_LOCALES After 0fa5403d493b ("pkgbase: move locales into their own package") we need usr.bin/localedef as a bootstrap tool independent on where WITHOUT_LOCALE was specified as we ALWAYS process C.UTF-8. At the same time LOCALES= in the local Makefile is empty but C.UTF-8 with WITHOUT_LOCALES. C.UTF-8 is excluded from FILES, and thus after the replacement FILES= is set to only .LC_CTYPE which results in a build failure not knowing how to build that. Tweak the substitution to replace only non-empty words so that FILES remains harmlessly empty. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31589 --- Makefile.inc1 | 3 +-- share/ctypedef/Makefile | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index eb69d660cede..5bb2412e4042 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2353,10 +2353,9 @@ ${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmminimal ${_bt}-usr.bin/clang/lldb-tblgen: ${_bt}-lib/clang/libllvmminimal .endif -.if ${MK_LOCALES} != "no" +# C.UTF-8 is always built in share/ctypes and we need localedef for that. _localedef= usr.bin/localedef ${_bt}-usr.bin/localedef: ${_bt}-usr.bin/yacc ${_bt_lex_depend} -.endif .if ${MK_ICONV} != "no" _mkesdb= usr.bin/mkesdb diff --git a/share/ctypedef/Makefile b/share/ctypedef/Makefile index 798576f7ad08..d8b00bfb8acc 100644 --- a/share/ctypedef/Makefile +++ b/share/ctypedef/Makefile @@ -218,7 +218,7 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) # C.UTF-8 is the default locale, so it should always been installed. ALWAYS= C.UTF-8.LC_CTYPE -FILES= ${LOCALES:NC.UTF-8:S/$/.LC_CTYPE/} +FILES= ${LOCALES:NC.UTF-8:C/.+$/&.LC_CTYPE/} CLEANFILES= ${FILES} .for f t in ${SAME} From owner-dev-commits-src-main@freebsd.org Thu Aug 19 17:48:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C77D2668FD3; Thu, 19 Aug 2021 17:48:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrC1L4vxbz3JnW; Thu, 19 Aug 2021 17:48:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 908CF1D0B; Thu, 19 Aug 2021 17:48:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JHmc4W043746; Thu, 19 Aug 2021 17:48:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JHmcCO043745; Thu, 19 Aug 2021 17:48:38 GMT (envelope-from git) Date: Thu, 19 Aug 2021 17:48:38 GMT Message-Id: <202108191748.17JHmcCO043745@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: db7f7446b5bc - main - crunchgen: sprinkle some const-poisoning around MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db7f7446b5bcb26c7aaf13c8151b4ae8051c5732 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 17:48:38 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=db7f7446b5bcb26c7aaf13c8151b4ae8051c5732 commit db7f7446b5bcb26c7aaf13c8151b4ae8051c5732 Author: Kyle Evans AuthorDate: 2021-08-19 06:13:13 +0000 Commit: Kyle Evans CommitDate: 2021-08-19 17:47:08 +0000 crunchgen: sprinkle some const-poisoning around Reviewed by: arichardson, imp Differential Revision: https://reviews.freebsd.org/D31607 --- usr.sbin/crunch/crunchgen/crunchgen.c | 10 +++++----- usr.sbin/crunch/crunchgen/mkskel.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c index 95ed5ca6636a..c6cf2a08cc7b 100644 --- a/usr.sbin/crunch/crunchgen/crunchgen.c +++ b/usr.sbin/crunch/crunchgen/crunchgen.c @@ -96,8 +96,8 @@ char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN]; char tempfname[MAXPATHLEN], cachename[MAXPATHLEN], curfilename[MAXPATHLEN]; bool tempfname_initialized = false; char outhdrname[MAXPATHLEN] ; /* user-supplied header for *.mk */ -char *objprefix; /* where are the objects ? */ -char *path_make; +const char *objprefix; /* where are the objects ? */ +const char *path_make; int linenum = -1; int goterror = 0; @@ -123,7 +123,7 @@ void usage(void); void parse_conf_file(void); void gen_outputs(void); -extern char *crunched_skel[]; +extern const char *crunched_skel[]; int @@ -721,7 +721,7 @@ fillin_program_objs(prog_t *p, char *path) char *obj, *cp; int fd, rc; FILE *f; - char *objvar="OBJS"; + const char *objvar="OBJS"; strlst_t *s; char line[MAXLINELEN]; @@ -912,7 +912,7 @@ gen_output_makefile(void) void gen_output_cfile(void) { - char **cp; + const char **cp; FILE *outcf; prog_t *p; strlst_t *s; diff --git a/usr.sbin/crunch/crunchgen/mkskel.sh b/usr.sbin/crunch/crunchgen/mkskel.sh index fd53d78bbbac..274bb7274cbd 100644 --- a/usr.sbin/crunch/crunchgen/mkskel.sh +++ b/usr.sbin/crunch/crunchgen/mkskel.sh @@ -4,7 +4,7 @@ cat < Delivered-To: dev-commits-src-main@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 329E3668FD6; Thu, 19 Aug 2021 17:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrC1N6wXBz3Jbt; Thu, 19 Aug 2021 17:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2B031D0D; Thu, 19 Aug 2021 17:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JHmeGd043802; Thu, 19 Aug 2021 17:48:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JHmep3043801; Thu, 19 Aug 2021 17:48:40 GMT (envelope-from git) Date: Thu, 19 Aug 2021 17:48:40 GMT Message-Id: <202108191748.17JHmep3043801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 7ff87026d65c - main - crunchide: static'ify remaining non-exported functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ff87026d65c77f90391ead3f2fc752223d16e01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 17:48:41 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=7ff87026d65c77f90391ead3f2fc752223d16e01 commit 7ff87026d65c77f90391ead3f2fc752223d16e01 Author: Kyle Evans AuthorDate: 2021-08-19 06:29:02 +0000 Commit: Kyle Evans CommitDate: 2021-08-19 17:47:32 +0000 crunchide: static'ify remaining non-exported functions Reviewed by: arichardson, imp Differential Revision: https://reviews.freebsd.org/D31609 --- usr.sbin/crunch/crunchide/crunchide.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usr.sbin/crunch/crunchide/crunchide.c b/usr.sbin/crunch/crunchide/crunchide.c index 324402501491..1f2f98893bac 100644 --- a/usr.sbin/crunch/crunchide/crunchide.c +++ b/usr.sbin/crunch/crunchide/crunchide.c @@ -78,12 +78,12 @@ __FBSDID("$FreeBSD$"); static const char *pname = "crunchide"; -void usage(void); +static void usage(void); -void add_to_keep_list(char *symbol); -void add_file_to_keep_list(char *filename); +static void add_to_keep_list(char *symbol); +static void add_file_to_keep_list(char *filename); -int hide_syms(const char *filename); +static int hide_syms(const char *filename); static int verbose; @@ -126,7 +126,7 @@ main(int argc, char **argv) return errors; } -void +static void usage(void) { fprintf(stderr, @@ -142,7 +142,7 @@ static struct keep { char *sym; } *keep_list; -void +static void add_to_keep_list(char *symbol) { struct keep *newp, *prevp, *curp; @@ -182,7 +182,7 @@ in_keep_list(const char *symbol) return curp && cmp == 0; } -void +static void add_file_to_keep_list(char *filename) { FILE *keepf; @@ -219,7 +219,7 @@ static struct { #endif }; -int +static int hide_syms(const char *filename) { int fd, i, n, rv; From owner-dev-commits-src-main@freebsd.org Thu Aug 19 17:48:39 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E3789668C33; Thu, 19 Aug 2021 17:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrC1M689yz3Jbl; Thu, 19 Aug 2021 17:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBAAF1D0C; Thu, 19 Aug 2021 17:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JHmdNI043770; Thu, 19 Aug 2021 17:48:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JHmdai043769; Thu, 19 Aug 2021 17:48:39 GMT (envelope-from git) Date: Thu, 19 Aug 2021 17:48:39 GMT Message-Id: <202108191748.17JHmdai043769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: dd7c7ff192d0 - main - crunchide: address complaints from WARNS=6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd7c7ff192d07912fb7f5874868649c3aa05944a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 17:48:40 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=dd7c7ff192d07912fb7f5874868649c3aa05944a commit dd7c7ff192d07912fb7f5874868649c3aa05944a Author: Kyle Evans AuthorDate: 2021-08-19 06:17:36 +0000 Commit: Kyle Evans CommitDate: 2021-08-19 17:47:18 +0000 crunchide: address complaints from WARNS=6 - One (1) constify - One (1) argument is unused - One (1) local shadows a global - Various globals that should be static Reviewed by: arichardson, imp Differential Revision: https://reviews.freebsd.org/D31608 --- usr.sbin/crunch/crunchide/crunchide.c | 8 ++++---- usr.sbin/crunch/crunchide/exec_elf32.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/usr.sbin/crunch/crunchide/crunchide.c b/usr.sbin/crunch/crunchide/crunchide.c index b7eba3995173..324402501491 100644 --- a/usr.sbin/crunch/crunchide/crunchide.c +++ b/usr.sbin/crunch/crunchide/crunchide.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -char *pname = "crunchide"; +static const char *pname = "crunchide"; void usage(void); @@ -85,7 +85,7 @@ void add_file_to_keep_list(char *filename); int hide_syms(const char *filename); -int verbose; +static int verbose; int main(int, char *[]); @@ -137,7 +137,7 @@ usage(void) /* ---------------------------- */ -struct keep { +static struct keep { struct keep *next; char *sym; } *keep_list; @@ -206,7 +206,7 @@ add_file_to_keep_list(char *filename) /* ---------------------------- */ -struct { +static struct { const char *name; int (*check)(int, const char *); /* 1 if match, zero if not */ int (*hide)(int, const char *); /* non-zero if error */ diff --git a/usr.sbin/crunch/crunchide/exec_elf32.c b/usr.sbin/crunch/crunchide/exec_elf32.c index 28641107cc5c..f7b8601911fe 100644 --- a/usr.sbin/crunch/crunchide/exec_elf32.c +++ b/usr.sbin/crunch/crunchide/exec_elf32.c @@ -155,7 +155,7 @@ xrealloc(void *ptr, size_t size, const char *fn, const char *use) } int -ELFNAMEEND(check)(int fd, const char *fn) +ELFNAMEEND(check)(int fd, const char *fn __unused) { Elf_Ehdr eh; struct stat sb; @@ -435,12 +435,12 @@ ELFNAMEEND(hide)(int fd, const char *fn) * update section header table in ascending order of offset */ for (i = strtabidx + 1; i < shnum; i++) { - Elf_Off off, align; - off = xewtoh(layoutp[i - 1].shdr->sh_offset) + + Elf_Off soff, align; + soff = xewtoh(layoutp[i - 1].shdr->sh_offset) + xewtoh(layoutp[i - 1].shdr->sh_size); align = xewtoh(layoutp[i].shdr->sh_addralign); - off = (off + (align - 1)) & ~(align - 1); - layoutp[i].shdr->sh_offset = htoxew(off); + soff = (soff + (align - 1)) & ~(align - 1); + layoutp[i].shdr->sh_offset = htoxew(soff); } /* From owner-dev-commits-src-main@freebsd.org Thu Aug 19 17:48:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A3BD36691D7; Thu, 19 Aug 2021 17:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrC1Q0wRpz3Jvj; Thu, 19 Aug 2021 17:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03F571E3B; Thu, 19 Aug 2021 17:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JHmfCH043829; Thu, 19 Aug 2021 17:48:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JHmfLs043828; Thu, 19 Aug 2021 17:48:41 GMT (envelope-from git) Date: Thu, 19 Aug 2021 17:48:41 GMT Message-Id: <202108191748.17JHmfLs043828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: bfd70233c3e2 - main - crunchgen: fix remaining issues under WARNS=6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bfd70233c3e2bc5c29db6f96fb90b58439908d29 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 17:48:42 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=bfd70233c3e2bc5c29db6f96fb90b58439908d29 commit bfd70233c3e2bc5c29db6f96fb90b58439908d29 Author: Kyle Evans AuthorDate: 2021-08-19 06:22:16 +0000 Commit: Kyle Evans CommitDate: 2021-08-19 17:47:48 +0000 crunchgen: fix remaining issues under WARNS=6 Entirely variables that should be static, save for one 'no previous declaration' in mkskel.sh. Reviewed by: arichardson, imp Differential Revision: https://reviews.freebsd.org/D31610 --- usr.sbin/crunch/crunchgen/crunchgen.c | 43 ++++++++++++++++++----------------- usr.sbin/crunch/crunchgen/mkskel.sh | 1 + 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c index c6cf2a08cc7b..94792c5ec50b 100644 --- a/usr.sbin/crunch/crunchgen/crunchgen.c +++ b/usr.sbin/crunch/crunchgen/crunchgen.c @@ -85,27 +85,28 @@ typedef struct prog { /* global state */ -strlst_t *buildopts = NULL; -strlst_t *srcdirs = NULL; -strlst_t *libs = NULL; -strlst_t *libs_so = NULL; -prog_t *progs = NULL; - -char confname[MAXPATHLEN], infilename[MAXPATHLEN]; -char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN]; -char tempfname[MAXPATHLEN], cachename[MAXPATHLEN], curfilename[MAXPATHLEN]; -bool tempfname_initialized = false; -char outhdrname[MAXPATHLEN] ; /* user-supplied header for *.mk */ -const char *objprefix; /* where are the objects ? */ -const char *path_make; -int linenum = -1; -int goterror = 0; - -int verbose, readcache; /* options */ -int reading_cache; -int makeobj = 0; /* add 'make obj' rules to the makefile */ - -int list_mode; +static strlst_t *buildopts = NULL; +static strlst_t *srcdirs = NULL; +static strlst_t *libs = NULL; +static strlst_t *libs_so = NULL; +static prog_t *progs = NULL; + +static char confname[MAXPATHLEN], infilename[MAXPATHLEN]; +static char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN]; +static char tempfname[MAXPATHLEN], cachename[MAXPATHLEN]; +static char curfilename[MAXPATHLEN]; +static bool tempfname_initialized = false; +static char outhdrname[MAXPATHLEN] ; /* user-supplied header for *.mk */ +static const char *objprefix; /* where are the objects ? */ +static const char *path_make; +static int linenum = -1; +static int goterror = 0; + +static int verbose, readcache; /* options */ +static int reading_cache; +static int makeobj = 0; /* add 'make obj' rules to the makefile */ + +static int list_mode; /* general library routines */ diff --git a/usr.sbin/crunch/crunchgen/mkskel.sh b/usr.sbin/crunch/crunchgen/mkskel.sh index 274bb7274cbd..3e5a1618e4ad 100644 --- a/usr.sbin/crunch/crunchgen/mkskel.sh +++ b/usr.sbin/crunch/crunchgen/mkskel.sh @@ -4,6 +4,7 @@ cat < Delivered-To: dev-commits-src-main@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 4DAB66692F8; Thu, 19 Aug 2021 17:48:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrC1R1kXRz3Jrn; Thu, 19 Aug 2021 17:48:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24C9D1B68; Thu, 19 Aug 2021 17:48:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JHmhkr043853; Thu, 19 Aug 2021 17:48:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JHmhZ0043852; Thu, 19 Aug 2021 17:48:43 GMT (envelope-from git) Date: Thu, 19 Aug 2021 17:48:43 GMT Message-Id: <202108191748.17JHmhZ0043852@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d59c5e023d55 - main - crunch: drop WARNS override MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d59c5e023d558161e4f519b88d5209d8bab18bc7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 17:48:43 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d59c5e023d558161e4f519b88d5209d8bab18bc7 commit d59c5e023d558161e4f519b88d5209d8bab18bc7 Author: Kyle Evans AuthorDate: 2021-08-19 06:33:13 +0000 Commit: Kyle Evans CommitDate: 2021-08-19 17:48:00 +0000 crunch: drop WARNS override crunchide and crunchgen now build fine with default WARNS --- usr.sbin/crunch/Makefile.inc | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/crunch/Makefile.inc b/usr.sbin/crunch/Makefile.inc index 36175b7e5258..f8ffe675db6e 100644 --- a/usr.sbin/crunch/Makefile.inc +++ b/usr.sbin/crunch/Makefile.inc @@ -2,5 +2,3 @@ # modify to taste BINDIR?= /usr/bin - -WARNS?= 2 From owner-dev-commits-src-main@freebsd.org Thu Aug 19 19:24:06 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7FC4166A8B8; Thu, 19 Aug 2021 19:24:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrF7V39X2z3jwy; Thu, 19 Aug 2021 19:24:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5633F3317; Thu, 19 Aug 2021 19:24:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17JJO6cW078700; Thu, 19 Aug 2021 19:24:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17JJO6WD078699; Thu, 19 Aug 2021 19:24:06 GMT (envelope-from git) Date: Thu, 19 Aug 2021 19:24:06 GMT Message-Id: <202108191924.17JJO6WD078699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: ced2dcadccfc - main - ls: prevent no-color build from complaining when COLORTERM is non-empty MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ced2dcadccfcff8f7991b3cb5f6f70d6710eadfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 19:24:06 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=ced2dcadccfcff8f7991b3cb5f6f70d6710eadfb commit ced2dcadccfcff8f7991b3cb5f6f70d6710eadfb Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-18 20:47:37 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-08-19 19:22:16 +0000 ls: prevent no-color build from complaining when COLORTERM is non-empty As 257886 reports, if ls(1) is built with WITHOUT_LS_COLORS="YES", it issues a warning whenever COLORTERM is non-empty. The warning is not useful, so I thought to remove it, but as Ed pointed out, we may want to have a way to determine whether a particular copy of ls has been compiled with color support or not. Therefore move the warnx() call to the getopt loop in a WITHOUT_LS_COLORS build to fire when the user asks for colored output. PR: 257886 Reported by: Marko Turk Reviewed by: kevans --- bin/ls/ls.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 338b3d1d2a26..92575711251d 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -105,9 +105,7 @@ static void traverse(int, char **, int); static const struct option long_opts[] = { -#ifdef COLORLS {"color", optional_argument, NULL, COLOR_OPT}, -#endif {NULL, no_argument, NULL, 0} }; @@ -448,8 +446,8 @@ main(int argc, char *argv[]) case 'y': f_samesort = 1; break; -#ifdef COLORLS case COLOR_OPT: +#ifdef COLORLS if (optarg == NULL || do_color_always(optarg)) colorflag = COLORFLAG_ALWAYS; else if (do_color_auto(optarg)) @@ -460,6 +458,8 @@ main(int argc, char *argv[]) errx(2, "unsupported --color value '%s' (must be always, auto, or never)", optarg); break; +#else + warnx("color support not compiled in"); #endif default: case '?': @@ -503,8 +503,6 @@ main(int argc, char *argv[]) f_color = 1; explicitansi = true; } -#else - warnx("color support not compiled in"); #endif /*COLORLS*/ } From owner-dev-commits-src-main@freebsd.org Fri Aug 20 07:55:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 76D7965B030; Fri, 20 Aug 2021 07:55:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrYpx2wDyz4wtq; Fri, 20 Aug 2021 07:55:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47C4F15790; Fri, 20 Aug 2021 07:55:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17K7trXa074998; Fri, 20 Aug 2021 07:55:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17K7trx6074997; Fri, 20 Aug 2021 07:55:53 GMT (envelope-from git) Date: Fri, 20 Aug 2021 07:55:53 GMT Message-Id: <202108200755.17K7trx6074997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: bcb195d91717 - main - Partial revert of f83f5d58394db57576bbed6dc7531997cabeb102 for uftdi(4). Apparently devices with bcdDevice less than 0x0600, have problems receiving ZLPs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bcb195d91717bf182d27b9ce8cf0e43595c6e763 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 07:55:53 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=bcb195d91717bf182d27b9ce8cf0e43595c6e763 commit bcb195d91717bf182d27b9ce8cf0e43595c6e763 Author: Hans Petter Selasky AuthorDate: 2021-08-20 07:52:32 +0000 Commit: Hans Petter Selasky CommitDate: 2021-08-20 07:54:34 +0000 Partial revert of f83f5d58394db57576bbed6dc7531997cabeb102 for uftdi(4). Apparently devices with bcdDevice less than 0x0600, have problems receiving ZLPs. Reported by: kevlo@ MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/serial/uftdi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c index eaf4a9e78086..7fd531b3e381 100644 --- a/sys/dev/usb/serial/uftdi.c +++ b/sys/dev/usb/serial/uftdi.c @@ -1117,7 +1117,7 @@ uftdi_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UFTDI_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); /* set a valid "lcr" value */ @@ -1215,9 +1215,6 @@ uftdi_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - /* * If output packets don't require headers (the common case) we * can just load the buffer up with payload bytes all at once. From owner-dev-commits-src-main@freebsd.org Fri Aug 20 07:59:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A57F365B49C; Fri, 20 Aug 2021 07:59:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrYvT4MPNz4x7t; Fri, 20 Aug 2021 07:59:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DF361562D; Fri, 20 Aug 2021 07:59:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17K7xn36075670; Fri, 20 Aug 2021 07:59:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17K7xnNX075669; Fri, 20 Aug 2021 07:59:49 GMT (envelope-from git) Date: Fri, 20 Aug 2021 07:59:49 GMT Message-Id: <202108200759.17K7xnNX075669@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 464a166c27bb - main - ufs_dirhash: Correct a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 464a166c27bb8947d5de1f617170ef6813587cc3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 07:59:49 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=464a166c27bb8947d5de1f617170ef6813587cc3 commit 464a166c27bb8947d5de1f617170ef6813587cc3 Author: Gordon Bergling AuthorDate: 2021-08-20 07:59:18 +0000 Commit: Gordon Bergling CommitDate: 2021-08-20 07:59:18 +0000 ufs_dirhash: Correct a typo in a comment - s/memry/memory/ MFC after: 3 days --- sys/ufs/ufs/dirhash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ufs/ufs/dirhash.h b/sys/ufs/ufs/dirhash.h index d38c1112ff5c..1f9097e58af3 100644 --- a/sys/ufs/ufs/dirhash.h +++ b/sys/ufs/ufs/dirhash.h @@ -66,7 +66,7 @@ * placed at the most-recently-used end of the list. This helps a lot * in the worst-case case scenario where every directory access is * to a directory that is not hashed (i.e. the working set of hash - * candidates is much larger than the configured memry limit). In this + * candidates is much larger than the configured memory limit). In this * case it limits the number of hash builds to 1/DH_SCOREINIT of the * number of accesses. */ From owner-dev-commits-src-main@freebsd.org Fri Aug 20 12:01:28 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6DDFE65F7AB; Fri, 20 Aug 2021 12:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrgGJ2k6nz3Prl; Fri, 20 Aug 2021 12:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45530188BC; Fri, 20 Aug 2021 12:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KC1SQ5006700; Fri, 20 Aug 2021 12:01:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KC1SmP006699; Fri, 20 Aug 2021 12:01:28 GMT (envelope-from git) Date: Fri, 20 Aug 2021 12:01:28 GMT Message-Id: <202108201201.17KC1SmP006699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: ce110ea12fce - main - Microsoft Azure Network Adapter(MANA) VF support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce110ea12fcea71ae437d0a1d0549d3d32055b0e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 12:01:28 -0000 The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=ce110ea12fcea71ae437d0a1d0549d3d32055b0e commit ce110ea12fcea71ae437d0a1d0549d3d32055b0e Author: Wei Hu AuthorDate: 2021-08-20 08:43:10 +0000 Commit: Wei Hu CommitDate: 2021-08-20 10:44:57 +0000 Microsoft Azure Network Adapter(MANA) VF support MANA is the new network adapter from Microsoft which will be available in Azure public cloud. It provides SRIOV NIC as virtual function to guest OS running on Hyper-V. The code can be divided into two major parts. Gdma_main.c is the one to bring up the hardware board and drives all underlying hardware queue infrastructure. Mana_en.c contains all main ethernet driver code. It has only tested and supported on amd64 architecture. PR: 256336 Reviewed by: decui@microsoft.com Tested by: whu MFC after: 2 week Relnotes: yes Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D31150 --- sys/conf/files.x86 | 6 + sys/dev/mana/gdma.h | 744 ++++++++++++ sys/dev/mana/gdma_main.c | 1961 ++++++++++++++++++++++++++++++++ sys/dev/mana/gdma_util.c | 96 ++ sys/dev/mana/gdma_util.h | 206 ++++ sys/dev/mana/hw_channel.c | 950 ++++++++++++++++ sys/dev/mana/hw_channel.h | 222 ++++ sys/dev/mana/mana.h | 689 +++++++++++ sys/dev/mana/mana_en.c | 2699 ++++++++++++++++++++++++++++++++++++++++++++ sys/dev/mana/mana_sysctl.c | 219 ++++ sys/dev/mana/mana_sysctl.h | 48 + sys/dev/mana/shm_channel.c | 337 ++++++ sys/dev/mana/shm_channel.h | 52 + sys/modules/Makefile | 2 + sys/modules/mana/Makefile | 12 + 15 files changed, 8243 insertions(+) diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index d0cda2da8580..925a3c5fe889 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -264,6 +264,12 @@ dev/isci/scil/scif_sas_task_request_states.c optional isci dev/isci/scil/scif_sas_timer.c optional isci dev/itwd/itwd.c optional itwd dev/kvm_clock/kvm_clock.c optional kvm_clock +dev/mana/gdma_main.c optional mana +dev/mana/mana_en.c optional mana +dev/mana/mana_sysctl.c optional mana +dev/mana/shm_channel.c optional mana +dev/mana/hw_channel.c optional mana +dev/mana/gdma_util.c optional mana dev/qat/qat.c optional qat dev/qat/qat_ae.c optional qat dev/qat/qat_c2xxx.c optional qat diff --git a/sys/dev/mana/gdma.h b/sys/dev/mana/gdma.h new file mode 100644 index 000000000000..097b2b65e545 --- /dev/null +++ b/sys/dev/mana/gdma.h @@ -0,0 +1,744 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Microsoft Corp. + * 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 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. + * + * $FreeBSD$ + * + */ + +#ifndef _GDMA_H +#define _GDMA_H + +#include +#include +#include +#include +#include + +#include "gdma_util.h" +#include "shm_channel.h" + +/* Structures labeled with "HW DATA" are exchanged with the hardware. All of + * them are naturally aligned and hence don't need __packed. + */ + +#define GDMA_BAR0 0 + +#define GDMA_IRQNAME_SZ 40 + +struct gdma_bus { + bus_space_handle_t bar0_h; + bus_space_tag_t bar0_t; +}; + +struct gdma_msix_entry { + int entry; + int vector; +}; + +enum gdma_request_type { + GDMA_VERIFY_VF_DRIVER_VERSION = 1, + GDMA_QUERY_MAX_RESOURCES = 2, + GDMA_LIST_DEVICES = 3, + GDMA_REGISTER_DEVICE = 4, + GDMA_DEREGISTER_DEVICE = 5, + GDMA_GENERATE_TEST_EQE = 10, + GDMA_CREATE_QUEUE = 12, + GDMA_DISABLE_QUEUE = 13, + GDMA_CREATE_DMA_REGION = 25, + GDMA_DMA_REGION_ADD_PAGES = 26, + GDMA_DESTROY_DMA_REGION = 27, +}; + +enum gdma_queue_type { + GDMA_INVALID_QUEUE, + GDMA_SQ, + GDMA_RQ, + GDMA_CQ, + GDMA_EQ, +}; + +enum gdma_work_request_flags { + GDMA_WR_NONE = 0, + GDMA_WR_OOB_IN_SGL = BIT(0), + GDMA_WR_PAD_BY_SGE0 = BIT(1), +}; + +enum gdma_eqe_type { + GDMA_EQE_COMPLETION = 3, + GDMA_EQE_TEST_EVENT = 64, + GDMA_EQE_HWC_INIT_EQ_ID_DB = 129, + GDMA_EQE_HWC_INIT_DATA = 130, + GDMA_EQE_HWC_INIT_DONE = 131, +}; + +enum { + GDMA_DEVICE_NONE = 0, + GDMA_DEVICE_HWC = 1, + GDMA_DEVICE_MANA = 2, +}; + + +struct gdma_resource { + /* Protect the bitmap */ + struct mtx lock_spin; + + /* The bitmap size in bits. */ + uint32_t size; + + /* The bitmap tracks the resources. */ + unsigned long *map; +}; + +union gdma_doorbell_entry { + uint64_t as_uint64; + + struct { + uint64_t id : 24; + uint64_t reserved : 8; + uint64_t tail_ptr : 31; + uint64_t arm : 1; + } cq; + + struct { + uint64_t id : 24; + uint64_t wqe_cnt : 8; + uint64_t tail_ptr : 32; + } rq; + + struct { + uint64_t id : 24; + uint64_t reserved : 8; + uint64_t tail_ptr : 32; + } sq; + + struct { + uint64_t id : 16; + uint64_t reserved : 16; + uint64_t tail_ptr : 31; + uint64_t arm : 1; + } eq; +}; /* HW DATA */ + +struct gdma_msg_hdr { + uint32_t hdr_type; + uint32_t msg_type; + uint16_t msg_version; + uint16_t hwc_msg_id; + uint32_t msg_size; +}; /* HW DATA */ + +struct gdma_dev_id { + union { + struct { + uint16_t type; + uint16_t instance; + }; + + uint32_t as_uint32; + }; +}; /* HW DATA */ + +struct gdma_req_hdr { + struct gdma_msg_hdr req; + struct gdma_msg_hdr resp; /* The expected response */ + struct gdma_dev_id dev_id; + uint32_t activity_id; +}; /* HW DATA */ + +struct gdma_resp_hdr { + struct gdma_msg_hdr response; + struct gdma_dev_id dev_id; + uint32_t activity_id; + uint32_t status; + uint32_t reserved; +}; /* HW DATA */ + +struct gdma_general_req { + struct gdma_req_hdr hdr; +}; /* HW DATA */ + +#define GDMA_MESSAGE_V1 1 + +struct gdma_general_resp { + struct gdma_resp_hdr hdr; +}; /* HW DATA */ + +#define GDMA_STANDARD_HEADER_TYPE 0 + +static inline void +mana_gd_init_req_hdr(struct gdma_req_hdr *hdr, uint32_t code, + uint32_t req_size, uint32_t resp_size) +{ + hdr->req.hdr_type = GDMA_STANDARD_HEADER_TYPE; + hdr->req.msg_type = code; + hdr->req.msg_version = GDMA_MESSAGE_V1; + hdr->req.msg_size = req_size; + + hdr->resp.hdr_type = GDMA_STANDARD_HEADER_TYPE; + hdr->resp.msg_type = code; + hdr->resp.msg_version = GDMA_MESSAGE_V1; + hdr->resp.msg_size = resp_size; +} + +/* The 16-byte struct is part of the GDMA work queue entry (WQE). */ +struct gdma_sge { + uint64_t address; + uint32_t mem_key; + uint32_t size; +}; /* HW DATA */ + +struct gdma_wqe_request { + struct gdma_sge *sgl; + uint32_t num_sge; + + uint32_t inline_oob_size; + const void *inline_oob_data; + + uint32_t flags; + uint32_t client_data_unit; +}; + +enum gdma_page_type { + GDMA_PAGE_TYPE_4K, +}; + +#define GDMA_INVALID_DMA_REGION 0 + +struct gdma_mem_info { + device_t dev; + + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + bus_addr_t dma_handle; /* Physical address */ + void *virt_addr; /* Virtual address */ + uint64_t length; + + /* Allocated by the PF driver */ + uint64_t gdma_region; +}; + +#define REGISTER_ATB_MST_MKEY_LOWER_SIZE 8 + +struct gdma_dev { + struct gdma_context *gdma_context; + + struct gdma_dev_id dev_id; + + uint32_t pdid; + uint32_t doorbell; + uint32_t gpa_mkey; + + /* GDMA driver specific pointer */ + void *driver_data; +}; + +#define MINIMUM_SUPPORTED_PAGE_SIZE PAGE_SIZE + +#define GDMA_CQE_SIZE 64 +#define GDMA_EQE_SIZE 16 +#define GDMA_MAX_SQE_SIZE 512 +#define GDMA_MAX_RQE_SIZE 256 + +#define GDMA_COMP_DATA_SIZE 0x3C + +#define GDMA_EVENT_DATA_SIZE 0xC + +/* The WQE size must be a multiple of the Basic Unit, which is 32 bytes. */ +#define GDMA_WQE_BU_SIZE 32 + +#define INVALID_PDID UINT_MAX +#define INVALID_DOORBELL UINT_MAX +#define INVALID_MEM_KEY UINT_MAX +#define INVALID_QUEUE_ID UINT_MAX +#define INVALID_PCI_MSIX_INDEX UINT_MAX + +struct gdma_comp { + uint32_t cqe_data[GDMA_COMP_DATA_SIZE / 4]; + uint32_t wq_num; + bool is_sq; +}; + +struct gdma_event { + uint32_t details[GDMA_EVENT_DATA_SIZE / 4]; + uint8_t type; +}; + +struct gdma_queue; + +#define CQE_POLLING_BUFFER 512 + +typedef void gdma_eq_callback(void *context, struct gdma_queue *q, + struct gdma_event *e); + +typedef void gdma_cq_callback(void *context, struct gdma_queue *q); + +/* The 'head' is the producer index. For SQ/RQ, when the driver posts a WQE + * (Note: the WQE size must be a multiple of the 32-byte Basic Unit), the + * driver increases the 'head' in BUs rather than in bytes, and notifies + * the HW of the updated head. For EQ/CQ, the driver uses the 'head' to track + * the HW head, and increases the 'head' by 1 for every processed EQE/CQE. + * + * The 'tail' is the consumer index for SQ/RQ. After the CQE of the SQ/RQ is + * processed, the driver increases the 'tail' to indicate that WQEs have + * been consumed by the HW, so the driver can post new WQEs into the SQ/RQ. + * + * The driver doesn't use the 'tail' for EQ/CQ, because the driver ensures + * that the EQ/CQ is big enough so they can't overflow, and the driver uses + * the owner bits mechanism to detect if the queue has become empty. + */ +struct gdma_queue { + struct gdma_dev *gdma_dev; + + enum gdma_queue_type type; + uint32_t id; + + struct gdma_mem_info mem_info; + + void *queue_mem_ptr; + uint32_t queue_size; + + bool monitor_avl_buf; + + uint32_t head; + uint32_t tail; + + /* Extra fields specific to EQ/CQ. */ + union { + struct { + bool disable_needed; + + gdma_eq_callback *callback; + void *context; + + unsigned int msix_index; + + uint32_t log2_throttle_limit; + + struct task cleanup_task; + struct taskqueue *cleanup_tq; + int cpu; + bool do_not_ring_db; + + int work_done; + int budget; + } eq; + + struct { + gdma_cq_callback *callback; + void *context; + + /* For CQ/EQ relationship */ + struct gdma_queue *parent; + } cq; + }; +}; + +struct gdma_queue_spec { + enum gdma_queue_type type; + bool monitor_avl_buf; + unsigned int queue_size; + + /* Extra fields specific to EQ/CQ. */ + union { + struct { + gdma_eq_callback *callback; + void *context; + + unsigned long log2_throttle_limit; + + /* Only used by the MANA device. */ + struct ifnet *ndev; + } eq; + + struct { + gdma_cq_callback *callback; + void *context; + + struct gdma_queue *parent_eq; + + } cq; + }; +}; + +struct mana_eq { + struct gdma_queue *eq; + struct gdma_comp cqe_poll[CQE_POLLING_BUFFER]; +}; + +struct gdma_irq_context { + struct gdma_msix_entry msix_e; + struct resource *res; + driver_intr_t *handler; + void *arg; + void *cookie; + bool requested; + int cpu; + char name[GDMA_IRQNAME_SZ]; +}; + +struct gdma_context { + device_t dev; + + struct gdma_bus gd_bus; + + /* Per-vPort max number of queues */ + unsigned int max_num_queues; + unsigned int max_num_msix; + unsigned int num_msix_usable; + struct gdma_resource msix_resource; + struct gdma_irq_context *irq_contexts; + + /* This maps a CQ index to the queue structure. */ + unsigned int max_num_cqs; + struct gdma_queue **cq_table; + + /* Protect eq_test_event and test_event_eq_id */ + struct sx eq_test_event_sx; + struct completion eq_test_event; + uint32_t test_event_eq_id; + + struct resource *bar0; + struct resource *msix; + int msix_rid; + void __iomem *shm_base; + void __iomem *db_page_base; + uint32_t db_page_size; + + /* Shared memory chanenl (used to bootstrap HWC) */ + struct shm_channel shm_channel; + + /* Hardware communication channel (HWC) */ + struct gdma_dev hwc; + + /* Azure network adapter */ + struct gdma_dev mana; +}; + +#define MAX_NUM_GDMA_DEVICES 4 + +static inline bool mana_gd_is_mana(struct gdma_dev *gd) +{ + return gd->dev_id.type == GDMA_DEVICE_MANA; +} + +static inline bool mana_gd_is_hwc(struct gdma_dev *gd) +{ + return gd->dev_id.type == GDMA_DEVICE_HWC; +} + +uint8_t *mana_gd_get_wqe_ptr(const struct gdma_queue *wq, uint32_t wqe_offset); +uint32_t mana_gd_wq_avail_space(struct gdma_queue *wq); + +int mana_gd_test_eq(struct gdma_context *gc, struct gdma_queue *eq); + +int mana_gd_create_hwc_queue(struct gdma_dev *gd, + const struct gdma_queue_spec *spec, + struct gdma_queue **queue_ptr); + +int mana_gd_create_mana_eq(struct gdma_dev *gd, + const struct gdma_queue_spec *spec, + struct gdma_queue **queue_ptr); + +int mana_gd_create_mana_wq_cq(struct gdma_dev *gd, + const struct gdma_queue_spec *spec, + struct gdma_queue **queue_ptr); + +void mana_gd_destroy_queue(struct gdma_context *gc, struct gdma_queue *queue); + +int mana_gd_poll_cq(struct gdma_queue *cq, struct gdma_comp *comp, int num_cqe); + +void mana_gd_arm_cq(struct gdma_queue *cq); + +struct gdma_wqe { + uint32_t reserved :24; + uint32_t last_vbytes :8; + + union { + uint32_t flags; + + struct { + uint32_t num_sge :8; + uint32_t inline_oob_size_div4 :3; + uint32_t client_oob_in_sgl :1; + uint32_t reserved1 :4; + uint32_t client_data_unit :14; + uint32_t reserved2 :2; + }; + }; +}; /* HW DATA */ + +#define INLINE_OOB_SMALL_SIZE 8 +#define INLINE_OOB_LARGE_SIZE 24 + +#define MAX_TX_WQE_SIZE 512 +#define MAX_RX_WQE_SIZE 256 + +struct gdma_cqe { + uint32_t cqe_data[GDMA_COMP_DATA_SIZE / 4]; + + union { + uint32_t as_uint32; + + struct { + uint32_t wq_num :24; + uint32_t is_sq :1; + uint32_t reserved :4; + uint32_t owner_bits :3; + }; + } cqe_info; +}; /* HW DATA */ + +#define GDMA_CQE_OWNER_BITS 3 + +#define GDMA_CQE_OWNER_MASK ((1 << GDMA_CQE_OWNER_BITS) - 1) + +#define SET_ARM_BIT 1 + +#define GDMA_EQE_OWNER_BITS 3 + +union gdma_eqe_info { + uint32_t as_uint32; + + struct { + uint32_t type : 8; + uint32_t reserved1 : 8; + uint32_t client_id : 2; + uint32_t reserved2 : 11; + uint32_t owner_bits : 3; + }; +}; /* HW DATA */ + +#define GDMA_EQE_OWNER_MASK ((1 << GDMA_EQE_OWNER_BITS) - 1) +#define INITIALIZED_OWNER_BIT(log2_num_entries) (1UL << (log2_num_entries)) + +struct gdma_eqe { + uint32_t details[GDMA_EVENT_DATA_SIZE / 4]; + uint32_t eqe_info; +}; /* HW DATA */ + +#define GDMA_REG_DB_PAGE_OFFSET 8 +#define GDMA_REG_DB_PAGE_SIZE 0x10 +#define GDMA_REG_SHM_OFFSET 0x18 + +struct gdma_posted_wqe_info { + uint32_t wqe_size_in_bu; +}; + +/* GDMA_GENERATE_TEST_EQE */ +struct gdma_generate_test_event_req { + struct gdma_req_hdr hdr; + uint32_t queue_index; +}; /* HW DATA */ + +/* GDMA_VERIFY_VF_DRIVER_VERSION */ +enum { + GDMA_PROTOCOL_V1 = 1, + GDMA_PROTOCOL_FIRST = GDMA_PROTOCOL_V1, + GDMA_PROTOCOL_LAST = GDMA_PROTOCOL_V1, +}; + +struct gdma_verify_ver_req { + struct gdma_req_hdr hdr; + + /* Mandatory fields required for protocol establishment */ + uint64_t protocol_ver_min; + uint64_t protocol_ver_max; + uint64_t drv_cap_flags1; + uint64_t drv_cap_flags2; + uint64_t drv_cap_flags3; + uint64_t drv_cap_flags4; + + /* Advisory fields */ + uint64_t drv_ver; + uint32_t os_type; /* Linux = 0x10; Windows = 0x20; Other = 0x30 */ + uint32_t reserved; + uint32_t os_ver_major; + uint32_t os_ver_minor; + uint32_t os_ver_build; + uint32_t os_ver_platform; + uint64_t reserved_2; + uint8_t os_ver_str1[128]; + uint8_t os_ver_str2[128]; + uint8_t os_ver_str3[128]; + uint8_t os_ver_str4[128]; +}; /* HW DATA */ + +struct gdma_verify_ver_resp { + struct gdma_resp_hdr hdr; + uint64_t gdma_protocol_ver; + uint64_t pf_cap_flags1; + uint64_t pf_cap_flags2; + uint64_t pf_cap_flags3; + uint64_t pf_cap_flags4; +}; /* HW DATA */ + +/* GDMA_QUERY_MAX_RESOURCES */ +struct gdma_query_max_resources_resp { + struct gdma_resp_hdr hdr; + uint32_t status; + uint32_t max_sq; + uint32_t max_rq; + uint32_t max_cq; + uint32_t max_eq; + uint32_t max_db; + uint32_t max_mst; + uint32_t max_cq_mod_ctx; + uint32_t max_mod_cq; + uint32_t max_msix; +}; /* HW DATA */ + +/* GDMA_LIST_DEVICES */ +struct gdma_list_devices_resp { + struct gdma_resp_hdr hdr; + uint32_t num_of_devs; + uint32_t reserved; + struct gdma_dev_id devs[64]; +}; /* HW DATA */ + +/* GDMA_REGISTER_DEVICE */ +struct gdma_register_device_resp { + struct gdma_resp_hdr hdr; + uint32_t pdid; + uint32_t gpa_mkey; + uint32_t db_id; +}; /* HW DATA */ + +/* GDMA_CREATE_QUEUE */ +struct gdma_create_queue_req { + struct gdma_req_hdr hdr; + uint32_t type; + uint32_t reserved1; + uint32_t pdid; + uint32_t doolbell_id; + uint64_t gdma_region; + uint32_t reserved2; + uint32_t queue_size; + uint32_t log2_throttle_limit; + uint32_t eq_pci_msix_index; + uint32_t cq_mod_ctx_id; + uint32_t cq_parent_eq_id; + uint8_t rq_drop_on_overrun; + uint8_t rq_err_on_wqe_overflow; + uint8_t rq_chain_rec_wqes; + uint8_t sq_hw_db; + uint32_t reserved3; +}; /* HW DATA */ + +struct gdma_create_queue_resp { + struct gdma_resp_hdr hdr; + uint32_t queue_index; +}; /* HW DATA */ + +/* GDMA_DISABLE_QUEUE */ +struct gdma_disable_queue_req { + struct gdma_req_hdr hdr; + uint32_t type; + uint32_t queue_index; + uint32_t alloc_res_id_on_creation; +}; /* HW DATA */ + +/* GDMA_CREATE_DMA_REGION */ +struct gdma_create_dma_region_req { + struct gdma_req_hdr hdr; + + /* The total size of the DMA region */ + uint64_t length; + + /* The offset in the first page */ + uint32_t offset_in_page; + + /* enum gdma_page_type */ + uint32_t gdma_page_type; + + /* The total number of pages */ + uint32_t page_count; + + /* If page_addr_list_len is smaller than page_count, + * the remaining page addresses will be added via the + * message GDMA_DMA_REGION_ADD_PAGES. + */ + uint32_t page_addr_list_len; + uint64_t page_addr_list[]; +}; /* HW DATA */ + +struct gdma_create_dma_region_resp { + struct gdma_resp_hdr hdr; + uint64_t gdma_region; +}; /* HW DATA */ + +/* GDMA_DMA_REGION_ADD_PAGES */ +struct gdma_dma_region_add_pages_req { + struct gdma_req_hdr hdr; + + uint64_t gdma_region; + + uint32_t page_addr_list_len; + uint32_t reserved3; + + uint64_t page_addr_list[]; +}; /* HW DATA */ + +/* GDMA_DESTROY_DMA_REGION */ +struct gdma_destroy_dma_region_req { + struct gdma_req_hdr hdr; + + uint64_t gdma_region; +}; /* HW DATA */ + +int mana_gd_verify_vf_version(device_t dev); + +int mana_gd_register_device(struct gdma_dev *gd); +int mana_gd_deregister_device(struct gdma_dev *gd); + +int mana_gd_post_work_request(struct gdma_queue *wq, + const struct gdma_wqe_request *wqe_req, + struct gdma_posted_wqe_info *wqe_info); + +int mana_gd_post_and_ring(struct gdma_queue *queue, + const struct gdma_wqe_request *wqe, + struct gdma_posted_wqe_info *wqe_info); + +int mana_gd_alloc_res_map(uint32_t res_avil, struct gdma_resource *r, + const char *lock_name); +void mana_gd_free_res_map(struct gdma_resource *r); + +void mana_gd_wq_ring_doorbell(struct gdma_context *gc, + struct gdma_queue *queue); + +int mana_gd_alloc_memory(struct gdma_context *gc, unsigned int length, + struct gdma_mem_info *gmi); + +void mana_gd_free_memory(struct gdma_mem_info *gmi); + +void mana_gd_dma_map_paddr(void *arg, bus_dma_segment_t *segs, + int nseg, int error); + +int mana_gd_send_request(struct gdma_context *gc, uint32_t req_len, + const void *req, uint32_t resp_len, void *resp); +#endif /* _GDMA_H */ diff --git a/sys/dev/mana/gdma_main.c b/sys/dev/mana/gdma_main.c new file mode 100644 index 000000000000..910992ce17a4 --- /dev/null +++ b/sys/dev/mana/gdma_main.c @@ -0,0 +1,1961 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Microsoft Corp. + * 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 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. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include "gdma_util.h" +#include "mana.h" + + +static mana_vendor_id_t mana_id_table[] = { + { PCI_VENDOR_ID_MICROSOFT, PCI_DEV_ID_MANA_VF}, + /* Last entry */ + { 0, 0} +}; + +static inline uint32_t +mana_gd_r32(struct gdma_context *g, uint64_t offset) +{ + uint32_t v = bus_space_read_4(g->gd_bus.bar0_t, + g->gd_bus.bar0_h, offset); + rmb(); + return (v); +} + +#if defined(__amd64__) +static inline uint64_t +mana_gd_r64(struct gdma_context *g, uint64_t offset) +{ + uint64_t v = bus_space_read_8(g->gd_bus.bar0_t, + g->gd_bus.bar0_h, offset); + rmb(); + return (v); +} +#else +static inline uint64_t +mana_gd_r64(struct gdma_context *g, uint64_t offset) +{ + uint64_t v; + uint32_t *vp = (uint32_t *)&v; + + *vp = mana_gd_r32(g, offset); + *(vp + 1) = mana_gd_r32(g, offset + 4); + rmb(); + return (v); +} +#endif + +static int +mana_gd_query_max_resources(device_t dev) +{ + struct gdma_context *gc = device_get_softc(dev); + struct gdma_query_max_resources_resp resp = {}; + struct gdma_general_req req = {}; + int err; + + mana_gd_init_req_hdr(&req.hdr, GDMA_QUERY_MAX_RESOURCES, + sizeof(req), sizeof(resp)); + + err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp); + if (err || resp.hdr.status) { + device_printf(gc->dev, + "Failed to query resource info: %d, 0x%x\n", + err, resp.hdr.status); + return err ? err : EPROTO; + } + + mana_dbg(NULL, "max_msix %u, max_eq %u, max_cq %u, " + "max_sq %u, max_rq %u\n", + resp.max_msix, resp.max_eq, resp.max_cq, + resp.max_sq, resp.max_rq); + + if (gc->num_msix_usable > resp.max_msix) + gc->num_msix_usable = resp.max_msix; + + if (gc->num_msix_usable <= 1) + return ENOSPC; + + gc->max_num_queues = mp_ncpus; + if (gc->max_num_queues > MANA_MAX_NUM_QUEUES) + gc->max_num_queues = MANA_MAX_NUM_QUEUES; + + if (gc->max_num_queues > resp.max_eq) + gc->max_num_queues = resp.max_eq; + + if (gc->max_num_queues > resp.max_cq) + gc->max_num_queues = resp.max_cq; + + if (gc->max_num_queues > resp.max_sq) + gc->max_num_queues = resp.max_sq; + + if (gc->max_num_queues > resp.max_rq) + gc->max_num_queues = resp.max_rq; + + return 0; +} + +static int +mana_gd_detect_devices(device_t dev) +{ + struct gdma_context *gc = device_get_softc(dev); + struct gdma_list_devices_resp resp = {}; + struct gdma_general_req req = {}; + struct gdma_dev_id gd_dev; + uint32_t i, max_num_devs; + uint16_t dev_type; + int err; + + mana_gd_init_req_hdr(&req.hdr, GDMA_LIST_DEVICES, sizeof(req), + sizeof(resp)); + + err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp); + if (err || resp.hdr.status) { + device_printf(gc->dev, + "Failed to detect devices: %d, 0x%x\n", err, + resp.hdr.status); *** 7409 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri Aug 20 12:11:40 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4FE0965FBA6; Fri, 20 Aug 2021 12:11:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrgV41lXVz3gyH; Fri, 20 Aug 2021 12:11:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24B3C187D5; Fri, 20 Aug 2021 12:11:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KCBeFt021550; Fri, 20 Aug 2021 12:11:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KCBeNX021549; Fri, 20 Aug 2021 12:11:40 GMT (envelope-from git) Date: Fri, 20 Aug 2021 12:11:40 GMT Message-Id: <202108201211.17KCBeNX021549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: a3665770d7d8 - main - sctp: improve handling of illegal parameters of INIT-ACK chunks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3665770d7d85e990f7703170a27f8e2d3e455b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 12:11:40 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=a3665770d7d85e990f7703170a27f8e2d3e455b5 commit a3665770d7d85e990f7703170a27f8e2d3e455b5 Author: Michael Tuexen AuthorDate: 2021-08-20 12:03:49 +0000 Commit: Michael Tuexen CommitDate: 2021-08-20 12:06:41 +0000 sctp: improve handling of illegal parameters of INIT-ACK chunks MFC after: 3 days --- sys/netinet/sctp_input.c | 69 ++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 43 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 66ec2d6a577a..f579d10333fb 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1244,26 +1244,23 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, "sctp_handle_init_ack: TCB is null\n"); return (-1); } - init_ack = &cp->init; - /* Validate parameters. */ - if ((ntohl(init_ack->initiate_tag) == 0) || - (ntohl(init_ack->a_rwnd) < SCTP_MIN_RWND) || - (ntohs(init_ack->num_inbound_streams) == 0) || - (ntohs(init_ack->num_outbound_streams) == 0)) { - /* protocol error... send an abort */ - op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, ""); - sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, - src, dst, sh, op_err, - mflowtype, mflowid, - vrf_id, net->port); - *abort_no_unlock = 1; - return (-1); - } - /* process according to association state... */ - switch (SCTP_GET_STATE(stcb)) { - case SCTP_STATE_COOKIE_WAIT: - /* this is the expected state for this chunk */ - /* process the INIT-ACK parameters */ + /* Only process the INIT-ACK chunk in COOKIE WAIT state. */ + if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) { + init_ack = &cp->init; + /* Validate parameters. */ + if ((ntohl(init_ack->initiate_tag) == 0) || + (ntohl(init_ack->a_rwnd) < SCTP_MIN_RWND) || + (ntohs(init_ack->num_inbound_streams) == 0) || + (ntohs(init_ack->num_outbound_streams) == 0)) { + /* One of the mandatory parameters is illegal. */ + op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, ""); + sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, + src, dst, sh, op_err, + mflowtype, mflowid, + vrf_id, net->port); + *abort_no_unlock = 1; + return (-1); + } if (stcb->asoc.primary_destination->dest_state & SCTP_ADDR_UNCONFIRMED) { /* @@ -1284,11 +1281,11 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, /* error in parsing parameters */ return (-1); } - /* update our state */ + /* Update our state. */ SCTPDBG(SCTP_DEBUG_INPUT2, "moving to COOKIE-ECHOED state\n"); SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_ECHOED); - /* reset the RTO calc */ + /* Reset the RTO calculation. */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, @@ -1299,34 +1296,20 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, stcb->asoc.overall_error_count = 0; (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); /* - * collapse the init timer back in case of a exponential - * backoff + * Collapse the init timer back in case of a exponential + * backoff. */ sctp_timer_start(SCTP_TIMER_TYPE_COOKIE, stcb->sctp_ep, stcb, net); /* - * the send at the end of the inbound data processing will - * cause the cookie to be sent + * The output routine at the end of the inbound data + * processing will cause the cookie to be sent. */ - break; - case SCTP_STATE_SHUTDOWN_SENT: - /* incorrect state... discard */ - break; - case SCTP_STATE_COOKIE_ECHOED: - /* incorrect state... discard */ - break; - case SCTP_STATE_OPEN: - /* incorrect state... discard */ - break; - case SCTP_STATE_EMPTY: - case SCTP_STATE_INUSE: - default: - /* incorrect state... discard */ + SCTPDBG(SCTP_DEBUG_INPUT1, "Leaving handle-init-ack end\n"); + return (0); + } else { return (-1); - break; } - SCTPDBG(SCTP_DEBUG_INPUT1, "Leaving handle-init-ack end\n"); - return (0); } static struct sctp_tcb * From owner-dev-commits-src-main@freebsd.org Fri Aug 20 13:58:39 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9BCD166112A; Fri, 20 Aug 2021 13:58:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrjsW3zdxz3s5P; Fri, 20 Aug 2021 13:58:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 718FF1A254; Fri, 20 Aug 2021 13:58:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KDwdH4057293; Fri, 20 Aug 2021 13:58:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KDwdoN057292; Fri, 20 Aug 2021 13:58:39 GMT (envelope-from git) Date: Fri, 20 Aug 2021 13:58:39 GMT Message-Id: <202108201358.17KDwdoN057292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 719b5397c288 - main - libpfctl: Fix endianness issues MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 719b5397c2887bc0619bb6ffb38f67f37bbf13c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 13:58:39 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=719b5397c2887bc0619bb6ffb38f67f37bbf13c6 commit 719b5397c2887bc0619bb6ffb38f67f37bbf13c6 Author: Kristof Provost AuthorDate: 2021-08-20 11:43:15 +0000 Commit: Kristof Provost CommitDate: 2021-08-20 11:53:48 +0000 libpfctl: Fix endianness issues Several fields are supplied in big-endian format, so we need to convert them before we display them. MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/libpfctl/libpfctl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index ced130820d7d..7f1e72513018 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -671,11 +671,11 @@ pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s pf_state_peer_export_to_state_peer(&ps->src, &s->src); pf_state_peer_export_to_state_peer(&ps->dst, &s->dst); bcopy(&s->rt_addr, &ps->rt_addr, sizeof(ps->rt_addr)); - ps->rule = s->rule; - ps->anchor = s->anchor; - ps->nat_rule = s->nat_rule; - ps->creation = s->creation; - ps->expire = s->expire; + ps->rule = ntohl(s->rule); + ps->anchor = ntohl(s->anchor); + ps->nat_rule = ntohl(s->nat_rule); + ps->creation = ntohl(s->creation); + ps->expire = ntohl(s->expire); ps->packets[0] = s->packets[0]; ps->packets[1] = s->packets[1]; ps->bytes[0] = s->bytes[0]; From owner-dev-commits-src-main@freebsd.org Fri Aug 20 14:03:37 2021 Return-Path: Delivered-To: dev-commits-src-main@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 618BC6610E5; Fri, 20 Aug 2021 14:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrjzF2C9kz3sTS; Fri, 20 Aug 2021 14:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 340E31A615; Fri, 20 Aug 2021 14:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KE3bMs071445; Fri, 20 Aug 2021 14:03:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KE3brs071444; Fri, 20 Aug 2021 14:03:37 GMT (envelope-from git) Date: Fri, 20 Aug 2021 14:03:37 GMT Message-Id: <202108201403.17KE3brs071444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: e3c5965c259f - main - mpr(4): Handle mprsas_alloc_tm() errors on device removal. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3c5965c259f7029afe01612b248c3acf9f5b3e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 14:03:37 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e3c5965c259f7029afe01612b248c3acf9f5b3e0 commit e3c5965c259f7029afe01612b248c3acf9f5b3e0 Author: Alexander Motin AuthorDate: 2021-08-20 13:46:51 +0000 Commit: Alexander Motin CommitDate: 2021-08-20 14:03:32 +0000 mpr(4): Handle mprsas_alloc_tm() errors on device removal. SAS9305-16e with firmware 16.00.01.00 report HighPriorityCredit of only 8, while for comparison some other combinations I have report 100 or even 128. In case of large JBOD detach requirement to send target reset command to each target same time overflows the limit, and without adequate handling makes devices stuck in half-detached state, preventing later re-attach. To handle that in case of allocation error mark the target with new MPRSAS_TARGET_TOREMOVE flag, and retry the removal attempt next time something else free high priority command. With this patch I can successfully detach/attach 102 disk JBOD from/to the SAS9305-16e. MFC after: 2 weeks Sponsored by: iXsystems, Inc. --- sys/dev/mpr/mpr_sas.c | 36 ++++++++++++++++++++++++++++++++---- sys/dev/mpr/mpr_sas.h | 4 ++-- sys/dev/mpr/mpr_sas_lsi.c | 1 + sys/dev/mpr/mprvar.h | 5 +++++ 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c index f529fdf23d52..e1739028dd8f 100644 --- a/sys/dev/mpr/mpr_sas.c +++ b/sys/dev/mpr/mpr_sas.c @@ -412,6 +412,34 @@ mprsas_remove_volume(struct mpr_softc *sc, struct mpr_command *tm) mprsas_free_tm(sc, tm); } +/* + * Retry mprsas_prepare_remove() if some previous attempt failed to allocate + * high priority command due to limit reached. + */ +void +mprsas_prepare_remove_retry(struct mprsas_softc *sassc) +{ + struct mprsas_target *target; + int i; + + if ((sassc->flags & MPRSAS_TOREMOVE) == 0) + return; + + for (i = 0; i < sassc->maxtargets; i++) { + target = &sassc->targets[i]; + if ((target->flags & MPRSAS_TARGET_TOREMOVE) == 0) + continue; + if (TAILQ_EMPTY(&sassc->sc->high_priority_req_list)) + return; + target->flags &= ~MPRSAS_TARGET_TOREMOVE; + if (target->flags & MPR_TARGET_FLAGS_VOLUME) + mprsas_prepare_volume_remove(sassc, target->handle); + else + mprsas_prepare_remove(sassc, target->handle); + } + sassc->flags &= ~MPRSAS_TOREMOVE; +} + /* * No Need to call "MPI2_SAS_OP_REMOVE_DEVICE" For Volume removal. * Otherwise Volume Delete is same as Bare Drive Removal. @@ -440,8 +468,8 @@ mprsas_prepare_volume_remove(struct mprsas_softc *sassc, uint16_t handle) cm = mprsas_alloc_tm(sc); if (cm == NULL) { - mpr_dprint(sc, MPR_ERROR, - "%s: command alloc failure\n", __func__); + targ->flags |= MPRSAS_TARGET_TOREMOVE; + sassc->flags |= MPRSAS_TOREMOVE; return; } @@ -506,8 +534,8 @@ mprsas_prepare_remove(struct mprsas_softc *sassc, uint16_t handle) tm = mprsas_alloc_tm(sc); if (tm == NULL) { - mpr_dprint(sc, MPR_ERROR, "%s: command alloc failure\n", - __func__); + targ->flags |= MPRSAS_TARGET_TOREMOVE; + sassc->flags |= MPRSAS_TOREMOVE; return; } diff --git a/sys/dev/mpr/mpr_sas.h b/sys/dev/mpr/mpr_sas.h index ea427ca8f821..4ec6be15613c 100644 --- a/sys/dev/mpr/mpr_sas.h +++ b/sys/dev/mpr/mpr_sas.h @@ -57,8 +57,7 @@ struct mprsas_target { #define MPR_TARGET_FLAGS_RAID_COMPONENT (1 << 4) #define MPR_TARGET_FLAGS_VOLUME (1 << 5) #define MPR_TARGET_IS_SATA_SSD (1 << 6) -#define MPRSAS_TARGET_INRECOVERY (MPRSAS_TARGET_INABORT | \ - MPRSAS_TARGET_INRESET | MPRSAS_TARGET_INCHIPRESET) +#define MPRSAS_TARGET_TOREMOVE (1 << 7) uint16_t tid; SLIST_HEAD(, mprsas_lun) luns; @@ -95,6 +94,7 @@ struct mprsas_softc { #define MPRSAS_DISCOVERY_TIMEOUT_PENDING (1 << 2) #define MPRSAS_QUEUE_FROZEN (1 << 3) #define MPRSAS_SHUTDOWN (1 << 4) +#define MPRSAS_TOREMOVE (1 << 5) u_int maxtargets; struct mprsas_target *targets; struct cam_devq *devq; diff --git a/sys/dev/mpr/mpr_sas_lsi.c b/sys/dev/mpr/mpr_sas_lsi.c index 0800fd0385a7..025395f6eedd 100644 --- a/sys/dev/mpr/mpr_sas_lsi.c +++ b/sys/dev/mpr/mpr_sas_lsi.c @@ -1428,6 +1428,7 @@ mprsas_volume_add(struct mpr_softc *sc, u16 handle) targ->tid = id; targ->handle = handle; targ->devname = wwid; + targ->flags = MPR_TARGET_FLAGS_VOLUME; TAILQ_INIT(&targ->commands); TAILQ_INIT(&targ->timedout_commands); while (!SLIST_EMPTY(&targ->luns)) { diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h index 524c93861b70..93386f1f58d0 100644 --- a/sys/dev/mpr/mprvar.h +++ b/sys/dev/mpr/mprvar.h @@ -668,6 +668,8 @@ mpr_alloc_command(struct mpr_softc *sc) return (cm); } +void mprsas_prepare_remove_retry(struct mprsas_softc *sassc); + static __inline void mpr_free_high_priority_command(struct mpr_softc *sc, struct mpr_command *cm) { @@ -691,6 +693,9 @@ mpr_free_high_priority_command(struct mpr_softc *sc, struct mpr_command *cm) mpr_free_chain(sc, chain); } TAILQ_INSERT_TAIL(&sc->high_priority_req_list, cm, cm_link); + + if (sc->sassc) + mprsas_prepare_remove_retry(sc->sassc); } static __inline struct mpr_command * From owner-dev-commits-src-main@freebsd.org Fri Aug 20 16:01:28 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AAB3266309C; Fri, 20 Aug 2021 16:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrmbD4RgYz4ZqK; Fri, 20 Aug 2021 16:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81BFE1BC30; Fri, 20 Aug 2021 16:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KG1Sdp031289; Fri, 20 Aug 2021 16:01:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KG1S0j031288; Fri, 20 Aug 2021 16:01:28 GMT (envelope-from git) Date: Fri, 20 Aug 2021 16:01:28 GMT Message-Id: <202108201601.17KG1S0j031288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: ec97e9ca1fa5 - main - Fully revert f83f5d58394db57576bbed6dc7531997cabeb102 for the sys/dev/usb/serial folder, only keeping the zero length packet API introduced in sys/dev/usb after more reports of USB serial devices not supporting ZLPs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ec97e9ca1fa543a4a803e84706564d41cd492065 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 16:01:28 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ec97e9ca1fa543a4a803e84706564d41cd492065 commit ec97e9ca1fa543a4a803e84706564d41cd492065 Author: Hans Petter Selasky AuthorDate: 2021-08-20 15:59:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-08-20 16:00:42 +0000 Fully revert f83f5d58394db57576bbed6dc7531997cabeb102 for the sys/dev/usb/serial folder, only keeping the zero length packet API introduced in sys/dev/usb after more reports of USB serial devices not supporting ZLPs. Reported by: mav@ MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/serial/u3g.c | 6 ++---- sys/dev/usb/serial/uark.c | 10 ++++------ sys/dev/usb/serial/ubsa.c | 10 ++++------ sys/dev/usb/serial/ubser.c | 10 ++++------ sys/dev/usb/serial/uchcom.c | 6 ++---- sys/dev/usb/serial/ufoma.c | 10 ++++------ sys/dev/usb/serial/uftdi.c | 1 + sys/dev/usb/serial/ugensa.c | 11 +++++------ sys/dev/usb/serial/uipaq.c | 10 ++++------ sys/dev/usb/serial/ulpt.c | 9 +++++---- sys/dev/usb/serial/umcs.c | 10 ++++------ sys/dev/usb/serial/umodem.c | 18 +++++++++--------- sys/dev/usb/serial/umoscom.c | 10 ++++------ sys/dev/usb/serial/uplcom.c | 21 ++++++++++----------- sys/dev/usb/serial/uslcom.c | 10 ++++------ sys/dev/usb/serial/uvscom.c | 10 ++++------ 16 files changed, 70 insertions(+), 92 deletions(-) diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c index d7d8fd80b42a..22e4e8f6b2bb 100644 --- a/sys/dev/usb/serial/u3g.c +++ b/sys/dev/usb/serial/u3g.c @@ -978,7 +978,8 @@ u3g_attach(device_t dev) /* set stall by default */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[nports][U3G_BULK_WR]); + usbd_xfer_set_stall(sc->sc_xfer[nports][U3G_BULK_WR]); + usbd_xfer_set_stall(sc->sc_xfer[nports][U3G_BULK_RD]); mtx_unlock(&sc->sc_mtx); nports++; /* found one port */ @@ -1099,9 +1100,6 @@ u3g_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_TRANSFERRED: case USB_ST_SETUP: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - for (frame = 0; frame != U3G_TXFRAMES; frame++) { usbd_xfer_set_frame_offset(xfer, frame * U3G_TXSIZE, frame); diff --git a/sys/dev/usb/serial/uark.c b/sys/dev/usb/serial/uark.c index 072edf6389cd..904977e1ec14 100644 --- a/sys/dev/usb/serial/uark.c +++ b/sys/dev/usb/serial/uark.c @@ -219,7 +219,8 @@ uark_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UARK_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UARK_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UARK_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -280,16 +281,13 @@ uark_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UARK_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -297,7 +295,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/ubsa.c b/sys/dev/usb/serial/ubsa.c index 3286df7331b4..10b37984db2f 100644 --- a/sys/dev/usb/serial/ubsa.c +++ b/sys/dev/usb/serial/ubsa.c @@ -320,7 +320,8 @@ ubsa_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UBSA_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -582,16 +583,13 @@ ubsa_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UBSA_BSIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -599,7 +597,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/ubser.c b/sys/dev/usb/serial/ubser.c index 61b9c6c433fb..2a35756b0a7e 100644 --- a/sys/dev/usb/serial/ubser.c +++ b/sys/dev/usb/serial/ubser.c @@ -293,7 +293,8 @@ ubser_attach(device_t dev) ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UBSER_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_RD]); usbd_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); @@ -409,9 +410,6 @@ ubser_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); do { if (ucom_get_data(sc->sc_ucom + sc->sc_curr_tx_unit, @@ -432,7 +430,7 @@ tr_setup: } while (sc->sc_curr_tx_unit != first_unit); - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -440,7 +438,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/uchcom.c b/sys/dev/usb/serial/uchcom.c index aef1515d3586..6b17141c6ece 100644 --- a/sys/dev/usb/serial/uchcom.c +++ b/sys/dev/usb/serial/uchcom.c @@ -350,7 +350,8 @@ uchcom_attach(device_t dev) /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UCHCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -827,9 +828,6 @@ uchcom_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, usbd_xfer_max_len(xfer), &actlen)) { diff --git a/sys/dev/usb/serial/ufoma.c b/sys/dev/usb/serial/ufoma.c index ca52752accad..bc3f00a7b473 100644 --- a/sys/dev/usb/serial/ufoma.c +++ b/sys/dev/usb/serial/ufoma.c @@ -438,7 +438,8 @@ ufoma_attach(device_t dev) /* clear stall at first run, if any */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]); + usbd_xfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]); + usbd_xfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -790,16 +791,13 @@ ufoma_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UFOMA_BULK_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -807,7 +805,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c index 7fd531b3e381..a630fcbac5b5 100644 --- a/sys/dev/usb/serial/uftdi.c +++ b/sys/dev/usb/serial/uftdi.c @@ -1118,6 +1118,7 @@ uftdi_attach(device_t dev) /* clear stall at first run */ mtx_lock(&sc->sc_mtx); usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); /* set a valid "lcr" value */ diff --git a/sys/dev/usb/serial/ugensa.c b/sys/dev/usb/serial/ugensa.c index 1d2f1e57ef58..ba694e4805bd 100644 --- a/sys/dev/usb/serial/ugensa.c +++ b/sys/dev/usb/serial/ugensa.c @@ -233,8 +233,10 @@ ugensa_attach(device_t dev) break; } + /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(ssc->sc_xfer[UGENSA_BULK_DT_WR]); + usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]); + usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); /* initialize port number */ @@ -311,16 +313,13 @@ ugensa_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(ssc->sc_ucom_ptr, pc, 0, UGENSA_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -328,7 +327,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/uipaq.c b/sys/dev/usb/serial/uipaq.c index 0449a5663c71..33f2ae4c0845 100644 --- a/sys/dev/usb/serial/uipaq.c +++ b/sys/dev/usb/serial/uipaq.c @@ -1157,7 +1157,8 @@ uipaq_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UIPAQ_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -1319,16 +1320,13 @@ uipaq_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UIPAQ_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -1336,7 +1334,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/ulpt.c b/sys/dev/usb/serial/ulpt.c index 56f99519d4cd..c566da924374 100644 --- a/sys/dev/usb/serial/ulpt.c +++ b/sys/dev/usb/serial/ulpt.c @@ -218,9 +218,6 @@ ulpt_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_TRANSFERRED: case USB_ST_SETUP: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); max = usbd_xfer_max_len(xfer); if (usb_fifo_get_data(f, pc, 0, max, &actlen, 0)) { @@ -439,6 +436,10 @@ unlpt_open(struct usb_fifo *fifo, int fflags) return (EBUSY); } if (fflags & FREAD) { + /* clear stall first */ + mtx_lock(&sc->sc_mtx); + usbd_xfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); if (usb_fifo_alloc_buffer(fifo, usbd_xfer_max_len(sc->sc_xfer[ULPT_BULK_DT_RD]), ULPT_IFQ_MAXLEN)) { @@ -450,7 +451,7 @@ unlpt_open(struct usb_fifo *fifo, int fflags) if (fflags & FWRITE) { /* clear stall first */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[ULPT_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); if (usb_fifo_alloc_buffer(fifo, usbd_xfer_max_len(sc->sc_xfer[ULPT_BULK_DT_WR]), diff --git a/sys/dev/usb/serial/umcs.c b/sys/dev/usb/serial/umcs.c index 76ecd1ffa452..e3c8f1a764fb 100644 --- a/sys/dev/usb/serial/umcs.c +++ b/sys/dev/usb/serial/umcs.c @@ -382,7 +382,8 @@ umcs7840_attach(device_t dev) /* clear stall at first run */ mtx_lock(&sc->sc_mtx); for (subunit = 0; subunit < sc->sc_numports; ++subunit) { - usbd_xfer_set_zlp(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_WR_EP]); + usbd_xfer_set_stall(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_RD_EP]); + usbd_xfer_set_stall(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_WR_EP]); } mtx_unlock(&sc->sc_mtx); @@ -915,16 +916,13 @@ umcs7840_write_callbackN(struct usb_xfer *xfer, usb_error_t error, uint8_t subun case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(ucom, pc, 0, usbd_xfer_max_len(xfer), &actlen)) { DPRINTF("Port %d write, has %d bytes\n", ucom->sc_portno, actlen); usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -932,7 +930,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/umodem.c b/sys/dev/usb/serial/umodem.c index b8b7ae2f005c..573d74cdb526 100644 --- a/sys/dev/usb/serial/umodem.c +++ b/sys/dev/usb/serial/umodem.c @@ -447,10 +447,13 @@ umodem_attach(device_t dev) goto detach; } - /* send a ZLP at first run */ - mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UMODEM_BULK_WR]); - mtx_unlock(&sc->sc_mtx); + /* clear stall at first run, if USB host mode */ + if (uaa->usb_mode == USB_MODE_HOST) { + mtx_lock(&sc->sc_mtx); + usbd_xfer_set_stall(sc->sc_xfer[UMODEM_BULK_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UMODEM_BULK_RD]); + mtx_unlock(&sc->sc_mtx); + } ucom_set_usb_mode(&sc->sc_super_ucom, uaa->usb_mode); @@ -860,16 +863,13 @@ umodem_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UMODEM_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -877,7 +877,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/umoscom.c b/sys/dev/usb/serial/umoscom.c index 536772a7f697..724ab7f94092 100644 --- a/sys/dev/usb/serial/umoscom.c +++ b/sys/dev/usb/serial/umoscom.c @@ -333,7 +333,8 @@ umoscom_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UMOSCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -638,16 +639,13 @@ umoscom_write_callback(struct usb_xfer *xfer, usb_error_t error) tr_setup: DPRINTF("\n"); - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UMOSCOM_BUFSIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -656,7 +654,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/uplcom.c b/sys/dev/usb/serial/uplcom.c index 6808ddd64a4b..9efac9ff6b7c 100644 --- a/sys/dev/usb/serial/uplcom.c +++ b/sys/dev/usb/serial/uplcom.c @@ -507,12 +507,14 @@ uplcom_attach(device_t dev) goto detach; } - mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UPLCOM_BULK_DT_WR]); - mtx_unlock(&sc->sc_mtx); - - if (sc->sc_chiptype == TYPE_PL2303HX || - sc->sc_chiptype == TYPE_PL2303HXD) { + if (sc->sc_chiptype == TYPE_PL2303) { + /* HX variants seem to lock up after a clear stall request. */ + mtx_lock(&sc->sc_mtx); + usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); + } else if (sc->sc_chiptype == TYPE_PL2303HX || + sc->sc_chiptype == TYPE_PL2303HXD) { /* reset upstream data pipes */ if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) || @@ -1092,9 +1094,6 @@ uplcom_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UPLCOM_BULK_BUF_SIZE, &actlen)) { @@ -1103,7 +1102,7 @@ tr_setup: usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -1111,7 +1110,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/uslcom.c b/sys/dev/usb/serial/uslcom.c index 8c40a2c2fc3a..fec18d2a5631 100644 --- a/sys/dev/usb/serial/uslcom.c +++ b/sys/dev/usb/serial/uslcom.c @@ -443,7 +443,8 @@ uslcom_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[USLCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); sc->sc_partnum = uslcom_get_partnum(sc); @@ -818,9 +819,6 @@ uslcom_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, USLCOM_BULK_BUF_SIZE, &actlen)) { @@ -829,7 +827,7 @@ tr_setup: usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -837,7 +835,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } diff --git a/sys/dev/usb/serial/uvscom.c b/sys/dev/usb/serial/uvscom.c index 81fd5334a243..8bb69e4402cf 100644 --- a/sys/dev/usb/serial/uvscom.c +++ b/sys/dev/usb/serial/uvscom.c @@ -318,7 +318,8 @@ uvscom_attach(device_t dev) /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_zlp(sc->sc_xfer[UVSCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -390,16 +391,13 @@ uvscom_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - if (usbd_xfer_get_and_clr_zlp(xfer)) - break; - pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UVSCOM_BULK_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - break; + return; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -407,7 +405,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - break; + return; } } From owner-dev-commits-src-main@freebsd.org Fri Aug 20 16:09:34 2021 Return-Path: Delivered-To: dev-commits-src-main@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 360D5663342; Fri, 20 Aug 2021 16:09:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrmmZ0hGTz4bf5; Fri, 20 Aug 2021 16:09:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 015F01BE6F; Fri, 20 Aug 2021 16:09:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KG9XA4035978; Fri, 20 Aug 2021 16:09:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KG9XqS035977; Fri, 20 Aug 2021 16:09:33 GMT (envelope-from git) Date: Fri, 20 Aug 2021 16:09:33 GMT Message-Id: <202108201609.17KG9XqS035977@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: f12b1b8b47bf - main - Remove unused function mana_reset_counters. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f12b1b8b47bfad0a9d151b1e47c23074c141e8fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 16:09:34 -0000 The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=f12b1b8b47bfad0a9d151b1e47c23074c141e8fe commit f12b1b8b47bfad0a9d151b1e47c23074c141e8fe Author: Wei Hu AuthorDate: 2021-08-20 15:00:02 +0000 Commit: Wei Hu CommitDate: 2021-08-20 16:05:40 +0000 Remove unused function mana_reset_counters. This fixes the build warning caused by this function. Reported by: markj Tested by: whu MFC after: 2 weeks Sponsored by: Microsoft --- sys/dev/mana/mana_en.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index e6cffb852d70..ffeee336f694 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -279,15 +279,6 @@ mana_free_counters(counter_u64_t *begin, int size) counter_u64_free(*begin); } -static inline void -mana_reset_counters(counter_u64_t *begin, int size) -{ - counter_u64_t *end = (counter_u64_t *)((char *)begin + size); - - for (; begin < end; ++begin) - counter_u64_zero(*begin); -} - static bool mana_can_tx(struct gdma_queue *wq) { From owner-dev-commits-src-main@freebsd.org Fri Aug 20 16:46:12 2021 Return-Path: Delivered-To: dev-commits-src-main@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 979B066378A; Fri, 20 Aug 2021 16:46:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrnZr3Y6Qz4f9T; Fri, 20 Aug 2021 16:46:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E8321C6B4; Fri, 20 Aug 2021 16:46:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KGkCCN088231; Fri, 20 Aug 2021 16:46:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KGkCeW088230; Fri, 20 Aug 2021 16:46:12 GMT (envelope-from git) Date: Fri, 20 Aug 2021 16:46:12 GMT Message-Id: <202108201646.17KGkCeW088230@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Maxim Sobolev Subject: git: 2651609fcbd7 - main - Allow rc.d script to provide "status" method, even if it does not define procname or have a PID file. This might be useful for cases, such as mounting local FS, when there is no running daemon still some other persistent state in the system which status can be checked. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sobomax X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2651609fcbd70725cb94902145032dbb7c1e89c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 16:46:12 -0000 The branch main has been updated by sobomax: URL: https://cgit.FreeBSD.org/src/commit/?id=2651609fcbd70725cb94902145032dbb7c1e89c4 commit 2651609fcbd70725cb94902145032dbb7c1e89c4 Author: Maxim Sobolev AuthorDate: 2021-08-20 16:43:04 +0000 Commit: Maxim Sobolev CommitDate: 2021-08-20 16:43:46 +0000 Allow rc.d script to provide "status" method, even if it does not define procname or have a PID file. This might be useful for cases, such as mounting local FS, when there is no running daemon still some other persistent state in the system which status can be checked. It is still possible to have a status method before this by having extra_commands="status", but it's not obvious and might give an script writer some extra legwork to figure out how and why the straight method is not working. Reviewed by: cy MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D31614 --- libexec/rc/rc.subr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index b027fa5facf4..7144c3cbfce9 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -958,6 +958,11 @@ run_rc_command() _pidcmd='rc_pid=$(check_process '"$_procname $command_interpreter"')' fi _keywords="${_keywords} status poll" + else + if [ ! -z "${status_cmd}" ] + then + _keywords="${_keywords} status" + fi fi if [ -z "$rc_arg" ]; then From owner-dev-commits-src-main@freebsd.org Fri Aug 20 17:52:31 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1DFAF664736; Fri, 20 Aug 2021 17:52:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grq3M0Klyz4kGC; Fri, 20 Aug 2021 17:52:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E65D01D54D; Fri, 20 Aug 2021 17:52:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KHqUaP084606; Fri, 20 Aug 2021 17:52:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KHqUVc084605; Fri, 20 Aug 2021 17:52:30 GMT (envelope-from git) Date: Fri, 20 Aug 2021 17:52:30 GMT Message-Id: <202108201752.17KHqUVc084605@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: dbc689cdef0c - main - vfs: use vn_lock_pair to avoid establishing an ordering on mount MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dbc689cdef0cc8ff11171642cdcf107dfbc3fb41 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 17:52:31 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dbc689cdef0cc8ff11171642cdcf107dfbc3fb41 commit dbc689cdef0cc8ff11171642cdcf107dfbc3fb41 Author: Mateusz Guzik AuthorDate: 2021-08-18 21:14:16 +0000 Commit: Mateusz Guzik CommitDate: 2021-08-20 17:52:24 +0000 vfs: use vn_lock_pair to avoid establishing an ordering on mount This fixes some of the LORs seen on mount/unmount. Complete fix will require taking care of unmount as well. Reviewed by: kib Tested by: pho (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31611 --- sys/kern/vfs_mount.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 3c546392b213..92e70e45d46e 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1191,19 +1191,28 @@ vfs_domount_first( mp->mnt_kern_flag &= ~MNTK_ASYNC; MNT_IUNLOCK(mp); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - cache_purge(vp); VI_LOCK(vp); - vp->v_iflag &= ~VI_MOUNT; + cache_purge(vp); vn_irflag_set_locked(vp, VIRF_MOUNTPOINT); vp->v_mountedhere = mp; VI_UNLOCK(vp); + + /* + * We need to lock both vnodes. + * + * Use vn_lock_pair to avoid establishing an ordering between vnodes + * from different filesystems. + */ + vn_lock_pair(vp, false, newdp, false); + + VI_LOCK(vp); + vp->v_iflag &= ~VI_MOUNT; + VI_UNLOCK(vp); /* Place the new filesystem at the end of the mount list. */ mtx_lock(&mountlist_mtx); TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); vfs_event_signal(NULL, VQ_MOUNT, 0); - vn_lock(newdp, LK_EXCLUSIVE | LK_RETRY); VOP_UNLOCK(vp); EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td); VOP_UNLOCK(newdp); From owner-dev-commits-src-main@freebsd.org Fri Aug 20 17:52:32 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6CBFB664443; Fri, 20 Aug 2021 17:52:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grq3N1wQgz4k2r; Fri, 20 Aug 2021 17:52:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C78D1D54F; Fri, 20 Aug 2021 17:52:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KHqViJ084630; Fri, 20 Aug 2021 17:52:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KHqVoA084629; Fri, 20 Aug 2021 17:52:31 GMT (envelope-from git) Date: Fri, 20 Aug 2021 17:52:31 GMT Message-Id: <202108201752.17KHqVoA084629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 5d75ffdd0c67 - main - vfs: remove an unused variable from nameicap_tracker_add MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d75ffdd0c6751e220fdadcf216124013139f1ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 17:52:32 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=5d75ffdd0c6751e220fdadcf216124013139f1ac commit 5d75ffdd0c6751e220fdadcf216124013139f1ac Author: Mateusz Guzik AuthorDate: 2021-08-20 17:49:00 +0000 Commit: Mateusz Guzik CommitDate: 2021-08-20 17:52:24 +0000 vfs: remove an unused variable from nameicap_tracker_add Reported by cc --analyze Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/kern/vfs_lookup.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index a827c87538b8..a83cc6bb8b74 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -178,11 +178,9 @@ static void nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) { struct nameicap_tracker *nt; - struct componentname *cnp; if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR) return; - cnp = &ndp->ni_cnd; nt = TAILQ_LAST(&ndp->ni_cap_tracker, nameicap_tracker_head); if (nt != NULL && nt->dp == dp) return; From owner-dev-commits-src-main@freebsd.org Fri Aug 20 18:51:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 75FD8665003; Fri, 20 Aug 2021 18:51:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrrMG2yqvz4pK6; Fri, 20 Aug 2021 18:51:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DC6F1E295; Fri, 20 Aug 2021 18:51:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KIpMe8063755; Fri, 20 Aug 2021 18:51:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KIpMhf063754; Fri, 20 Aug 2021 18:51:22 GMT (envelope-from git) Date: Fri, 20 Aug 2021 18:51:22 GMT Message-Id: <202108201851.17KIpMhf063754@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 9781c28c6d63 - main - mpr(4): Fix unmatched devq release. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9781c28c6d63cfa8438d1aa31f512a6b217a6b2b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 18:51:22 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=9781c28c6d63cfa8438d1aa31f512a6b217a6b2b commit 9781c28c6d63cfa8438d1aa31f512a6b217a6b2b Author: Alexander Motin AuthorDate: 2021-08-20 18:37:55 +0000 Commit: Alexander Motin CommitDate: 2021-08-20 18:51:12 +0000 mpr(4): Fix unmatched devq release. Before this change devq was frozen only if some command was sent to the target after reset started, but release was called always. This change freezes the devq immediately, leaving mprsas_action_scsiio() check only to cover race condition due to different lock devq use. This should also avoid unnecessary requeue of the commands, creating additional log noise and confusing some broken apps. MFC after: 2 weeks Sponsored by: iXsystems, Inc. --- sys/dev/mpr/mpr_sas.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c index e1739028dd8f..a8bb7c90b5c4 100644 --- a/sys/dev/mpr/mpr_sas.c +++ b/sys/dev/mpr/mpr_sas.c @@ -237,7 +237,6 @@ mprsas_alloc_tm(struct mpr_softc *sc) void mprsas_free_tm(struct mpr_softc *sc, struct mpr_command *tm) { - int target_id = 0xFFFFFFFF; MPR_FUNCTRACE(sc); if (tm == NULL) @@ -248,13 +247,10 @@ mprsas_free_tm(struct mpr_softc *sc, struct mpr_command *tm) * free the resources used for freezing the devq. Must clear the * INRESET flag as well or scsi I/O will not work. */ - if (tm->cm_targ != NULL) { - tm->cm_targ->flags &= ~MPRSAS_TARGET_INRESET; - target_id = tm->cm_targ->tid; - } if (tm->cm_ccb) { - mpr_dprint(sc, MPR_INFO, "Unfreezing devq for target ID %d\n", - target_id); + mpr_dprint(sc, MPR_XINFO, "Unfreezing devq for target ID %d\n", + tm->cm_targ->tid); + tm->cm_targ->flags &= ~MPRSAS_TARGET_INRESET; xpt_release_devq(tm->cm_ccb->ccb_h.path, 1, TRUE); xpt_free_path(tm->cm_ccb->ccb_h.path); xpt_free_ccb(tm->cm_ccb); @@ -1923,13 +1919,11 @@ mprsas_action_scsiio(struct mprsas_softc *sassc, union ccb *ccb) } /* - * If target has a reset in progress, freeze the devq and return. The - * devq will be released when the TM reset is finished. + * If target has a reset in progress, the devq should be frozen. + * Geting here we likely hit a race, so just requeue. */ if (targ->flags & MPRSAS_TARGET_INRESET) { - ccb->ccb_h.status = CAM_BUSY | CAM_DEV_QFRZN; - mpr_dprint(sc, MPR_INFO, "%s: Freezing devq for target ID %d\n", - __func__, targ->tid); + ccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_DEV_QFRZN; xpt_freeze_devq(ccb->ccb_h.path, 1); xpt_done(ccb); return; @@ -3426,10 +3420,9 @@ mprsas_async(void *callback_arg, uint32_t code, struct cam_path *path, } /* - * Set the INRESET flag for this target so that no I/O will be sent to - * the target until the reset has completed. If an I/O request does - * happen, the devq will be frozen. The CCB holds the path which is - * used to release the devq. The devq is released and the CCB is freed + * Freeze the devq and set the INRESET flag so that no I/O will be sent to + * the target until the reset has completed. The CCB holds the path which + * is used to release the devq. The devq is released and the CCB is freed * when the TM completes. */ void @@ -3446,6 +3439,10 @@ mprsas_prepare_for_tm(struct mpr_softc *sc, struct mpr_command *tm, target->tid, lun_id) != CAM_REQ_CMP) { xpt_free_ccb(ccb); } else { + mpr_dprint(sc, MPR_XINFO, + "%s: Freezing devq for target ID %d\n", + __func__, target->tid); + xpt_freeze_devq(ccb->ccb_h.path, 1); tm->cm_ccb = ccb; tm->cm_targ = target; target->flags |= MPRSAS_TARGET_INRESET; From owner-dev-commits-src-main@freebsd.org Fri Aug 20 20:18:35 2021 Return-Path: Delivered-To: dev-commits-src-main@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 870E766634E; Fri, 20 Aug 2021 20:18:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrtHv3FKcz3C02; Fri, 20 Aug 2021 20:18:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5699D1F54A; Fri, 20 Aug 2021 20:18:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KKIZbZ075274; Fri, 20 Aug 2021 20:18:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KKIZPW075273; Fri, 20 Aug 2021 20:18:35 GMT (envelope-from git) Date: Fri, 20 Aug 2021 20:18:35 GMT Message-Id: <202108202018.17KKIZPW075273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: e81e71b0e9cb - main - Use interruptible wait for blocking recursive unmounts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e81e71b0e9cbb5515ffb31bf80088fd7b20e7994 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 20:18:35 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=e81e71b0e9cbb5515ffb31bf80088fd7b20e7994 commit e81e71b0e9cbb5515ffb31bf80088fd7b20e7994 Author: Jason A. Harmening AuthorDate: 2021-08-08 05:31:02 +0000 Commit: Jason A. Harmening CommitDate: 2021-08-20 20:21:56 +0000 Use interruptible wait for blocking recursive unmounts Now that we allow recursive unmount attempts to be abandoned upon exceeding the retry limit, we should avoid leaving an unkillable thread when a synchronous unmount request was issued against the base filesystem. Reviewed by: kib (earlier revision), mkusick Differential Revision: https://reviews.freebsd.org/D31450 --- sys/kern/vfs_mount.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 0fb5694ebed5..166d7336eaf1 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -2084,10 +2084,15 @@ dounmount(struct mount *mp, uint64_t flags, struct thread *td) * just re-enqueue on the end of the taskqueue. */ if ((flags & MNT_DEFERRED) == 0) { - while (!TAILQ_EMPTY(&mp->mnt_uppers)) { + while (error == 0 && !TAILQ_EMPTY(&mp->mnt_uppers)) { mp->mnt_kern_flag |= MNTK_TASKQUEUE_WAITER; - msleep(&mp->mnt_taskqueue_link, MNT_MTX(mp), 0, - "umntqw", 0); + error = msleep(&mp->mnt_taskqueue_link, + MNT_MTX(mp), PCATCH, "umntqw", 0); + } + if (error != 0) { + MNT_REL(mp); + MNT_IUNLOCK(mp); + return (error); } } else if (!TAILQ_EMPTY(&mp->mnt_uppers)) { MNT_IUNLOCK(mp); From owner-dev-commits-src-main@freebsd.org Fri Aug 20 20:18:34 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7E8D466634D; Fri, 20 Aug 2021 20:18:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrtHt2r6Bz3Byw; Fri, 20 Aug 2021 20:18:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45AB41EF5F; Fri, 20 Aug 2021 20:18:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KKIYcj075250; Fri, 20 Aug 2021 20:18:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KKIYhJ075249; Fri, 20 Aug 2021 20:18:34 GMT (envelope-from git) Date: Fri, 20 Aug 2021 20:18:34 GMT Message-Id: <202108202018.17KKIYhJ075249@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: a8c732f4e52e - main - VFS: add retry limit and delay for failed recursive unmounts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8c732f4e52ec4d64e963035f87d79c270953cbc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 20:18:34 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=a8c732f4e52ec4d64e963035f87d79c270953cbc commit a8c732f4e52ec4d64e963035f87d79c270953cbc Author: Jason A. Harmening AuthorDate: 2021-08-08 05:29:46 +0000 Commit: Jason A. Harmening CommitDate: 2021-08-20 20:20:50 +0000 VFS: add retry limit and delay for failed recursive unmounts A forcible unmount attempt may fail due to a transient condition, but it may also fail due to some issue in the filesystem implementation that will indefinitely prevent successful unmount. In such a case, the retry logic in the recursive unmount facility will cause the deferred unmount taskqueue to execute constantly. Avoid this scenario by imposing a retry limit, with a default value of 10, beyond which the recursive unmount facility will emit a log message and give up. Additionally, introduce a grace period, with a default value of 1s, between successive unmount retries on the same mount. Create a new sysctl node, vfs.deferred_unmount, to export the total number of failed recursive unmount attempts since boot, and to allow the retry limit and retry grace period to be tuned. Reviewed by: kib (earlier revision), mkusick Differential Revision: https://reviews.freebsd.org/D31450 --- sys/kern/vfs_mount.c | 77 ++++++++++++++++++++++++++++++++++++++++++---------- sys/sys/mount.h | 1 + 2 files changed, 64 insertions(+), 14 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 92e70e45d46e..0fb5694ebed5 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -95,6 +95,24 @@ SYSCTL_BOOL(_vfs, OID_AUTO, recursive_forced_unmount, CTLFLAG_RW, &recursive_forced_unmount, 0, "Recursively unmount stacked upper mounts" " when a file system is forcibly unmounted"); +static SYSCTL_NODE(_vfs, OID_AUTO, deferred_unmount, + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "deferred unmount controls"); + +static unsigned int deferred_unmount_retry_limit = 10; +SYSCTL_UINT(_vfs_deferred_unmount, OID_AUTO, retry_limit, CTLFLAG_RW, + &deferred_unmount_retry_limit, 0, + "Maximum number of retries for deferred unmount failure"); + +static int deferred_unmount_retry_delay_hz; +SYSCTL_INT(_vfs_deferred_unmount, OID_AUTO, retry_delay_hz, CTLFLAG_RW, + &deferred_unmount_retry_delay_hz, 0, + "Delay in units of [1/kern.hz]s when retrying a failed deferred unmount"); + +static int deferred_unmount_total_retries = 0; +SYSCTL_INT(_vfs_deferred_unmount, OID_AUTO, total_retries, CTLFLAG_RD, + &deferred_unmount_total_retries, 0, + "Total number of retried deferred unmounts"); + MALLOC_DEFINE(M_MOUNT, "mount", "vfs mount structure"); MALLOC_DEFINE(M_STATFS, "statfs", "statfs structure"); static uma_zone_t mount_zone; @@ -110,8 +128,7 @@ EVENTHANDLER_LIST_DEFINE(vfs_mounted); EVENTHANDLER_LIST_DEFINE(vfs_unmounted); static void vfs_deferred_unmount(void *arg, int pending); -static struct task deferred_unmount_task = - TASK_INITIALIZER(0, vfs_deferred_unmount, NULL);; +static struct timeout_task deferred_unmount_task; static struct mtx deferred_unmount_lock; MTX_SYSINIT(deferred_unmount, &deferred_unmount_lock, "deferred_unmount", MTX_DEF); @@ -166,7 +183,9 @@ mount_fini(void *mem, int size) static void vfs_mount_init(void *dummy __unused) { - + TIMEOUT_TASK_INIT(taskqueue_deferred_unmount, &deferred_unmount_task, + 0, vfs_deferred_unmount, NULL); + deferred_unmount_retry_delay_hz = hz; mount_zone = uma_zcreate("Mountpoints", sizeof(struct mount), NULL, NULL, mount_init, mount_fini, UMA_ALIGN_CACHE, UMA_ZONE_NOFREE); } @@ -688,6 +707,7 @@ vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp, const char *fspath, TAILQ_INIT(&mp->mnt_uppers); TAILQ_INIT(&mp->mnt_notify); mp->mnt_taskqueue_flags = 0; + mp->mnt_unmount_retries = 0; return (mp); } @@ -1895,7 +1915,8 @@ vfs_mount_fetch_counter(struct mount *mp, enum mount_counter which) } static bool -deferred_unmount_enqueue(struct mount *mp, uint64_t flags, bool requeue) +deferred_unmount_enqueue(struct mount *mp, uint64_t flags, bool requeue, + int timeout_ticks) { bool enqueued; @@ -1910,8 +1931,8 @@ deferred_unmount_enqueue(struct mount *mp, uint64_t flags, bool requeue) mtx_unlock(&deferred_unmount_lock); if (enqueued) { - taskqueue_enqueue(taskqueue_deferred_unmount, - &deferred_unmount_task); + taskqueue_enqueue_timeout(taskqueue_deferred_unmount, + &deferred_unmount_task, timeout_ticks); } return (enqueued); @@ -1926,6 +1947,8 @@ vfs_deferred_unmount(void *argi __unused, int pending __unused) STAILQ_HEAD(, mount) local_unmounts; uint64_t flags; struct mount *mp, *tmp; + int error; + unsigned int retries; bool unmounted; STAILQ_INIT(&local_unmounts); @@ -1937,14 +1960,30 @@ vfs_deferred_unmount(void *argi __unused, int pending __unused) flags = mp->mnt_taskqueue_flags; KASSERT((flags & MNT_DEFERRED) != 0, ("taskqueue unmount without MNT_DEFERRED")); - if (dounmount(mp, flags, curthread) != 0) { + error = dounmount(mp, flags, curthread); + if (error != 0) { MNT_ILOCK(mp); unmounted = ((mp->mnt_kern_flag & MNTK_REFEXPIRE) != 0); MNT_IUNLOCK(mp); - if (!unmounted) - deferred_unmount_enqueue(mp, flags, true); - else + + /* + * The deferred unmount thread is the only thread that + * modifies the retry counts, so locking/atomics aren't + * needed here. + */ + retries = (mp->mnt_unmount_retries)++; + deferred_unmount_total_retries++; + if (!unmounted && retries < deferred_unmount_retry_limit) { + deferred_unmount_enqueue(mp, flags, true, + -deferred_unmount_retry_delay_hz); + } else { + if (retries >= deferred_unmount_retry_limit) { + printf("giving up on deferred unmount " + "of %s after %d retries, error %d\n", + mp->mnt_stat.f_mntonname, retries, error); + } vfs_rel(mp); + } } } } @@ -1960,6 +1999,7 @@ dounmount(struct mount *mp, uint64_t flags, struct thread *td) int error; uint64_t async_flag; int mnt_gen_r; + unsigned int retries; KASSERT((flags & MNT_DEFERRED) == 0 || (flags & (MNT_RECURSE | MNT_FORCE)) == (MNT_RECURSE | MNT_FORCE), @@ -1976,7 +2016,7 @@ dounmount(struct mount *mp, uint64_t flags, struct thread *td) */ if ((flags & MNT_DEFERRED) != 0 && taskqueue_member(taskqueue_deferred_unmount, curthread) == 0) { - if (!deferred_unmount_enqueue(mp, flags, false)) + if (!deferred_unmount_enqueue(mp, flags, false, 0)) vfs_rel(mp); return (EINPROGRESS); } @@ -2017,9 +2057,16 @@ dounmount(struct mount *mp, uint64_t flags, struct thread *td) mp->mnt_kern_flag |= MNTK_RECURSE; mp->mnt_upper_pending++; TAILQ_FOREACH(upper, &mp->mnt_uppers, mnt_upper_link) { + retries = upper->mp->mnt_unmount_retries; + if (retries > deferred_unmount_retry_limit) { + error = EBUSY; + continue; + } MNT_IUNLOCK(mp); + vfs_ref(upper->mp); - if (!deferred_unmount_enqueue(upper->mp, flags, false)) + if (!deferred_unmount_enqueue(upper->mp, flags, + false, 0)) vfs_rel(upper->mp); MNT_ILOCK(mp); } @@ -2029,6 +2076,7 @@ dounmount(struct mount *mp, uint64_t flags, struct thread *td) mp->mnt_kern_flag &= ~MNTK_UPPER_WAITER; wakeup(&mp->mnt_uppers); } + /* * If we're not on the taskqueue, wait until the uppers list * is drained before proceeding with unmount. Otherwise, if @@ -2043,8 +2091,9 @@ dounmount(struct mount *mp, uint64_t flags, struct thread *td) } } else if (!TAILQ_EMPTY(&mp->mnt_uppers)) { MNT_IUNLOCK(mp); - deferred_unmount_enqueue(mp, flags, true); - return (0); + if (error == 0) + deferred_unmount_enqueue(mp, flags, true, 0); + return (error); } MNT_IUNLOCK(mp); KASSERT(TAILQ_EMPTY(&mp->mnt_uppers), ("mnt_uppers not empty")); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index f4b5945d3ad0..8368595b685b 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -261,6 +261,7 @@ struct mount { TAILQ_HEAD(, mount_upper_node) mnt_notify; /* (i) upper mounts for notification */ STAILQ_ENTRY(mount) mnt_taskqueue_link; /* (d) our place in deferred unmount list */ uint64_t mnt_taskqueue_flags; /* (d) unmount flags passed from taskqueue */ + unsigned int mnt_unmount_retries; /* (d) # of failed deferred unmount attempts */ }; #endif /* _WANT_MOUNT || _KERNEL */ From owner-dev-commits-src-main@freebsd.org Fri Aug 20 21:18:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9F3936671E2; Fri, 20 Aug 2021 21:18:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grvct3t1Gz3Flh; Fri, 20 Aug 2021 21:18:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CFA02028F; Fri, 20 Aug 2021 21:18:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KLIMV4055749; Fri, 20 Aug 2021 21:18:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KLIMlx055748; Fri, 20 Aug 2021 21:18:22 GMT (envelope-from git) Date: Fri, 20 Aug 2021 21:18:22 GMT Message-Id: <202108202118.17KLIMlx055748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Maxim Sobolev Subject: git: 0d13f5343faf - main - Only trigger read-ahead if two adjacent blocks have been requested. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sobomax X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d13f5343fafbf3067ffc33a507ffca0375c4417 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 21:18:22 -0000 The branch main has been updated by sobomax: URL: https://cgit.FreeBSD.org/src/commit/?id=0d13f5343fafbf3067ffc33a507ffca0375c4417 commit 0d13f5343fafbf3067ffc33a507ffca0375c4417 Author: Maxim Sobolev AuthorDate: 2021-08-20 19:33:51 +0000 Commit: Maxim Sobolev CommitDate: 2021-08-20 21:08:01 +0000 Only trigger read-ahead if two adjacent blocks have been requested. The change makes block caching algorithm to work better for remote media on low-BW/high-delay links. This cuts boot time over IP KVMs noticeably, since the initialization stage reads bunch of small 4th (and now lua) files that are not in the same cache stripe (usually), thus wasting lot of bandwidth and increasing latency even further. The original regression came in 2017 with revision 87ed2b7f5. We've seen increase of time it takes for the loader to get to the kernel loading from under a minute to 10-15 minutes in many cases. Reviewed by: tsoome MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D31623 --- stand/common/bcache.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/stand/common/bcache.c b/stand/common/bcache.c index a020f3c3c53c..526f9fe3fa5c 100644 --- a/stand/common/bcache.c +++ b/stand/common/bcache.c @@ -66,6 +66,7 @@ struct bcache { caddr_t bcache_data; size_t bcache_nblks; size_t ra; + daddr_t bcache_nextblkno; }; static u_int bcache_total_nblks; /* set by bcache_init */ @@ -163,6 +164,7 @@ bcache_allocate(void) } bcache_units++; bc->ra = BCACHE_READAHEAD; /* optimistic read ahead */ + bc->bcache_nextblkno = -1; return (bc); } @@ -291,6 +293,14 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t size, else ra = bc->bcache_nblks - BHASH(bc, p_blk + p_size); + /* + * Only trigger read-ahead if we detect two blocks being read + * sequentially. + */ + if ((bc->bcache_nextblkno != blk) && ra != 0) { + ra = 0; + } + if (ra != 0 && ra != bc->bcache_nblks) { /* do we have RA space? */ ra = MIN(bc->ra, ra - 1); ra = rounddown(ra, 16); /* multiple of 16 blocks */ @@ -342,8 +352,11 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t size, } done: - if ((result == 0) && (rsize != NULL)) - *rsize = size; + if (result == 0) { + if (rsize != NULL) + *rsize = size; + bc->bcache_nextblkno = blk + (size / DEV_BSIZE); + } return(result); } From owner-dev-commits-src-main@freebsd.org Fri Aug 20 21:26:00 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1C571667987; Fri, 20 Aug 2021 21:26:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grvng6zVbz3Gdb; Fri, 20 Aug 2021 21:25:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D803820421; Fri, 20 Aug 2021 21:25:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KLPxx2068917; Fri, 20 Aug 2021 21:25:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KLPxNN068915; Fri, 20 Aug 2021 21:25:59 GMT (envelope-from git) Date: Fri, 20 Aug 2021 21:25:59 GMT Message-Id: <202108202125.17KLPxNN068915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 0e5811a2a9a1 - main - intel ethernet: Use ether_gen_addr(9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e5811a2a9a1b4a7e0c79b73e3b9b9d15d481577 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 21:26:00 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0e5811a2a9a1b4a7e0c79b73e3b9b9d15d481577 commit 0e5811a2a9a1b4a7e0c79b73e3b9b9d15d481577 Author: Kevin Bowling AuthorDate: 2021-08-20 14:45:30 +0000 Commit: Kevin Bowling CommitDate: 2021-08-20 21:21:48 +0000 intel ethernet: Use ether_gen_addr(9) Use ether_gen_addr(9) for VF MAC generation Reviewed by: Intel Networking (erj), kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31616 --- sys/dev/e1000/if_em.c | 7 ++----- sys/dev/ixgbe/if_ixv.c | 10 ++++------ sys/dev/ixl/if_iavf.c | 10 +++------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 5c958806d824..6e3a8f73190f 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1076,11 +1076,8 @@ em_if_attach_pre(if_ctx_t ctx) if (!em_is_valid_ether_addr(hw->mac.addr)) { if (adapter->vf_ifp) { - u8 addr[ETHER_ADDR_LEN]; - arc4rand(&addr, sizeof(addr), 0); - addr[0] &= 0xFE; - addr[0] |= 0x02; - bcopy(addr, hw->mac.addr, sizeof(addr)); + ether_gen_addr(iflib_get_ifp(ctx), + (struct ether_addr *)hw->mac.addr); } else { device_printf(dev, "Invalid MAC address\n"); error = EIO; diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 9744a3347cec..301d3c0368ae 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -465,12 +465,10 @@ ixv_if_attach_pre(if_ctx_t ctx) /* If no mac address was assigned, make a random one */ if (!ixv_check_ether_addr(hw->mac.addr)) { - u8 addr[ETHER_ADDR_LEN]; - arc4rand(&addr, sizeof(addr), 0); - addr[0] &= 0xFE; - addr[0] |= 0x02; - bcopy(addr, hw->mac.addr, sizeof(addr)); - bcopy(addr, hw->mac.perm_addr, sizeof(addr)); + ether_gen_addr(iflib_get_ifp(ctx), + (struct ether_addr *)hw->mac.addr); + bcopy(hw->mac.addr, hw->mac.perm_addr, + sizeof(hw->mac.perm_addr)); } /* Most of the iflib initialization... */ diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index f6eb91c2a855..123db2e2461d 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -433,13 +433,9 @@ iavf_if_attach_pre(if_ctx_t ctx) iavf_dbg_init(sc, "Resource Acquisition complete\n"); /* If no mac address was assigned just make a random one */ - if (!iavf_check_ether_addr(hw->mac.addr)) { - u8 addr[ETHER_ADDR_LEN]; - arc4rand(&addr, sizeof(addr), 0); - addr[0] &= 0xFE; - addr[0] |= 0x02; - bcopy(addr, hw->mac.addr, sizeof(addr)); - } + if (!iavf_check_ether_addr(hw->mac.addr)) + ether_gen_addr(iflib_get_ifp(ctx), + (struct ether_addr *)hw->mac.addr); bcopy(hw->mac.addr, hw->mac.perm_addr, ETHER_ADDR_LEN); iflib_set_mac(ctx, hw->mac.addr); From owner-dev-commits-src-main@freebsd.org Fri Aug 20 21:45:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5921E66819D; Fri, 20 Aug 2021 21:45:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrwDZ1kk1z3J1L; Fri, 20 Aug 2021 21:45:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2392420957; Fri, 20 Aug 2021 21:45:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17KLjoYF096045; Fri, 20 Aug 2021 21:45:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17KLjoai096044; Fri, 20 Aug 2021 21:45:50 GMT (envelope-from git) Date: Fri, 20 Aug 2021 21:45:50 GMT Message-Id: <202108202145.17KLjoai096044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric Joyner Subject: git: c4622b01d2f1 - main - ixl(4): Fix reporting of unqualified transceivers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4622b01d2f12b889b57ff7d0b03a38dfcb00fd8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 21:45:50 -0000 The branch main has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=c4622b01d2f12b889b57ff7d0b03a38dfcb00fd8 commit c4622b01d2f12b889b57ff7d0b03a38dfcb00fd8 Author: Krzysztof Galazka AuthorDate: 2021-08-20 21:12:28 +0000 Commit: Eric Joyner CommitDate: 2021-08-20 21:44:32 +0000 ixl(4): Fix reporting of unqualified transceivers When link_active_on_if_down flag is disabled and link is brought down with ifconfig, FW reports a false positive link event about an unqualified transceiver. The condition used in the driver to filter out those false positive events was incorrect and caused that unqualified module event to also not be reported when the event was valid. Change the condition to rely on IFF_UP flag instead of link_active_on_if_down and bump driver version to 2.3.1-k. Signed-off-by: Krzysztof Galazka Signed-off-by: Eric Joyner Reviewed by: stallamr@netapp.com, erj@ Tested by: gowtham.kumar.ks@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D30733 --- sys/dev/ixl/if_ixl.c | 2 +- sys/dev/ixl/ixl_pf_iflib.c | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 3b49da5d76b9..f620771e93b1 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -49,7 +49,7 @@ *********************************************************************/ #define IXL_DRIVER_VERSION_MAJOR 2 #define IXL_DRIVER_VERSION_MINOR 3 -#define IXL_DRIVER_VERSION_BUILD 0 +#define IXL_DRIVER_VERSION_BUILD 1 #define IXL_DRIVER_VERSION_STRING \ __XSTRING(IXL_DRIVER_VERSION_MAJOR) "." \ diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 68a174889c41..6ea20389c547 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -403,20 +403,23 @@ ixl_link_event(struct ixl_pf *pf, struct i40e_arq_event_info *e) { struct i40e_hw *hw = &pf->hw; device_t dev = iflib_get_dev(pf->vsi.ctx); - struct i40e_aqc_get_link_status *status = - (struct i40e_aqc_get_link_status *)&e->desc.params.raw; - - /* Request link status from adapter */ + struct i40e_link_status *link_info = &hw->phy.link_info; + + /* Driver needs to re-enable delivering of link status events + * by FW after each event reception. Call i40e_get_link_status + * to do that. To not lose information about link state changes, + * which happened between receiving an event and the call, + * do not rely on status from event but use most recent + * status information retrieved by the call. */ hw->phy.get_link_info = TRUE; i40e_get_link_status(hw, &pf->link_up); /* Print out message if an unqualified module is found */ - if ((status->link_info & I40E_AQ_MEDIA_AVAILABLE) && + if ((link_info->link_info & I40E_AQ_MEDIA_AVAILABLE) && (pf->advertised_speed) && - (atomic_load_32(&pf->state) & - IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) != 0 && - (!(status->an_info & I40E_AQ_QUALIFIED_MODULE)) && - (!(status->link_info & I40E_AQ_LINK_UP))) + (if_getflags(pf->vsi.ifp) & IFF_UP) && + (!(link_info->an_info & I40E_AQ_QUALIFIED_MODULE)) && + (!(link_info->link_info & I40E_AQ_LINK_UP))) device_printf(dev, "Link failed because " "an unqualified module was detected!\n"); From owner-dev-commits-src-main@freebsd.org Sat Aug 21 09:04:30 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E12E566F15A; Sat, 21 Aug 2021 09:04:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsCHf5jZ6z3LSf; Sat, 21 Aug 2021 09:04:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABF642523; Sat, 21 Aug 2021 09:04:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17L94UxM001154; Sat, 21 Aug 2021 09:04:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17L94UIB001153; Sat, 21 Aug 2021 09:04:30 GMT (envelope-from git) Date: Sat, 21 Aug 2021 09:04:30 GMT Message-Id: <202108210904.17L94UIB001153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: ce71a0fa99cc - main - truncate(1): Update tests' golden output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce71a0fa99ccfbd4720b4f3d7254f53c2ac97fc1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2021 09:04:31 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=ce71a0fa99ccfbd4720b4f3d7254f53c2ac97fc1 commit ce71a0fa99ccfbd4720b4f3d7254f53c2ac97fc1 Author: Ka Ho Ng AuthorDate: 2021-08-21 09:03:14 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-21 09:04:21 +0000 truncate(1): Update tests' golden output After commit 5ee2c35751ef truncate(1)'s usage output was extended. Update the golden output in test cases to match the changes made. Sponsored by: The FreeBSD Foundation Reviewed by: lwhsu Differential Revision: https://reviews.freebsd.org/D31628 --- usr.bin/truncate/tests/truncate_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/truncate/tests/truncate_test.sh b/usr.bin/truncate/tests/truncate_test.sh index 267df3131b3e..dcf0dbfe4892 100644 --- a/usr.bin/truncate/tests/truncate_test.sh +++ b/usr.bin/truncate/tests/truncate_test.sh @@ -59,6 +59,7 @@ create_stderr_usage_file() _custom_create_file print \ "usage: truncate [-c] -s [+|-|%|/]size[K|k|M|m|G|g|T|t] file ..." _custom_create_file print " truncate [-c] -r rfile file ..." + _custom_create_file print " truncate [-c] -d [-o offset[K|k|M|m|G|g|T|t]] -l length[K|k|M|m|G|g|T|t] file ..." } atf_test_case illegal_option From owner-dev-commits-src-main@freebsd.org Sat Aug 21 13:58:10 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E98D5672668; Sat, 21 Aug 2021 13:58:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsKpV6Hhzz3rfM; Sat, 21 Aug 2021 13:58:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C00D86609; Sat, 21 Aug 2021 13:58:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17LDwAkJ086259; Sat, 21 Aug 2021 13:58:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17LDwA00086258; Sat, 21 Aug 2021 13:58:10 GMT (envelope-from git) Date: Sat, 21 Aug 2021 13:58:10 GMT Message-Id: <202108211358.17LDwA00086258@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 84d5b6bd68ce - main - cam(4): Fix quick unplug/replug for SCSI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84d5b6bd68ce6496592adb8fdcd8cf0c246ed935 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2021 13:58:11 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=84d5b6bd68ce6496592adb8fdcd8cf0c246ed935 commit 84d5b6bd68ce6496592adb8fdcd8cf0c246ed935 Author: Alexander Motin AuthorDate: 2021-08-21 13:31:41 +0000 Commit: Alexander Motin CommitDate: 2021-08-21 13:58:05 +0000 cam(4): Fix quick unplug/replug for SCSI. If some device is plugged back in after unplug before the probe periph destroyed, it will just restart the probe process. But I've found that PROBE_INQUIRY_CKSUM flag not cleared between the iterations may cause AC_FOUND_DEVICE not reported on the second iteration, and because of AC_LOST_DEVICE reported during the first iteration, the device end up configured, but without any periphs attached. We've found that enabled serial console and 102-disk JBOD cause enough probe delays to easily trigger the issue for half of the disks. This change fixes it reliably on my tests. MFC after: 2 weeks Sponsored by: iXsystems, Inc. --- sys/cam/scsi/scsi_xpt.c | 61 ++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 46cc4c1699f1..c4c43ee87101 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -178,7 +178,6 @@ do { \ typedef enum { PROBE_INQUIRY_CKSUM = 0x01, - PROBE_SERIAL_CKSUM = 0x02, PROBE_NO_ANNOUNCE = 0x04, PROBE_EXTLUN = 0x08 } probe_flags; @@ -775,8 +774,6 @@ again: } case PROBE_INQUIRY: case PROBE_FULL_INQUIRY: - case PROBE_INQUIRY_BASIC_DV1: - case PROBE_INQUIRY_BASIC_DV2: { u_int inquiry_len; struct scsi_inquiry_data *inq_buf; @@ -791,19 +788,19 @@ again: * serial number check finish, we attempt to figure out * whether we still have the same device. */ - if (((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) - && ((softc->flags & PROBE_INQUIRY_CKSUM) == 0)) { + if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { + softc->flags &= ~PROBE_INQUIRY_CKSUM; + } else if ((softc->flags & PROBE_INQUIRY_CKSUM) == 0) { MD5Init(&softc->context); MD5Update(&softc->context, (unsigned char *)inq_buf, sizeof(struct scsi_inquiry_data)); - softc->flags |= PROBE_INQUIRY_CKSUM; if (periph->path->device->serial_num_len > 0) { MD5Update(&softc->context, periph->path->device->serial_num, periph->path->device->serial_num_len); - softc->flags |= PROBE_SERIAL_CKSUM; } MD5Final(softc->digest, &softc->context); + softc->flags |= PROBE_INQUIRY_CKSUM; } if (softc->action == PROBE_INQUIRY) @@ -819,22 +816,6 @@ again: */ inquiry_len = roundup2(inquiry_len, 2); - if (softc->action == PROBE_INQUIRY_BASIC_DV1 - || softc->action == PROBE_INQUIRY_BASIC_DV2) { - inq_buf = malloc(inquiry_len, M_CAMXPT, M_NOWAIT); - } - if (inq_buf == NULL) { - xpt_print(periph->path, "malloc failure- skipping Basic" - "Domain Validation\n"); - PROBE_SET_ACTION(softc, PROBE_DV_EXIT); - scsi_test_unit_ready(csio, - /*retries*/4, - probedone, - MSG_SIMPLE_Q_TAG, - SSD_FULL_SIZE, - /*timeout*/60000); - break; - } scsi_inquiry(csio, /*retries*/4, probedone, @@ -1019,6 +1000,40 @@ done: } goto done; } + case PROBE_INQUIRY_BASIC_DV1: + case PROBE_INQUIRY_BASIC_DV2: + { + u_int inquiry_len; + struct scsi_inquiry_data *inq_buf; + + inq_buf = &periph->path->device->inq_data; + inquiry_len = roundup2(SID_ADDITIONAL_LENGTH(inq_buf), 2); + inq_buf = malloc(inquiry_len, M_CAMXPT, M_NOWAIT); + if (inq_buf == NULL) { + xpt_print(periph->path, "malloc failure- skipping Basic" + "Domain Validation\n"); + PROBE_SET_ACTION(softc, PROBE_DV_EXIT); + scsi_test_unit_ready(csio, + /*retries*/4, + probedone, + MSG_SIMPLE_Q_TAG, + SSD_FULL_SIZE, + /*timeout*/60000); + break; + } + + scsi_inquiry(csio, + /*retries*/4, + probedone, + MSG_SIMPLE_Q_TAG, + (u_int8_t *)inq_buf, + inquiry_len, + /*evpd*/FALSE, + /*page_code*/0, + SSD_MIN_SIZE, + /*timeout*/60 * 1000); + break; + } default: panic("probestart: invalid action state 0x%x\n", softc->action); } From owner-dev-commits-src-main@freebsd.org Sat Aug 21 15:22:19 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1D6E06743EA; Sat, 21 Aug 2021 15:22:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsMgb0D27z4khg; Sat, 21 Aug 2021 15:22:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3CC371EA; Sat, 21 Aug 2021 15:22:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17LFMI94004893; Sat, 21 Aug 2021 15:22:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17LFMIPr004892; Sat, 21 Aug 2021 15:22:18 GMT (envelope-from git) Date: Sat, 21 Aug 2021 15:22:18 GMT Message-Id: <202108211522.17LFMIPr004892@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: f3dcedd3de27 - main - targ(4): Remove D_NEEDGIANT. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f3dcedd3de27b1a8f493c8256103e8a7fb93f5a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2021 15:22:19 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=f3dcedd3de27b1a8f493c8256103e8a7fb93f5a4 commit f3dcedd3de27b1a8f493c8256103e8a7fb93f5a4 Author: Alexander Motin AuthorDate: 2021-08-21 15:20:54 +0000 Commit: Alexander Motin CommitDate: 2021-08-21 15:20:54 +0000 targ(4): Remove D_NEEDGIANT. I don't believe this code needs Giant, if ever needed. MFC after: 1 month --- sys/cam/scsi/scsi_target.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index b3d0461c1d24..b743fa2fe9ca 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -115,7 +115,6 @@ static struct filterops targread_filtops = { static struct cdevsw targ_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, .d_open = targopen, .d_read = targread, .d_write = targwrite, From owner-dev-commits-src-main@freebsd.org Sat Aug 21 16:18:08 2021 Return-Path: Delivered-To: dev-commits-src-main@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 80A11674DCF; Sat, 21 Aug 2021 16:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsNw03DfLz3HBV; Sat, 21 Aug 2021 16:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56D051038E; Sat, 21 Aug 2021 16:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17LGI8Yx075748; Sat, 21 Aug 2021 16:18:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17LGI8w1075747; Sat, 21 Aug 2021 16:18:08 GMT (envelope-from git) Date: Sat, 21 Aug 2021 16:18:08 GMT Message-Id: <202108211618.17LGI8w1075747@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: e5a50b03297f - main - loader: FB console does leave garbage on screen while scrolling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5a50b03297fa09652b3cf319bc6e863392554e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2021 16:18:08 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=e5a50b03297fa09652b3cf319bc6e863392554e0 commit e5a50b03297fa09652b3cf319bc6e863392554e0 Author: Toomas Soome AuthorDate: 2021-08-21 11:25:36 +0000 Commit: Toomas Soome CommitDate: 2021-08-21 16:17:25 +0000 loader: FB console does leave garbage on screen while scrolling Scrolling screen will leave "trail" of chars from first column. Apparently caused by cursor location mismanagement. Make sure we do not [attempt to] set cursor out of the screen. MFC after: 1 week --- stand/common/gfx_fb.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 522c70327425..45d0072bd858 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -976,20 +976,26 @@ gfx_fb_fill(void *arg, const teken_rect_t *r, teken_char_t c, } static void -gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) +gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *pos, bool on) { unsigned x, y, width, height; const uint8_t *glyph; + teken_pos_t p; int idx; - idx = p->tp_col + p->tp_row * state->tg_tp.tp_col; + p = *pos; + if (p.tp_col >= state->tg_tp.tp_col) + p.tp_col = state->tg_tp.tp_col - 1; + if (p.tp_row >= state->tg_tp.tp_row) + p.tp_row = state->tg_tp.tp_row - 1; + idx = p.tp_col + p.tp_row * state->tg_tp.tp_col; if (idx >= state->tg_tp.tp_col * state->tg_tp.tp_row) return; width = state->tg_font.vf_width; height = state->tg_font.vf_height; - x = state->tg_origin.tp_col + p->tp_col * width; - y = state->tg_origin.tp_row + p->tp_row * height; + x = state->tg_origin.tp_col + p.tp_col * width; + y = state->tg_origin.tp_row + p.tp_row * height; /* * Save original display content to preserve image data. @@ -1017,7 +1023,7 @@ gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) if (state->tg_cursor_image != NULL && gfxfb_blt(state->tg_cursor_image, GfxFbBltBufferToVideo, 0, 0, x, y, width, height, 0) == 0) { - state->tg_cursor = *p; + state->tg_cursor = p; return; } } @@ -1025,9 +1031,9 @@ gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) glyph = font_lookup(&state->tg_font, screen_buffer[idx].c, &screen_buffer[idx].a); gfx_bitblt_bitmap(state, glyph, &screen_buffer[idx].a, 0xff, on); - gfx_fb_printchar(state, p); + gfx_fb_printchar(state, &p); - state->tg_cursor = *p; + state->tg_cursor = p; } void From owner-dev-commits-src-main@freebsd.org Sat Aug 21 17:35:00 2021 Return-Path: Delivered-To: dev-commits-src-main@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 688206759F4; Sat, 21 Aug 2021 17:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsQch2Snsz3v4j; Sat, 21 Aug 2021 17:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CBD811666; Sat, 21 Aug 2021 17:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17LHZ0g5081503; Sat, 21 Aug 2021 17:35:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17LHZ0WI081502; Sat, 21 Aug 2021 17:35:00 GMT (envelope-from git) Date: Sat, 21 Aug 2021 17:35:00 GMT Message-Id: <202108211735.17LHZ0WI081502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: c541bd368f86 - main - lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c541bd368f863bbf5c08dd5c1ecce0166ad47389 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2021 17:35:00 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=c541bd368f863bbf5c08dd5c1ecce0166ad47389 commit c541bd368f863bbf5c08dd5c1ecce0166ad47389 Author: Alexander V. Chernikov AuthorDate: 2021-08-21 14:13:32 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-21 17:34:35 +0000 lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries. Currently we use pre-calculated headers inside LLE entries as prepend data for `if_output` functions. Using these headers allows saving some CPU cycles/memory accesses on the fast path. However, this approach makes adding L2 header for IPv4 traffic with IPv6 nexthops more complex, as it is not possible to store multiple pre-calculated headers inside lle. Additionally, the solution space is limited by the fact that PCB caching saves LLEs in addition to the nexthop. Thus, add support for creating special "child" LLEs for the purpose of holding custom family encaps and store mbufs pending resolution. To simplify handling of those LLEs, store them in a linked-list inside a "parent" (e.g. normal) LLE. Such LLEs are not visible when iterating LLE table. Their lifecycle is bound to the "parent" LLE - it is not possible to delete "child" when parent is alive. Furthermore, "child" LLEs are static (RTF_STATIC), avoding complex state machine used by the standard LLEs. nd6_lookup() and nd6_resolve() now accepts an additional argument, family, allowing to return such child LLEs. This change uses `LLE_SF()` macro which packs family and flags in a single int field. This is done to simplify merging back to stable/. Once this code lands, most of the cases will be converted to use a dedicated `family` parameter. Differential Revision: https://reviews.freebsd.org/D31379 MFC after: 2 weeks --- sys/net/if_ethersubr.c | 4 +- sys/net/if_fwsubr.c | 4 +- sys/net/if_infiniband.c | 3 +- sys/net/if_llatbl.c | 70 +++++++++++- sys/net/if_llatbl.h | 12 +- sys/netinet/toecore.c | 2 +- sys/netinet6/icmp6.c | 2 +- sys/netinet6/in6.c | 5 + sys/netinet6/nd6.c | 176 +++++++++++++++++++++++------ sys/netinet6/nd6.h | 1 + sys/netinet6/nd6_nbr.c | 6 +- sys/ofed/drivers/infiniband/core/ib_addr.c | 5 +- 12 files changed, 241 insertions(+), 49 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index bdb5b07635b7..6d8b79d4dd12 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -237,8 +237,8 @@ ether_resolve_addr(struct ifnet *ifp, struct mbuf *m, #ifdef INET6 case AF_INET6: if ((m->m_flags & M_MCAST) == 0) - error = nd6_resolve(ifp, 0, m, dst, phdr, &lleflags, - plle); + error = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), m, dst, phdr, + &lleflags, plle); else { const struct in6_addr *a6; a6 = &(((const struct sockaddr_in6 *)dst)->sin6_addr); diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c index 29ca2f713e8e..a6c43d4d05a4 100644 --- a/sys/net/if_fwsubr.c +++ b/sys/net/if_fwsubr.c @@ -176,8 +176,8 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, #ifdef INET6 case AF_INET6: if (unicast) { - error = nd6_resolve(fc->fc_ifp, is_gw, m, dst, - (u_char *) destfw, NULL, NULL); + error = nd6_resolve(fc->fc_ifp, LLE_SF(AF_INET6, is_gw), + m, dst, (u_char *) destfw, NULL, NULL); if (error) return (error == EWOULDBLOCK ? 0 : error); } diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c index 528f20b7c98d..244b2a5ba117 100644 --- a/sys/net/if_infiniband.c +++ b/sys/net/if_infiniband.c @@ -253,7 +253,8 @@ infiniband_resolve_addr(struct ifnet *ifp, struct mbuf *m, #ifdef INET6 case AF_INET6: if ((m->m_flags & M_MCAST) == 0) { - error = nd6_resolve(ifp, 0, m, dst, phdr, &lleflags, plle); + error = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), m, dst, + phdr, &lleflags, plle); } else { infiniband_ipv6_multicast_map( &((const struct sockaddr_in6 *)dst)->sin6_addr, diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index c656974c80ee..e4dfc45705a8 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -398,6 +398,26 @@ lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr, return (error); } +/* + * Searches for the child entry matching @family inside @lle. + * Returns the entry or NULL. + */ +struct llentry * +llentry_lookup_family(struct llentry *lle, int family) +{ + struct llentry *child_lle; + + if (lle == NULL) + return (NULL); + + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + if (child_lle->r_family == family) + return (child_lle); + } + + return (NULL); +} + /* * Requests feedback from the datapath. * First packet using @lle should result in @@ -407,9 +427,17 @@ lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr, void llentry_request_feedback(struct llentry *lle) { + struct llentry *child_lle; + LLE_REQ_LOCK(lle); lle->r_skip_req = 1; LLE_REQ_UNLOCK(lle); + + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + LLE_REQ_LOCK(child_lle); + child_lle->r_skip_req = 1; + LLE_REQ_UNLOCK(child_lle); + } } /* @@ -431,8 +459,8 @@ llentry_mark_used(struct llentry *lle) * Return 0 if the entry was not used, relevant time_uptime * otherwise. */ -time_t -llentry_get_hittime(struct llentry *lle) +static time_t +llentry_get_hittime_raw(struct llentry *lle) { time_t lle_hittime = 0; @@ -444,6 +472,23 @@ llentry_get_hittime(struct llentry *lle) return (lle_hittime); } +time_t +llentry_get_hittime(struct llentry *lle) +{ + time_t lle_hittime = 0; + struct llentry *child_lle; + + lle_hittime = llentry_get_hittime_raw(lle); + + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + time_t hittime = llentry_get_hittime_raw(child_lle); + if (hittime > lle_hittime) + lle_hittime = hittime; + } + + return (lle_hittime); +} + /* * Update link-layer header for given @lle after * interface lladdr was changed. @@ -585,7 +630,7 @@ lltable_delete_addr(struct lltable *llt, u_int flags, ifp = llt->llt_ifp; IF_AFDATA_WLOCK(ifp); - lle = lla_lookup(llt, LLE_EXCLUSIVE, l3addr); + lle = lla_lookup(llt, LLE_SF(l3addr->sa_family, LLE_EXCLUSIVE), l3addr); if (lle == NULL) { IF_AFDATA_WUNLOCK(ifp); @@ -700,6 +745,25 @@ lltable_link_entry(struct lltable *llt, struct llentry *lle) return (llt->llt_link_entry(llt, lle)); } +void +lltable_link_child_entry(struct llentry *lle, struct llentry *child_lle) +{ + child_lle->lle_parent = lle; + child_lle->lle_tbl = lle->lle_tbl; + child_lle->la_flags |= LLE_LINKED; + CK_SLIST_INSERT_HEAD(&lle->lle_children, child_lle, lle_child_next); +} + +void +lltable_unlink_child_entry(struct llentry *child_lle) +{ + struct llentry *lle = child_lle->lle_parent; + + child_lle->la_flags &= ~LLE_LINKED; + child_lle->lle_parent = NULL; + CK_SLIST_REMOVE(&lle->lle_children, child_lle, llentry, lle_child_next); +} + int lltable_unlink_entry(struct lltable *llt, struct llentry *lle) { diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h index ffbaa7a946bb..7ad9d59a1a0e 100644 --- a/sys/net/if_llatbl.h +++ b/sys/net/if_llatbl.h @@ -58,7 +58,8 @@ struct llentry { } r_l3addr; char r_linkdata[LLE_MAX_LINKHDR]; /* L2 data */ uint8_t r_hdrlen; /* length for LL header */ - uint8_t spare0[3]; + uint8_t r_family; /* Upper layer proto family */ + uint8_t spare0[2]; uint16_t r_flags; /* LLE runtime flags */ uint16_t r_skip_req; /* feedback from fast path */ @@ -78,6 +79,9 @@ struct llentry { time_t lle_hittime; /* Time when r_skip_req was unset */ int lle_refcnt; char *ll_addr; /* link-layer address */ + CK_SLIST_HEAD(llentry_children_head,llentry) lle_children; /* child encaps */ + CK_SLIST_ENTRY(llentry) lle_child_next; /* child encaps */ + struct llentry *lle_parent; /* parent for a child */ CK_LIST_ENTRY(llentry) lle_chain; /* chain of deleted items */ struct callout lle_timer; @@ -104,6 +108,8 @@ struct llentry { #define LLE_IS_VALID(lle) (((lle) != NULL) && ((lle) != (void *)-1)) +#define LLE_SF(_fam, _flags) (((_flags) & 0xFFFF) | ((_fam) << 16)) + #define LLE_ADDREF(lle) do { \ LLE_WLOCK_ASSERT(lle); \ KASSERT((lle)->lle_refcnt >= 0, \ @@ -195,6 +201,7 @@ MALLOC_DECLARE(M_LLTABLE); #define LLE_REDIRECT 0x0010 /* installed by redirect; has host rtentry */ #define LLE_PUB 0x0020 /* publish entry ??? */ #define LLE_LINKED 0x0040 /* linked to lookup structure */ +#define LLE_CHILD 0x0080 /* Child LLE storing different AF encap */ /* LLE request flags */ #define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */ #define LLE_UNLOCKED 0x4000 /* return lle unlocked */ @@ -234,6 +241,8 @@ int lltable_delete_addr(struct lltable *llt, u_int flags, const struct sockaddr *l3addr); int lltable_link_entry(struct lltable *llt, struct llentry *lle); int lltable_unlink_entry(struct lltable *llt, struct llentry *lle); +void lltable_link_child_entry(struct llentry *parent_lle, struct llentry *child_lle); +void lltable_unlink_child_entry(struct llentry *child_lle); void lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa); struct ifnet *lltable_get_ifp(const struct lltable *llt); int lltable_get_af(const struct lltable *llt); @@ -267,6 +276,7 @@ llentry_provide_feedback(struct llentry *lle) return; llentry_mark_used(lle); } +struct llentry *llentry_lookup_family(struct llentry *lle, int family); int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *); diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c index 8eddb73d333c..1c0be6011253 100644 --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -483,7 +483,7 @@ toe_l2_resolve(struct toedev *tod, struct ifnet *ifp, struct sockaddr *sa, #endif #ifdef INET6 case AF_INET6: - rc = nd6_resolve(ifp, 0, NULL, sa, lladdr, NULL, NULL); + rc = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), NULL, sa, lladdr, NULL, NULL); break; #endif default: diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 6b8f0f7be5bb..f4a5574084fd 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -2546,7 +2546,7 @@ icmp6_redirect_output(struct mbuf *m0, struct nhop_object *nh) struct nd_opt_hdr *nd_opt; char *lladdr; - ln = nd6_lookup(router_ll6, 0, ifp); + ln = nd6_lookup(router_ll6, LLE_SF(AF_INET6, 0), ifp); if (ln == NULL) goto nolladdropt; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index d5b3452c0b06..142a05ded2b6 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2335,6 +2335,11 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, lle = in6_lltable_find_dst(llt, &sin6->sin6_addr); if (lle == NULL) return (NULL); + + int family = flags >> 16; + if (__predict_false(family != AF_INET6)) + lle = llentry_lookup_family(lle, family); + if (flags & LLE_UNLOCKED) return (lle); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 38f03916531f..14312f0a30a3 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -139,7 +139,7 @@ static void nd6_free_redirect(const struct llentry *); static void nd6_llinfo_timer(void *); static void nd6_llinfo_settimer_locked(struct llentry *, long); static void clear_llinfo_pqueue(struct llentry *); -static int nd6_resolve_slow(struct ifnet *, int, struct mbuf *, +static int nd6_resolve_slow(struct ifnet *, int, int, struct mbuf *, const struct sockaddr_in6 *, u_char *, uint32_t *, struct llentry **); static int nd6_need_cache(struct ifnet *); @@ -530,6 +530,10 @@ nd6_llinfo_settimer_locked(struct llentry *ln, long tick) LLE_WLOCK_ASSERT(ln); + /* Do not schedule timers for child LLEs. */ + if (ln->la_flags & LLE_CHILD) + return; + if (tick < 0) { ln->la_expire = 0; ln->ln_ntick = 0; @@ -1375,40 +1379,76 @@ nd6_is_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp) * Even if the address matches none of our addresses, it might be * in the neighbor cache. */ - if ((lle = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL) { + if ((lle = nd6_lookup(&addr->sin6_addr, LLE_SF(AF_INET6, 0), ifp)) != NULL) { LLE_RUNLOCK(lle); rc = 1; } return (rc); } +static __noinline void +nd6_free_children(struct llentry *lle) +{ + struct llentry *child_lle; + + NET_EPOCH_ASSERT(); + LLE_WLOCK_ASSERT(lle); + + while ((child_lle = CK_SLIST_FIRST(&lle->lle_children)) != NULL) { + LLE_WLOCK(child_lle); + lltable_unlink_child_entry(child_lle); + llentry_free(child_lle); + } +} + /* * Tries to update @lle address/prepend data with new @lladdr. * * Returns true on success. * In any case, @lle is returned wlocked. */ -bool -nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr) +static __noinline bool +nd6_try_set_entry_addr_locked(struct ifnet *ifp, struct llentry *lle, char *lladdr) { - u_char linkhdr[LLE_MAX_LINKHDR]; - size_t linkhdrsize; - int lladdr_off; - - LLE_WLOCK_ASSERT(lle); + u_char buf[LLE_MAX_LINKHDR]; + int fam, off; + size_t sz; - linkhdrsize = sizeof(linkhdr); - if (lltable_calc_llheader(ifp, AF_INET6, lladdr, - linkhdr, &linkhdrsize, &lladdr_off) != 0) { + sz = sizeof(buf); + if (lltable_calc_llheader(ifp, AF_INET6, lladdr, buf, &sz, &off) != 0) return (false); + + /* Update data */ + lltable_set_entry_addr(ifp, lle, buf, sz, off); + + struct llentry *child_lle; + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + LLE_WLOCK(child_lle); + fam = child_lle->r_family; + sz = sizeof(buf); + if (lltable_calc_llheader(ifp, fam, lladdr, buf, &sz, &off) == 0) { + /* success */ + lltable_set_entry_addr(ifp, child_lle, buf, sz, off); + child_lle->ln_state = ND6_LLINFO_REACHABLE; + } + LLE_WUNLOCK(child_lle); } + return (true); +} + +bool +nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr) +{ + NET_EPOCH_ASSERT(); + LLE_WLOCK_ASSERT(lle); + if (!lltable_acquire_wlock(ifp, lle)) return (false); - lltable_set_entry_addr(ifp, lle, linkhdr, linkhdrsize, lladdr_off); + bool ret = nd6_try_set_entry_addr_locked(ifp, lle, lladdr); IF_AFDATA_WUNLOCK(ifp); - return (true); + return (ret); } /* @@ -1432,6 +1472,8 @@ nd6_free(struct llentry **lnp, int gc) LLE_WLOCK_ASSERT(ln); ND6_RLOCK_ASSERT(); + KASSERT((ln->la_flags & LLE_CHILD) == 0, ("child lle")); + ifp = lltable_get_ifp(ln->lle_tbl); if ((ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) != 0) dr = defrouter_lookup_locked(&ln->r_l3addr.addr6, ifp); @@ -1553,6 +1595,8 @@ nd6_free(struct llentry **lnp, int gc) } IF_AFDATA_UNLOCK(ifp); + nd6_free_children(ln); + llentry_free(ln); if (dr != NULL) defrouter_rele(dr); @@ -1827,7 +1871,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) return (error); NET_EPOCH_ENTER(et); - ln = nd6_lookup(&nb_addr, 0, ifp); + ln = nd6_lookup(&nb_addr, LLE_SF(AF_INET6, 0), ifp); NET_EPOCH_EXIT(et); if (ln == NULL) { @@ -1977,7 +2021,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, * description on it in NS section (RFC 2461 7.2.3). */ flags = lladdr ? LLE_EXCLUSIVE : 0; - ln = nd6_lookup(from, flags, ifp); + ln = nd6_lookup(from, LLE_SF(AF_INET6, flags), ifp); is_newentry = 0; if (ln == NULL) { flags |= LLE_EXCLUSIVE; @@ -2001,7 +2045,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, IF_AFDATA_WLOCK(ifp); LLE_WLOCK(ln); /* Prefer any existing lle over newly-created one */ - ln_tmp = nd6_lookup(from, LLE_EXCLUSIVE, ifp); + ln_tmp = nd6_lookup(from, LLE_SF(AF_INET6, LLE_EXCLUSIVE), ifp); if (ln_tmp == NULL) lltable_link_entry(LLTABLE6(ifp), ln); IF_AFDATA_WUNLOCK(ifp); @@ -2086,6 +2130,8 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, if (chain != NULL) nd6_flush_holdchain(ifp, ln, chain); + if (do_update) + nd6_flush_children_holdchain(ifp, ln); /* * When the link-layer address of a router changes, select the @@ -2227,7 +2273,7 @@ nd6_output_ifp(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m, * - other errors (alloc failure, etc) */ int -nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, +nd6_resolve(struct ifnet *ifp, int gw_flags, struct mbuf *m, const struct sockaddr *sa_dst, u_char *desten, uint32_t *pflags, struct llentry **plle) { @@ -2261,8 +2307,9 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, } } - ln = nd6_lookup(&dst6->sin6_addr, plle ? LLE_EXCLUSIVE : LLE_UNLOCKED, - ifp); + int family = gw_flags >> 16; + int lookup_flags = plle ? LLE_EXCLUSIVE : LLE_UNLOCKED; + ln = nd6_lookup(&dst6->sin6_addr, LLE_SF(family, lookup_flags), ifp); if (ln != NULL && (ln->r_flags & RLLE_VALID) != 0) { /* Entry found, let's copy lle info */ bcopy(ln->r_linkdata, desten, ln->r_hdrlen); @@ -2278,19 +2325,39 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, } else if (plle && ln) LLE_WUNLOCK(ln); - return (nd6_resolve_slow(ifp, 0, m, dst6, desten, pflags, plle)); + return (nd6_resolve_slow(ifp, family, 0, m, dst6, desten, pflags, plle)); } /* - * Finds or creates a new llentry for @addr. + * Finds or creates a new llentry for @addr and @family. * Returns wlocked llentry or NULL. + * + * + * Child LLEs. + * + * Do not have their own state machine (gets marked as static) + * settimer bails out for child LLEs just in case. + * + * Locking order: parent lle gets locked first, chen goes the child. */ static __noinline struct llentry * -nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr) +nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr, int family) { + struct llentry *child_lle = NULL; struct llentry *lle, *lle_tmp; lle = nd6_alloc(addr, 0, ifp); + if (lle != NULL && family != AF_INET6) { + child_lle = nd6_alloc(addr, 0, ifp); + if (child_lle == NULL) { + lltable_free_entry(LLTABLE6(ifp), lle); + return (NULL); + } + child_lle->r_family = family; + child_lle->la_flags |= LLE_CHILD | LLE_STATIC; + child_lle->ln_state = ND6_LLINFO_INCOMPLETE; + } + if (lle == NULL) { char ip6buf[INET6_ADDRSTRLEN]; log(LOG_DEBUG, @@ -2303,15 +2370,30 @@ nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr) IF_AFDATA_WLOCK(ifp); LLE_WLOCK(lle); /* Prefer any existing entry over newly-created one */ - lle_tmp = nd6_lookup(addr, LLE_EXCLUSIVE, ifp); + lle_tmp = nd6_lookup(addr, LLE_SF(AF_INET6, LLE_EXCLUSIVE), ifp); if (lle_tmp == NULL) lltable_link_entry(LLTABLE6(ifp), lle); - IF_AFDATA_WUNLOCK(ifp); - if (lle_tmp != NULL) { + else { lltable_free_entry(LLTABLE6(ifp), lle); - return (lle_tmp); - } else - return (lle); + lle = lle_tmp; + } + if (child_lle != NULL) { + /* Check if child lle for the same family exists */ + lle_tmp = llentry_lookup_family(lle, child_lle->r_family); + LLE_WLOCK(child_lle); + if (lle_tmp == NULL) { + /* Attach */ + lltable_link_child_entry(lle, child_lle); + } else { + /* child lle already exists, free newly-created one */ + lltable_free_entry(LLTABLE6(ifp), child_lle); + child_lle = lle_tmp; + } + LLE_WUNLOCK(lle); + lle = child_lle; + } + IF_AFDATA_WUNLOCK(ifp); + return (lle); } /* @@ -2326,7 +2408,7 @@ nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr) * Set noinline to be dtrace-friendly */ static __noinline int -nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, +nd6_resolve_slow(struct ifnet *ifp, int family, int flags, struct mbuf *m, const struct sockaddr_in6 *dst, u_char *desten, uint32_t *pflags, struct llentry **plle) { @@ -2343,14 +2425,14 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, * At this point, the destination of the packet must be a unicast * or an anycast address(i.e. not a multicast). */ - lle = nd6_lookup(&dst->sin6_addr, LLE_EXCLUSIVE, ifp); + lle = nd6_lookup(&dst->sin6_addr, LLE_SF(family, LLE_EXCLUSIVE), ifp); if ((lle == NULL) && nd6_is_addr_neighbor(dst, ifp)) { /* * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), * the condition below is not very efficient. But we believe * it is tolerable, because this should be a rare case. */ - lle = nd6_get_llentry(ifp, &dst->sin6_addr); + lle = nd6_get_llentry(ifp, &dst->sin6_addr, family); } if (lle == NULL) { @@ -2367,7 +2449,7 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, * neighbor unreachability detection on expiration. * (RFC 2461 7.3.3) */ - if (lle->ln_state == ND6_LLINFO_STALE) + if ((!(lle->la_flags & LLE_CHILD)) && (lle->ln_state == ND6_LLINFO_STALE)) nd6_llinfo_setstate(lle, ND6_LLINFO_DELAY); /* @@ -2432,6 +2514,14 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, */ psrc = NULL; send_ns = 0; + + /* If we have child lle, switch to the parent to send NS */ + if (lle->la_flags & LLE_CHILD) { + struct llentry *lle_parent = lle->lle_parent; + LLE_WUNLOCK(lle); + lle = lle_parent; + LLE_WLOCK(lle); + } if (lle->la_asked == 0) { lle->la_asked++; send_ns = 1; @@ -2463,7 +2553,7 @@ nd6_resolve_addr(struct ifnet *ifp, int flags, const struct sockaddr *dst, int error; flags |= LLE_ADDRONLY; - error = nd6_resolve_slow(ifp, flags, NULL, + error = nd6_resolve_slow(ifp, AF_INET6, flags, NULL, (const struct sockaddr_in6 *)dst, desten, pflags, NULL); return (error); } @@ -2499,6 +2589,22 @@ nd6_flush_holdchain(struct ifnet *ifp, struct llentry *lle, struct mbuf *chain) return (error); } +__noinline void +nd6_flush_children_holdchain(struct ifnet *ifp, struct llentry *lle) +{ + struct llentry *child_lle; + struct mbuf *chain; + + NET_EPOCH_ASSERT(); + + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + LLE_WLOCK(child_lle); + chain = nd6_grab_holdchain(child_lle); + LLE_WUNLOCK(child_lle); + nd6_flush_holdchain(ifp, child_lle, chain); + } +} + static int nd6_need_cache(struct ifnet *ifp) { @@ -2552,7 +2658,7 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia) IF_AFDATA_WLOCK(ifp); LLE_WLOCK(ln); /* Unlink any entry if exists */ - ln_tmp = lla_lookup(LLTABLE6(ifp), LLE_EXCLUSIVE, dst); + ln_tmp = lla_lookup(LLTABLE6(ifp), LLE_SF(AF_INET6, LLE_EXCLUSIVE), dst); if (ln_tmp != NULL) lltable_unlink_entry(LLTABLE6(ifp), ln_tmp); lltable_link_entry(LLTABLE6(ifp), ln); diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index fe0f2b22cc48..3f9f8219b018 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -379,6 +379,7 @@ void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, bool nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr); struct mbuf *nd6_grab_holdchain(struct llentry *); int nd6_flush_holdchain(struct ifnet *, struct llentry *, struct mbuf *); +void nd6_flush_children_holdchain(struct ifnet *, struct llentry *); int nd6_add_ifa_lle(struct in6_ifaddr *); void nd6_rem_ifa_lle(struct in6_ifaddr *, int); int nd6_output_ifp(struct ifnet *, struct ifnet *, struct mbuf *, diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 974c454e93a5..30d73f9d71a9 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -630,6 +630,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) size_t linkhdrsize; int flags, is_override, is_router, is_solicited; int lladdr_off, lladdrlen, checklink; + bool flush_holdchain = false; NET_EPOCH_ASSERT(); @@ -747,7 +748,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) * If no neighbor cache entry is found, NA SHOULD silently be * discarded. */ - ln = nd6_lookup(&taddr6, LLE_EXCLUSIVE, ifp); + ln = nd6_lookup(&taddr6, LLE_SF(AF_INET6, LLE_EXCLUSIVE), ifp); if (ln == NULL) { goto freeit; } @@ -773,6 +774,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) if (!nd6_try_set_entry_addr(ifp, ln, lladdr)) goto freeit; + flush_holdchain = true; EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); if (is_solicited) nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); @@ -899,6 +901,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) if (chain != NULL) nd6_flush_holdchain(ifp, ln, chain); + if (flush_holdchain) + nd6_flush_children_holdchain(ifp, ln); if (checklink) pfxlist_onlink_check(); diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index a8e951721b8d..297469bd4d87 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -584,8 +585,8 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, } else { bool is_gw = (nh->nh_flags & NHF_GATEWAY) != 0; memset(edst, 0, MAX_ADDR_LEN); - error = nd6_resolve(ifp, is_gw, NULL, is_gw ? - &nh->gw_sa : (const struct sockaddr *)&dst_tmp, + error = nd6_resolve(ifp, LLE_SF(AF_INET6, is_gw), NULL, + is_gw ? &nh->gw_sa : (const struct sockaddr *)&dst_tmp, edst, NULL, NULL); if (error != 0) goto error_put_ifp; From owner-dev-commits-src-main@freebsd.org Sat Aug 21 17:42:58 2021 Return-Path: Delivered-To: dev-commits-src-main@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 CF3656761C7; Sat, 21 Aug 2021 17:42:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsQnt5CChz4Qq3; Sat, 21 Aug 2021 17:42:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B57811734; Sat, 21 Aug 2021 17:42:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17LHgwuf094310; Sat, 21 Aug 2021 17:42:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17LHgwBB094309; Sat, 21 Aug 2021 17:42:58 GMT (envelope-from git) Date: Sat, 21 Aug 2021 17:42:58 GMT Message-Id: <202108211742.17LHgwBB094309@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 2cdff9918e79 - main - byhve: add option to specify IP address for gdb MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2cdff9918e79dcd9bfcaa919b8364afa41cd1e02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2021 17:42:58 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=2cdff9918e79dcd9bfcaa919b8364afa41cd1e02 commit 2cdff9918e79dcd9bfcaa919b8364afa41cd1e02 Author: Mariusz Zaborski AuthorDate: 2021-08-19 17:52:12 +0000 Commit: Mariusz Zaborski CommitDate: 2021-08-21 17:43:17 +0000 byhve: add option to specify IP address for gdb Allow user to specify the IP address available for gdb debugger. Reviewed by: jhb, grehan, rgrimes, bcr (man pages) Differential Revision: https://reviews.freebsd.org/D29607 --- usr.sbin/bhyve/bhyve.8 | 16 ++++++++++----- usr.sbin/bhyve/bhyverun.c | 35 ++++++++++++++++++++++++--------- usr.sbin/bhyve/gdb.c | 50 +++++++++++++++++++++++++++++++++++++---------- usr.sbin/bhyve/gdb.h | 2 +- 4 files changed, 78 insertions(+), 25 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index fcf47ec65513..8ebb8aea6210 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 18, 2021 +.Dd August 19, 2021 .Dt BHYVE 8 .Os .Sh NAME @@ -137,16 +137,22 @@ Force .Nm to exit when a guest issues an access to an I/O port that is not emulated. This is intended for debug purposes. -.It Fl G Ar port +.It Fl G Xo +.Sm off +.Oo Ar w Oc +.Oo Ar bind_address: Oc +.Ar port +.Sm on +.Xc Start a debug server that uses the GDB protocol to export guest state to a debugger. An IPv4 TCP socket will be bound to the supplied +.Ar bind_address +and .Ar port to listen for debugger connections. Only a single debugger may be attached to the debug server at a time. -If -.Ar port -begins with +If the option begins with .Sq w , .Nm will pause execution at the first instruction waiting for a debugger to attach. diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index acf0df6cc9bf..a5645f645289 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -1193,6 +1193,30 @@ parse_simple_config_file(const char *path) fclose(fp); } +static void +parse_gdb_options(char *optarg) +{ + const char *sport; + char *colon; + + if (optarg[0] == 'w') { + set_config_bool("gdb.wait", true); + optarg++; + } + + colon = strrchr(optarg, ':'); + if (colon == NULL) { + sport = optarg; + } else { + *colon = '\0'; + colon++; + sport = colon; + set_config_value("gdb.address", optarg); + } + + set_config_value("gdb.port", sport); +} + static void set_defaults(void) { @@ -1256,11 +1280,7 @@ main(int argc, char *argv[]) set_config_bool("memory.guest_in_core", true); break; case 'G': - if (optarg[0] == 'w') { - set_config_bool("gdb.wait", true); - optarg++; - } - set_config_value("gdb.port", optarg); + parse_gdb_options(optarg); break; case 'k': parse_simple_config_file(optarg); @@ -1447,10 +1467,7 @@ main(int argc, char *argv[]) if (get_config_bool("acpi_tables")) vmgenc_init(ctx); - value = get_config_value("gdb.port"); - if (value != NULL) - init_gdb(ctx, atoi(value), get_config_bool_default("gdb.wait", - false)); + init_gdb(ctx); if (lpc_bootrom()) { if (vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1)) { diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c index 219d192b7c9a..3e12c50f64cb 100644 --- a/usr.sbin/bhyve/gdb.c +++ b/usr.sbin/bhyve/gdb.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -59,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include "bhyverun.h" +#include "config.h" #include "gdb.h" #include "mem.h" #include "mevent.h" @@ -1818,12 +1820,35 @@ limit_gdb_socket(int s) #endif void -init_gdb(struct vmctx *_ctx, int sport, bool wait) +init_gdb(struct vmctx *_ctx) { - struct sockaddr_in sin; int error, flags, optval, s; + struct addrinfo hints; + struct addrinfo *gdbaddr; + const char *saddr, *value; + char *sport; + bool wait; + + value = get_config_value("gdb.port"); + if (value == NULL) + return; + sport = strdup(value); + if (sport == NULL) + errx(4, "Failed to allocate memory"); + + wait = get_config_bool_default("gdb.wait", false); + + saddr = get_config_value("gdb.address"); + if (saddr == NULL) { +#if defined(INET) + saddr = "0.0.0.0"; +#elif defined(INET6) + saddr = "[::]"; +#endif + } - debug("==> starting on %d, %swaiting\n", sport, wait ? "" : "not "); + debug("==> starting on %s:%s, %swaiting\n", + saddr, sport, wait ? "" : "not "); error = pthread_mutex_init(&gdb_lock, NULL); if (error != 0) @@ -1832,20 +1857,23 @@ init_gdb(struct vmctx *_ctx, int sport, bool wait) if (error != 0) errc(1, error, "gdb cv init"); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV | AI_PASSIVE; + + if (getaddrinfo(saddr, sport, &hints, &gdbaddr) != 0) + err(1, "gdb address resolve"); + ctx = _ctx; - s = socket(PF_INET, SOCK_STREAM, 0); + s = socket(gdbaddr->ai_family, gdbaddr->ai_socktype, 0); if (s < 0) err(1, "gdb socket create"); optval = 1; (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = htonl(INADDR_ANY); - sin.sin_port = htons(sport); - - if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) + if (bind(s, gdbaddr->ai_addr, gdbaddr->ai_addrlen) < 0) err(1, "gdb socket bind"); if (listen(s, 1) < 0) @@ -1874,4 +1902,6 @@ init_gdb(struct vmctx *_ctx, int sport, bool wait) #endif mevent_add(s, EVF_READ, new_connection, NULL); gdb_active = true; + freeaddrinfo(gdbaddr); + free(sport); } diff --git a/usr.sbin/bhyve/gdb.h b/usr.sbin/bhyve/gdb.h index 93396c1c6705..c5fa522c63e0 100644 --- a/usr.sbin/bhyve/gdb.h +++ b/usr.sbin/bhyve/gdb.h @@ -34,6 +34,6 @@ void gdb_cpu_add(int vcpu); void gdb_cpu_breakpoint(int vcpu, struct vm_exit *vmexit); void gdb_cpu_mtrap(int vcpu); void gdb_cpu_suspend(int vcpu); -void init_gdb(struct vmctx *ctx, int sport, bool wait); +void init_gdb(struct vmctx *ctx); #endif /* !__GDB_H__ */ From owner-dev-commits-src-main@freebsd.org Sat Aug 21 17:42:59 2021 Return-Path: Delivered-To: dev-commits-src-main@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 F289A675CC8; Sat, 21 Aug 2021 17:42:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsQnv6QQpz3wXW; Sat, 21 Aug 2021 17:42:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE5E411735; Sat, 21 Aug 2021 17:42:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17LHgxL9094336; Sat, 21 Aug 2021 17:42:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17LHgx1U094335; Sat, 21 Aug 2021 17:42:59 GMT (envelope-from git) Date: Sat, 21 Aug 2021 17:42:59 GMT Message-Id: <202108211742.17LHgx1U094335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 3a92927bb69f - main - bhyve: change a default address from ANY to localhost MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a92927bb69f2d3fcd3dec4c909aab2191f4b848 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2021 17:43:00 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=3a92927bb69f2d3fcd3dec4c909aab2191f4b848 commit 3a92927bb69f2d3fcd3dec4c909aab2191f4b848 Author: Mariusz Zaborski AuthorDate: 2021-08-19 18:00:35 +0000 Commit: Mariusz Zaborski CommitDate: 2021-08-21 17:43:17 +0000 bhyve: change a default address from ANY to localhost Discussed with: grehan, jhb --- usr.sbin/bhyve/gdb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c index 3e12c50f64cb..0cee1c8f9543 100644 --- a/usr.sbin/bhyve/gdb.c +++ b/usr.sbin/bhyve/gdb.c @@ -1840,11 +1840,7 @@ init_gdb(struct vmctx *_ctx) saddr = get_config_value("gdb.address"); if (saddr == NULL) { -#if defined(INET) - saddr = "0.0.0.0"; -#elif defined(INET6) - saddr = "[::]"; -#endif + saddr = "localhost"; } debug("==> starting on %s:%s, %swaiting\n", @@ -1860,7 +1856,7 @@ init_gdb(struct vmctx *_ctx) memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV | AI_PASSIVE; + hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE; if (getaddrinfo(saddr, sport, &hints, &gdbaddr) != 0) err(1, "gdb address resolve"); From owner-dev-commits-src-main@freebsd.org Sat Aug 21 18:29:37 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5AC0867665D; Sat, 21 Aug 2021 18:29:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsRqj1nTBz4fMr; Sat, 21 Aug 2021 18:29:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FACA119F3; Sat, 21 Aug 2021 18:29:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17LITaxT048542; Sat, 21 Aug 2021 18:29:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17LITajS048541; Sat, 21 Aug 2021 18:29:36 GMT (envelope-from git) Date: Sat, 21 Aug 2021 18:29:36 GMT Message-Id: <202108211829.17LITajS048541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 7b0d05d56dfa - main - loader: loader_lua can run command_more twice MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b0d05d56dfaad4e1d5a19727e34252072913d17 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2021 18:29:37 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=7b0d05d56dfaad4e1d5a19727e34252072913d17 commit 7b0d05d56dfaad4e1d5a19727e34252072913d17 Author: Toomas Soome AuthorDate: 2021-08-21 18:17:18 +0000 Commit: Toomas Soome CommitDate: 2021-08-21 18:28:54 +0000 loader: loader_lua can run command_more twice When we quit pager, the return value 1 is returned and command_more() interprets it as error. when lua loader gets error from command, it will try to interpret it once more, so we get the same file shown once more. There is no reason why we should return error from command_more(). MFC after: 1 week --- stand/common/commands.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/stand/common/commands.c b/stand/common/commands.c index 4c1c9b2b6a86..9f7252014d87 100644 --- a/stand/common/commands.c +++ b/stand/common/commands.c @@ -484,10 +484,7 @@ command_more(int argc, char *argv[]) } pager_close(); - if (res == 0) - return (CMD_OK); - else - return (CMD_ERROR); + return (CMD_OK); } static int From owner-dev-commits-src-main@freebsd.org Sat Aug 21 21:04:10 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9BB0E6783A9; Sat, 21 Aug 2021 21:04:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsWG213gPz3qLV; Sat, 21 Aug 2021 21:04:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C3281419A; Sat, 21 Aug 2021 21:04:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17LL4903063483; Sat, 21 Aug 2021 21:04:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17LL49cQ063482; Sat, 21 Aug 2021 21:04:09 GMT (envelope-from git) Date: Sat, 21 Aug 2021 21:04:09 GMT Message-Id: <202108212104.17LL49cQ063482@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: efa485d5c390 - main - Apply clang fix for assertion failure compiling multimedia/minitube MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: efa485d5c390b745f53761da9159721243c48b7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2021 21:04:10 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=efa485d5c390b745f53761da9159721243c48b7b commit efa485d5c390b745f53761da9159721243c48b7b Author: Dimitry Andric AuthorDate: 2021-08-21 21:03:37 +0000 Commit: Dimitry Andric CommitDate: 2021-08-21 21:03:50 +0000 Apply clang fix for assertion failure compiling multimedia/minitube Merge commit 79f9cfbc21e0 from llvm git (by Yaxun (Sam) Liu): Do not merge LocalInstantiationScope for template specialization A lambda in a function template may be recursively instantiated. The recursive lambda will cause a lambda function instantiated multiple times, one inside another. The inner LocalInstantiationScope should not be marked as MergeWithParentScope since it already has references to locals properly substituted, otherwise it causes assertion due to the check for duplicate locals in merged LocalInstantiationScope. Reviewed by: Richard Smith Differential Revision: https://reviews.llvm.org/D98068 Reported by: yuri PR: 257978 MFC after: 3 days --- .../llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index dc1e0ef60cac..216a64e02380 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -4841,10 +4841,13 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, // Introduce a new scope where local variable instantiations will be // recorded, unless we're actually a member function within a local // class, in which case we need to merge our results with the parent - // scope (of the enclosing function). + // scope (of the enclosing function). The exception is instantiating + // a function template specialization, since the template to be + // instantiated already has references to locals properly substituted. bool MergeWithParentScope = false; if (CXXRecordDecl *Rec = dyn_cast(Function->getDeclContext())) - MergeWithParentScope = Rec->isLocalClass(); + MergeWithParentScope = + Rec->isLocalClass() && !Function->isFunctionTemplateSpecialization(); LocalInstantiationScope Scope(*this, MergeWithParentScope); From owner-dev-commits-src-main@freebsd.org Sun Aug 22 05:58:14 2021 Return-Path: Delivered-To: dev-commits-src-main@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 F224F67ED4A; Sun, 22 Aug 2021 05:58:13 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (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 4Gsl6F55jLz4t8X; Sun, 22 Aug 2021 05:58:13 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTP id HQWpms2h7FRDpHgUnmCs1q; Sun, 22 Aug 2021 05:58:13 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id HgUlmmWShB9dPHgUmmKIIh; Sun, 22 Aug 2021 05:58:13 +0000 X-Authority-Analysis: v=2.4 cv=Ac10o1bG c=1 sm=1 tr=0 ts=6121e775 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=MhDmnRu9jo8A:10 a=6I5d2MoRAAAA:8 a=NEAV23lmAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=_4LdrX-sCBZswC-hWvYA:9 a=WcX1nqYDLv0r7bjD:21 a=vqf2npe_uwhkvVT2:21 a=0wDwsOqeTLLA_pT6:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B284213D; Sat, 21 Aug 2021 22:58:10 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 17M5wAuq003114; Sat, 21 Aug 2021 22:58:10 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202108220558.17M5wAuq003114@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: "Alexander V. Chernikov" cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: c541bd368f86 - main - lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries. In-reply-to: <202108211735.17LHZ0WI081502@gitrepo.freebsd.org> References: <202108211735.17LHZ0WI081502@gitrepo.freebsd.org> Comments: In-reply-to "Alexander V. Chernikov" message dated "Sat, 21 Aug 2021 17:35:00 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 21 Aug 2021 22:58:10 -0700 X-CMAE-Envelope: MS4xfPJdHvbUQRPnlpIQQgrVEr9o12cFQDU0yZtWyUN4HHXE2hgpMrXRA1n6YrLNmtmctdiDrO9nbrzfI21Zdi6MLvvY3+kWSrC4ohkO6iW+wIQKxhNUpi9Y YhojGI6+X5+r22ITODbXM+6uSKx7GteL9/Osoz/oN4UeM6kMxeAa8qWhhc7HmrwWI2iUCfV5bwJcJzs3ptlVeNju2CRX78+u3yiZ7wSVU90Sxga4jp8D/Noc wQol1zmEBY18RmYJ+w7lWokD4g99TZVH1XnXrwLCo9H2V+Ro+hvcZgIGdKxpSWM1JVxp0PQB7d4Y1mXNueav0kiP7wh4puT2lu1DSJPs5HI= X-Rspamd-Queue-Id: 4Gsl6F55jLz4t8X X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 05:58:14 -0000 In message <202108211735.17LHZ0WI081502@gitrepo.freebsd.org>, "Alexander V. Che rnikov" writes: > The branch main has been updated by melifaro: > > URL: https://cgit.FreeBSD.org/src/commit/?id=c541bd368f863bbf5c08dd5c1ecce016 > 6ad47389 > > commit c541bd368f863bbf5c08dd5c1ecce0166ad47389 > Author: Alexander V. Chernikov > AuthorDate: 2021-08-21 14:13:32 +0000 > Commit: Alexander V. Chernikov > CommitDate: 2021-08-21 17:34:35 +0000 > > lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries > . > > Currently we use pre-calculated headers inside LLE entries as prepend dat > a > for `if_output` functions. Using these headers allows saving some > CPU cycles/memory accesses on the fast path. > > However, this approach makes adding L2 header for IPv4 traffic with IPv6 > nexthops more complex, as it is not possible to store multiple > pre-calculated headers inside lle. Additionally, the solution space is > limited by the fact that PCB caching saves LLEs in addition to the nexth > op. > > Thus, add support for creating special "child" LLEs for the purpose of ho > lding > custom family encaps and store mbufs pending resolution. To simplify han > dling > of those LLEs, store them in a linked-list inside a "parent" (e.g. norma > l) LLE. > Such LLEs are not visible when iterating LLE table. Their lifecycle is b > ound > to the "parent" LLE - it is not possible to delete "child" when parent i > s alive. > Furthermore, "child" LLEs are static (RTF_STATIC), avoding complex state > machine used by the standard LLEs. > > nd6_lookup() and nd6_resolve() now accepts an additional argument, family > , > allowing to return such child LLEs. This change uses `LLE_SF()` macro wh > ich > packs family and flags in a single int field. This is done to simplify m > erging > back to stable/. Once this code lands, most of the cases will be convert > ed to > use a dedicated `family` parameter. > > Differential Revision: https://reviews.freebsd.org/D31379 > MFC after: 2 weeks > --- > sys/net/if_ethersubr.c | 4 +- > sys/net/if_fwsubr.c | 4 +- > sys/net/if_infiniband.c | 3 +- > sys/net/if_llatbl.c | 70 +++++++++++- > sys/net/if_llatbl.h | 12 +- > sys/netinet/toecore.c | 2 +- > sys/netinet6/icmp6.c | 2 +- > sys/netinet6/in6.c | 5 + > sys/netinet6/nd6.c | 176 +++++++++++++++++++++++---- > -- > sys/netinet6/nd6.h | 1 + > sys/netinet6/nd6_nbr.c | 6 +- > sys/ofed/drivers/infiniband/core/ib_addr.c | 5 +- > 12 files changed, 241 insertions(+), 49 deletions(-) This commit causes two of my machines a bit of gas. Fatal trap 12: page fault while in kernel mode cpuid = 0; apic id = 00 fault virtual address = 0x128 fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff806cb53d stack pointer = 0x28:0xfffffe008da1a210 frame pointer = 0x28:0xfffffe008da1a210 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 0 (bge0 taskq) trap number = 12 panic: page fault cpuid = 0 time = 1629610416 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe008da19eb0 vpanic() at vpanic+0x187/frame 0xfffffe008da19f10 panic() at panic+0x43/frame 0xfffffe008da19f70 trap_fatal() at trap_fatal+0x387/frame 0xfffffe008da19fd0 trap_pfault() at trap_pfault+0x4f/frame 0xfffffe008da1a030 trap() at trap+0x26a/frame 0xfffffe008da1a140 calltrap() at calltrap+0x8/frame 0xfffffe008da1a140 --- trap 0xc, rip = 0xffffffff806cb53d, rsp = 0xfffffe008da1a210, rbp = 0xfffffe008da1a210 --- __rw_rlock_int() at __rw_rlock_int+0xd/frame 0xfffffe008da1a210 in6_lltable_lookup() at in6_lltable_lookup+0xa7/frame 0xfffffe008da1a240 nd6_lookup() at nd6_lookup+0x4e/frame 0xfffffe008da1a270 pfxlist_onlink_check() at pfxlist_onlink_check+0xfb/frame 0xfffffe008da1a310 nd6_ra_input() at nd6_ra_input+0x147f/frame 0xfffffe008da1a5d0 icmp6_input() at icmp6_input+0x685/frame 0xfffffe008da1a7b0 ip6_input() at ip6_input+0xa9a/frame 0xfffffe008da1a890 netisr_dispatch_src() at netisr_dispatch_src+0xca/frame 0xfffffe008da1a8e0 ether_demux() at ether_demux+0x138/frame 0xfffffe008da1a910 ether_nh_input() at ether_nh_input+0x34e/frame 0xfffffe008da1a970 netisr_dispatch_src() at netisr_dispatch_src+0xca/frame 0xfffffe008da1a9c0 ether_input() at ether_input+0x69/frame 0xfffffe008da1aa20 if_input() at if_input+0xa/frame 0xfffffe008da1aa30 bge_rxeof() at bge_rxeof+0x4dc/frame 0xfffffe008da1aab0 bge_intr_task() at bge_intr_task+0x1a7/frame 0xfffffe008da1ab00 taskqueue_run_locked() at taskqueue_run_locked+0x191/frame 0xfffffe008da1ab80 taskqueue_thread_loop() at taskqueue_thread_loop+0xc3/frame 0xfffffe008da1abb0 fork_exit() at fork_exit+0x8a/frame 0xfffffe008da1abf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe008da1abf0 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- Uptime: 1m18s Dumping 511 out of 7972 MB:..4%..13%..22%..32%..41%..51%..63%..72%..82%..91% ---<>--- Copyright (c) 1992-2021 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 14.0-CURRENT #85 komquats-n248853-efa24221b032: Sat Aug 21 20:41:37 PDT 2021 root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64 FreeBSD clang version 12.0.1 (git@github.com:llvm/llvm-project.git llvmorg-12.0.1-0-gfed41342a82f) VT(vga): text 80x25 module_register: cannot register tmpfs from kernel; already loaded from tmpfs.ko Module tmpfs failed to register: 17 CPU: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz (2294.83-MHz K8-class CPU) Origin="GenuineIntel" Id=0x206a7 Family=0x6 Model=0x2a Stepping=7 Features=0xbfebfbff Features2=0x1dbae3bf AMD Features=0x28100800 AMD Features2=0x1 XSAVE Features=0x1 VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID TSC: P-state invariant, performance statistics real memory = 8589934592 (8192 MB) avail memory = 8082354176 (7707 MB) Event timer "LAPIC" quality 600 ACPI APIC Table: FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 hardware threads random: unblocking device. ioapic0 irqs 0-23 Launching APs: 1 3 2 Timecounter "TSC-low" frequency 1147416650 Hz quality 1000 random: entropy device external interface kbd1 at kbdmux0 vtvga0: aesni0: No AES or SHA support. acpi0: acpi0: Power Button (fixed) cpu0: on acpi0 hpet0: iomem 0xfed00000-0xfed003ff on acpi0 Timecounter "HPET" frequency 14318180 Hz quality 950 Event timer "HPET" frequency 14318180 Hz quality 550 Event timer "HPET1" frequency 14318180 Hz quality 440 Event timer "HPET2" frequency 14318180 Hz quality 440 Event timer "HPET3" frequency 14318180 Hz quality 440 Event timer "HPET4" frequency 14318180 Hz quality 440 atrtc0: port 0x70-0x77 irq 8 on acpi0 atrtc0: Warning: Couldn't map I/O. atrtc0: registered as a time-of-day clock, resolution 1.000000s Event timer "RTC" frequency 32768 Hz quality 0 attimer0: port 0x40-0x43,0x50-0x53 irq 0 on acpi0 Timecounter "i8254" frequency 1193182 Hz quality 0 Event timer "i8254" frequency 1193182 Hz quality 100 Timecounter "ACPI-fast" frequency 3579545 Hz quality 900 acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0 acpi_ec0: port 0x62,0x66 on acpi0 pcib0: port 0xcf8-0xcff on acpi0 pci0: on pcib0 vgapci0: port 0x2000-0x203f mem 0xf0000000-0xf03fffff,0xe0000000-0xefffffff irq 16 at device 2.0 on pci0 vgapci0: Boot video device pci0: at device 22.0 (no driver attached) ehci0: mem 0xf060a000-0xf060a3ff irq 16 at device 26.0 on pci0 usbus0: EHCI version 1.0 usbus0 on ehci0 usbus0: 480Mbps High Speed USB v2.0 hdac0: mem 0xf0600000-0xf0603fff irq 22 at device 27.0 on pci0 pcib1: irq 16 at device 28.0 on pci0 pci1: on pcib1 pcib2: irq 17 at device 28.1 on pci0 pci2: on pcib2 iwn0: mem 0xf0500000-0xf0501fff irq 17 at device 0.0 on pci2 pcib3: irq 19 at device 28.3 on pci0 pci3: on pcib3 bge0: mem 0xf0400000-0xf040ffff,0xf0410000-0xf041ffff irq 19 at device 0.0 on pci3 bge0: CHIP ID 0x57785100; ASIC REV 0x57785; CHIP REV 0x577851; PCI-E miibus0: on bge0 brgphy0: PHY 1 on miibus0 brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto, auto-flow <6>bge0: Using defaults for TSO: 65518/35/2048 <6>bge0: Ethernet address: 20:6a:8a:72:03:17 sdhci_pci0: mem 0xf0420000-0xf042ffff irq 16 at device 0.1 on pci3 sdhci_pci0: 1 slot(s) allocated ehci1: mem 0xf0609000-0xf06093ff irq 23 at device 29.0 on pci0 usbus1: EHCI version 1.0 usbus1 on ehci1 usbus1: 480Mbps High Speed USB v2.0 isab0: at device 31.0 on pci0 isa0: on isab0 ahci0: port 0x2088-0x208f,0x2094-0x2097,0x2080-0x2087,0x2090-0x2093,0x2060-0x207f mem 0xf0608000-0xf06087ff irq 19 at device 31.2 on pci0 ahci0: AHCI v1.30 with 6 6Gbps ports, Port Multiplier not supported ahcich0: at channel 0 on ahci0 ahcich1: at channel 1 on ahci0 ahcich5: at channel 5 on ahci0 ahciem0: on ahci0 ichsmb0: port 0xefa0-0xefbf mem 0xf0604000-0xf06040ff irq 18 at device 31.3 on pci0 acpi_lid0: on acpi0 acpi_button0: on acpi0 acpi_tz0: on acpi0 acpi_tz1: on acpi0 atkbdc0: port 0x60,0x64 irq 1 on acpi0 atkbd0: irq 1 on atkbdc0 kbd0 at atkbd0 atkbd0: [GIANT-LOCKED] psm0: irq 12 on atkbdc0 psm0: [GIANT-LOCKED] WARNING: Device "psm" is Giant locked and may be deleted before FreeBSD 14.0. psm0: model Synaptics Touchpad, device ID 0 acpi_acad0: on acpi0 battery0: on acpi0 vga0: at port 0x3c0-0x3df iomem 0xa0000-0xbffff pnpid PNP0900 on isa0 ata0: at port 0x1f0-0x1f7,0x3f6 irq 14 on isa0 ata1: at port 0x170-0x177,0x376 irq 15 on isa0 acpi_perf0: on cpu0 acpi_throttle0: on cpu0 coretemp0: on cpu0 acpi_throttle1: failed to attach P_CNT device_attach: acpi_throttle1 attach returned 6 acpi_throttle2: failed to attach P_CNT device_attach: acpi_throttle2 attach returned 6 acpi_throttle3: failed to attach P_CNT device_attach: acpi_throttle3 attach returned 6 module_register_init: MOD_LOAD (tmpfs, 0xffffffff807a2760, 0xffffffff80c88540) error 17 Timecounters tick every 10.000 msec ZFS filesystem version: 5 ZFS storage pool version: features support (5000) IP Filter: v5.1.2 initialized. Default = pass all, Logging = enabled hdacc0: at cad 0 on hdac0 hdaa0: at nid 1 on hdacc0 pcm0: at nid 20,33 and 27 on hdaa0 pcm1: at nid 24 on hdaa0 hdacc1: at cad 3 on hdac0 hdaa1: at nid 1 on hdacc1 pcm2: at nid 5 on hdaa1 smbus0: on ichsmb0 smb0: on smbus0 sysctl_unregister_oid: failed(22) to unregister sysctl(tmpfs) ugen1.1: at usbus1 ugen0.1: at usbus0 uhub0 on usbus1 Trying to mount root from ufs:/dev/ufs/Sroot [rw]... Root mount waiting for: usbus0 usbus1 CAM uhub1 on usbus0 uhub1: on usbus0 uhub0: on usbus1 ses0 at ahciem0 bus 0 scbus3 target 0 lun 0 ses0: SEMB S-E-S 2.00 device ses0: SEMB SES Device ada0 at ahcich0 bus 0 scbus0 target 0 lun 0 ada0: ATA8-ACS SATA 3.x device ada0: Serial Number JR1000D33969RE ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ada0: Command Queueing enabled ada0: 953869MB (1953525168 512 byte sectors) ses0: pass0,ada0 in 'Slot 00', SATA Slot: scbus0 target 0 ses0: pass1,cd0 in 'Slot 01', SATA Slot: scbus1 target 0 cd0 at ahcich1 bus 0 scbus1 target 0 lun 0 cd0: Removable CD-ROM SCSI device cd0: Serial Number SBB5103801 cd0: 150.000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO 8192bytes) cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed uhub1: 2 ports with 2 removable, self powered uhub0: 2 ports with 2 removable, self powered Root mount waiting for: usbus0 usbus1 ugen0.2: at usbus0 uhub2 on uhub1 uhub2: on usbus0 ugen1.2: at usbus1 uhub3 on uhub0 uhub3: on usbus1 Root mount waiting for: usbus0 usbus1 uhub3: 6 ports with 6 removable, self powered uhub2: 6 ports with 6 removable, self powered ugen1.3: at usbus1 uhub4 on uhub3 uhub4: on usbus1 ugen0.3: at usbus0 uhub5 on uhub2 uhub5: on usbus0 Root mount waiting for: usbus0 usbus1 uhub4: 4 ports with 4 removable, self powered uhub5: 4 ports with 4 removable, self powered ugen1.4: at usbus1 ukbd0 on uhub4 ukbd0: on usbus1 kbd2 at ukbd0 ums0 on uhub4 ums0: on usbus1 ums0: 16 buttons and [XYZT] coordinates ID=2 ugen0.4: at usbus0 uhub6 on uhub5 uhub6: on usbus0 Root mount waiting for: usbus0 usbus1 ugen1.5: at usbus1 ukbd1 on uhub4 ukbd1: on usbus1 kbd3 at ukbd1 uhub6: 4 ports with 4 removable, self powered ugen0.5: at usbus0 umass0 on uhub6 umass0: on usbus0 umass0: SCSI over Bulk-Only; quirks = 0x4100 umass0:6:0: Attached to scbus6 Root mount waiting for: usbus0 CAM da0 at umass-sim0 bus 0 scbus6 target 0 lun 0 da0: Fixed Direct Access SCSI device da0: 40.000MB/s transfers da0: 76351MB (156368016 512 byte sectors) da0: quirks=0x2 ugen0.6: at usbus0 umass1 on uhub6 umass1: on usbus0 umass1: SCSI over Bulk-Only; quirks = 0x408c umass1:7:1: Attached to scbus7 da1 at umass-sim1 bus 1 scbus7 target 0 lun 0 da1: Fixed Direct Access SCSI device da1: 40.000MB/s transfers da1: 76319MB (156301488 512 byte sectors) da1: quirks=0x2 ugen0.7: at usbus0 umass2 on uhub5 umass2: on usbus0 umass2: SCSI over Bulk-Only; quirks = 0x4101 umass2:8:2: Attached to scbus8 da2 at umass-sim2 bus 2 scbus8 target 0 lun 0 da2: < Flash Disk 8.07> Removable Direct Access SCSI-2 device da2: Serial Number 029B4D84 da2: 40.000MB/s transfers da2: 246MB (504320 512 byte sectors) da2: quirks=0x2 Root mount waiting for: usbus0 ugen0.8: at usbus0 mountroot: waiting for device /dev/ufs/Sroot... WARNING: / was not properly dismounted WARNING: /: mount pending error: blocks 24 files 0 <118>Setting hostuuid: 34f5ed40-8938-11da-b265-efe316da850d. <118>Setting hostid: 0x7f5a03b9. <118>Starting file system checks: <118>** SU+J Recovering /dev/ufs/Sroot <118>** Reading 16777216 byte journal from inode 4. <118>** Building recovery table. <118>** Resolving unreferenced inode list. <118>** Processing journal entries. <118>** 7 journal records in 1536 bytes for 14.58% utilization <118>** Freed 1 inodes (0 dirs) 0 blocks, and 3 frags. <118> <118>***** FILE SYSTEM MARKED CLEAN ***** <118>** SU+J Recovering /dev/ufs/Svar <118>** Reading 16777216 byte journal from inode 4. <118>** Building recovery table. <118>** Resolving unreferenced inode list. <118>** Processing journal entries. <118>** SU+J Recovering /dev/ufs/Susr <118>** Reading 25165824 byte journal from inode 4. <118>** 40 journal records in 4096 bytes for 31.25% utilization <118>** Freed 0 inodes (0 dirs) 0 blocks, and 0 frags. <118> <118>***** FILE SYSTEM MARKED CLEAN ***** <118>** Building recovery table. <118>** Resolving unreferenced inode list. <118>** Processing journal entries. <118> <118>***** FILE SYSTEM MARKED CLEAN ***** <118>/dev/ada0s3a: 7535 files, 131352 used, 376431 free (1135 frags, 46912 blocks, 0.2% fragmentation) <118>/dev/ada0s3e: 24573 files, 319053 used, 442234 free (1082 frags, 55144 blocks, 0.1% fragmentation) <118>/dev/ada0s3d: 22537 files, 105401 used, 402382 free (270 frags, 50264 blocks, 0.1% fragmentation) <118>/dev/ada0s3f: 18331 files, 109447 used, 398336 free (576 frags, 49720 blocks, 0.1% fragmentation) <118>/dev/ada0s3h: 22924 files, 188609 used, 572677 free (685 frags, 71499 blocks, 0.1% fragmentation) <118>/dev/ada0s3g: 5348 files, 49444 used, 458339 free (275 frags, 57258 blocks, 0.1% fragmentation) <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk3p1 <118>** Reading 33554432 byte journal from inode 4. <118>** Building recovery table. <118>** Resolving unreferenced inode list. <118>** Processing journal entries. <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk0s1a <118>** Reading 16777216 byte journal from inode 827. <118> <118>***** FILE SYSTEM MARKED CLEAN ***** <118>** Building recovery table. <118>** Resolving unreferenced inode list. <118>** Processing journal entries. <118> <118>***** FILE SYSTEM MARKED CLEAN ***** <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk0s1d <118>** Reading 16777216 byte journal from inode 117. <118>** Building recovery table. <118>** Resolving unreferenced inode list. <118>** Processing journal entries. <118> <118>***** FILE SYSTEM MARKED CLEAN ***** <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk0s1e <118>** Reading 33554432 byte journal from inode 16. <118>** Building recovery table. <118>** Resolving unreferenced inode list. <118>** Processing journal entries. <118> <118>***** FILE SYSTEM MARKED CLEAN ***** <118>/dev/msdosfs/SHARED: 435 files, 6.2 GiB free (203709 clusters) <118>FIXED <118>/dev/msdosfs/SHARED: MARKING FILE SYSTEM CLEAN <118>/dev/zvol/tank/VMs/current/i386/disk0s1a: 114555 files, 255948 used, 251835 free (403 frags, 31429 blocks, 0.1% fragmentation) <118>/dev/zvol/tank/VMs/current/i386/disk0s1d: 22759 files, 126960 used, 380823 free (143 frags, 47585 blocks, 0.0% fragmentation) <118>/dev/zvol/tank/VMs/current/i386/disk0s1e: 28564 files, 549004 used, 973507 free (1603 frags, 121488 blocks, 0.1% fragmentation) <118>Mounting local filesystems:. <118>Mounting ZFS filesystems: (193/193) <118>Local package initialization:error: ed0: No such device exists (BIOCSETIF failed: Device not configured) <118>Unable to read the configuration file: No such file or directory at /usr/local/lib/perl5/site_perl/Jail.pm line 50. <118>Compilation failed in require at /usr/local/sbin/jailadmin line 13. <118>BEGIN failed--compilation aborted at /usr/local/sbin/jailadmin line 13. <118> Jails. <118>Autoloading module: acpi_wmi acpi_wmi0: on acpi0 acpi_wmi0: Embedded MOF found ACPI: \_SB.AMWA.WQEE: 1 arguments were passed to a non-method ACPI object (Buffer) (20210730/nsarguments-361) acpi_wmi1: on acpi0 acpi_wmi1: Embedded MOF found ACPI: \_SB.AMW0.WQDD: 1 arguments were passed to a non-method ACPI object (Buffer) (20210730/nsarguments-361) <118>Updating CPU Microcode... CPU: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz (2294.83-MHz K8-class CPU) Origin="GenuineIntel" Id=0x206a7 Family=0x6 Model=0x2a Stepping=7 Features=0xbfebfbff Features2=0x1dbae3bf AMD Features=0x28100800 AMD Features2=0x1 Structured Extended Features3=0x9c000400 XSAVE Features=0x1 VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID TSC: P-state invariant, performance statistics <118>Done. <118>ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg /usr/local/krb5/lib /usr/local/kde4/lib /usr/local/dt/lib /usr/local/lib/compat/pkg /usr/local/lib/dovecot /usr/local/lib/e2fsprogs /usr/local/lib/expect5.45.4 /usr/local/lib/freeradius-3.0.23 /usr/local/lib/gcc10 /usr/local/lib/gcc11 /usr/local/lib/gcc12 /usr/local/lib/gcc8 /usr/local/lib/gcc9 /usr/local/lib/graphviz /usr/local/lib/httrack /usr/local/lib/itcl3.4 /usr/local/lib/mysql /usr/local/lib/mysql/plugin /usr/local/lib/opencollada /usr/local/lib/perl5/5.30/mach/CORE /usr/local/lib/perl5/5.32/mach/CORE /usr/local/lib/perl5/5.34/mach/CORE /usr/local/lib/pidgin /usr/local/lib/pth /usr/local/lib/qt5 /usr/local/lib/samba4 /usr/local/lib/xrdp /usr/local/libexec/openldap /usr/local/llvm-devel/lib /usr/local/llvm10/lib /usr/local/llvm11/lib /usr/local/llvm12/lib /usr/local/llvm70/lib /usr/local/llvm80/lib /usr/local/llvm90/lib /usr/local/share/chromium <118>32-bit compatibility ldconfig path: /usr/lib32 /alt/i386/root/usr/local/lib <118>Setting hostname: slippy. <118>Setting up harvesting: [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER ],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED <118>Feeding entropy: . <118>Starting ippool. <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already present in pool <118>Additional TCP/IP options: rfc1323 extensions=NO. <118>Enabling ipfilter. <118>Installing NAT rules. <118>0 entries flushed from NAT table <118>0 entries flushed from NAT list <118>Starting ipmon. <6>wlan0: Ethernet address: 20:6a:8a:72:03:17 <118>Created wlan(4) interfaces: wlan0. <6>bridge0: Ethernet address: 58:9c:fc:10:ff:c8 <118>Created clone interfaces: lagg0 bridge0. <6>lo0: link state changed to UP <6>bge0: link state changed to DOWN iwn0: iwn_read_firmware: ucode rev=0x12a80601 <118>Starting wpa_supplicant. <6>lagg0: link state changed to DOWN <6>lagg0: IPv6 addresses on wlan0 have been removed before adding it as a member to prevent IPv6 address scope violation. iwn0: iwn_read_firmware: ucode rev=0x12a80601 <6>wlan0: link state changed to UP <6>lagg0: link state changed to UP <6>bge0: link state changed to UP Fatal trap 12: page fault while in kernel mode cpuid = 0; apic id = 00 fault virtual address = 0x128 fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff806cb53d stack pointer = 0x28:0xfffffe00831a3210 frame pointer = 0x28:0xfffffe00831a3210 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 0 (bge0 taskq) trap number = 12 panic: page fault cpuid = 0 time = 1629610531 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00831a2eb0 vpanic() at vpanic+0x187/frame 0xfffffe00831a2f10 panic() at panic+0x43/frame 0xfffffe00831a2f70 trap_fatal() at trap_fatal+0x387/frame 0xfffffe00831a2fd0 trap_pfault() at trap_pfault+0x4f/frame 0xfffffe00831a3030 trap() at trap+0x26a/frame 0xfffffe00831a3140 calltrap() at calltrap+0x8/frame 0xfffffe00831a3140 --- trap 0xc, rip = 0xffffffff806cb53d, rsp = 0xfffffe00831a3210, rbp = 0xfffffe00831a3210 --- __rw_rlock_int() at __rw_rlock_int+0xd/frame 0xfffffe00831a3210 in6_lltable_lookup() at in6_lltable_lookup+0xa7/frame 0xfffffe00831a3240 nd6_lookup() at nd6_lookup+0x4e/frame 0xfffffe00831a3270 pfxlist_onlink_check() at pfxlist_onlink_check+0xfb/frame 0xfffffe00831a3310 nd6_ra_input() at nd6_ra_input+0x147f/frame 0xfffffe00831a35d0 icmp6_input() at icmp6_input+0x685/frame 0xfffffe00831a37b0 ip6_input() at ip6_input+0xa9a/frame 0xfffffe00831a3890 netisr_dispatch_src() at netisr_dispatch_src+0xca/frame 0xfffffe00831a38e0 ether_demux() at ether_demux+0x138/frame 0xfffffe00831a3910 ether_nh_input() at ether_nh_input+0x34e/frame 0xfffffe00831a3970 netisr_dispatch_src() at netisr_dispatch_src+0xca/frame 0xfffffe00831a39c0 ether_input() at ether_input+0x69/frame 0xfffffe00831a3a20 if_input() at if_input+0xa/frame 0xfffffe00831a3a30 bge_rxeof() at bge_rxeof+0x4dc/frame 0xfffffe00831a3ab0 bge_intr_task() at bge_intr_task+0x1a7/frame 0xfffffe00831a3b00 taskqueue_run_locked() at taskqueue_run_locked+0x191/frame 0xfffffe00831a3b80 taskqueue_thread_loop() at taskqueue_thread_loop+0xc3/frame 0xfffffe00831a3bb0 fork_exit() at fork_exit+0x8a/frame 0xfffffe00831a3bf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00831a3bf0 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- Uptime: 1m28s Dumping 512 out of 7972 MB:..4%..13%..22%..32%..41%..54%..63%..72%..82%..91% __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 55 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu, (kgdb) bt #0 __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 #1 doadump (textdump=textdump@entry=1) at /opt/src/git-src/sys/kern/kern_sh utdown.c:399 #2 0xffffffff806cf9ab in kern_reboot (howto=260) at /opt/src/git-src/sys/kern/kern_shutdown.c:486 #3 0xffffffff806cfe26 in vpanic (fmt=0xffffffff80a94e2f "%s", ap=) at /opt/src/git-src/sys/kern/kern_shutdown.c:919 #4 0xffffffff806cfc23 in panic (fmt=) at /opt/src/git-src/sys/kern/kern_shutdown.c:843 #5 0xffffffff80a342c7 in trap_fatal (frame=0xfffffe00831a3150, eva=296) at /opt/src/git-src/sys/amd64/amd64/trap.c:946 #6 0xffffffff80a3431f in trap_pfault (frame=frame@entry=0xfffffe00831a3150, usermode=false, signo=, signo@entry=0x0, ucode=, ucode@entry=0x0) at /opt/src/git-src/sys/amd64/amd64/trap.c:765 #7 0xffffffff80a3399a in trap (frame=0xfffffe00831a3150) at /opt/src/git-src/sys/amd64/amd64/trap.c:443 #8 #9 __rw_rlock_int (rw=0x110) at /opt/src/git-src/sys/kern/kern_rwlock.c:679 #10 0xffffffff8087cd07 in in6_lltable_lookup (llt=, flags=, l3addr=) at /opt/src/git-src/sys/netin et6/in6.c:2349 #11 0xffffffff80897dae in lla_lookup (llt=0x110, flags=2374593664, flags@entry=0, l3addr=0xfffffe00831a3250) at /opt/src/git-src/sys/net/if_lla tbl.h:261 #12 nd6_lookup (addr6=, flags=-1920373632, flags@entry=0, ifp=) at /opt/src/git-src/sys/netinet6/nd6.c:1204 #13 0xffffffff8089ff7b in find_pfxlist_reachable_router (pr=0xfffff8002b64f100) at /opt/src/git-src/sys/netinet6/nd6_rtr.c:1817 #14 pfxlist_onlink_check () at /opt/src/git-src/sys/netinet6/nd6_rtr.c:1861 #15 0xffffffff8089fc5f in nd6_ra_input (m=, m@entry=0xfffff8003a3e1d00, off=, icmp6len=, icmp6len@entry=48) at /opt/src/git-src/sys/netinet6/nd6_rtr.c:597 #16 0xffffffff80874aa5 in icmp6_input (mp=0xfffffe00831a37f8, offp=0xfffffe00831a37f0, proto=) at /opt/src/git-src/sys/netinet6/icmp6.c:780 #17 0xffffffff8088beca in ip6_input (m=0xfffff8003a3e1d00) at /opt/src/git-src/sys/netinet6/ip6_input.c:929 #18 0xffffffff80806d6a in netisr_dispatch_src (proto=6, source=, source@entry=0, m=0x0) at /opt/src/git-src/sys/net/netisr.c:1143 #19 0xffffffff8080704f in netisr_dispatch (proto=272, m=0x10) at /opt/src/git-src/sys/net/netisr.c:1234 #20 0xffffffff807f3d58 in ether_demux (ifp=ifp@entry=0xfffff8003a30e800, m=0xfffffe008d896c80) at /opt/src/git-src/sys/net/if_ethersubr.c:925 #21 0xffffffff807f50fe in ether_input_internal (ifp=0xfffff8003a30e800, m=0xfffffe008d896c80) at /opt/src/git-src/sys/net/if_ethersubr.c:711 #22 ether_nh_input (m=) at /opt/src/git-src/sys/net/if_ethers ubr.c:741 #23 0xffffffff80806d6a in netisr_dispatch_src (proto=proto@entry=5, source=, source@entry=0, m=0x0, m@entry=0xfffff8003a3e1d00) at /opt/src/git-src/sys/net/netisr.c:1143 #24 0xffffffff8080704f in netisr_dispatch (proto=272, proto@entry=5, m=0x10, m@entry=0xfffff8003a3e1d00) at /opt/src/git-src/sys/net/netisr.c:123 4 #25 0xffffffff807f41a9 in ether_input (ifp=, m=0xfffff8003a3e1d00) at /opt/src/git-src/sys/net/if_ethersubr.c:832 #26 0xffffffff807f042a in if_input (ifp=0x110, ifp@entry=0xfffff8000516b800, sendmp=0xfffffe008d896c80, sendmp@entry=0xfffff8003a3e1d00) at /opt/src/git-src/sys/net/if.c:4444 #27 0xffffffff818eaabc in bge_rxeof (sc=, sc@entry=0xfffffe00107d0000, rx_prod=rx_prod@entry=2, holdlck=holdlck@entry=0) at /opt/src/git-src/sys/dev/bge/if_bge.c:4436 #28 0xffffffff818e7d57 in bge_intr_task (arg=0xfffffe00107d0000, pending=) at /opt/src/git-src/sys/dev/bge/if_bge.c:4666 #29 0xffffffff80731d81 in taskqueue_run_locked (queue=queue@entry=0xfffff800 03890600) at /opt/src/git-src/sys/kern/subr_taskqueue.c:476 #30 0xffffffff80733073 in taskqueue_thread_loop (arg=, arg@entry=0xfffffe00107d7568) at /opt/src/git-src/sys/kern/subr_taskqueue.c: 793 #31 0xffffffff8068b80a in fork_exit (callout=0xffffffff80732fb0 , arg=0xfffffe00107d7568, frame=0xfffffe00831a3c00) at /opt/src/git-src/sys/kern/kern_fork.c:1087 #32 (kgdb) frame 9 #9 __rw_rlock_int (rw=0x110) at /opt/src/git-src/sys/kern/kern_rwlock.c:679 679 v = RW_READ_VALUE(rw); (kgdb) l 674 KASSERT(rw_wowner(rw) != td, 675 ("rw_rlock: wlock already held for %s @ %s:%d", 676 rw->lock_object.lo_name, file, line)); 677 WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); 678 679 v = RW_READ_VALUE(rw); 680 if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || 681 !__rw_rlock_try(rw, td, &v, true LOCK_FILE_LINE_ARG))) 682 __rw_rlock_hard(rw, td, v LOCK_FILE_LINE_ARG); 683 else (kgdb) p rw $1 = (struct rwlock *) 0x110 (kgdb) frame 10 #10 0xffffffff8087cd07 in in6_lltable_lookup (llt=, flags=, l3addr=) at /opt/src/git-src/sys/netin et6/in6.c:2349 2349 LLE_RLOCK(lle); (kgdb) l 2344 return (lle); 2345 2346 if (flags & LLE_EXCLUSIVE) 2347 LLE_WLOCK(lle); 2348 else 2349 LLE_RLOCK(lle); 2350 2351 /* 2352 * If the afdata lock is not held, the LLE may have been unlinked while 2353 * we were blocked on the LLE lock. Check for this case. (kgdb) p lle $2 = (struct llentry *) 0x0 (kgdb) -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-main@freebsd.org Sun Aug 22 06:01:24 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B1BCF67EF07; Sun, 22 Aug 2021 06:01:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gsl9w4jCfz4vF3; Sun, 22 Aug 2021 06:01:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89C621B9EB; Sun, 22 Aug 2021 06:01:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17M61OGt085777; Sun, 22 Aug 2021 06:01:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17M61OW4085776; Sun, 22 Aug 2021 06:01:24 GMT (envelope-from git) Date: Sun, 22 Aug 2021 06:01:24 GMT Message-Id: <202108220601.17M61OW4085776@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 47f880ebeb30 - main - ext2fs(5): Correct a typo in an error message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 47f880ebeb3092b1b7bbc6d75e82532e43bbf010 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 06:01:24 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=47f880ebeb3092b1b7bbc6d75e82532e43bbf010 commit 47f880ebeb3092b1b7bbc6d75e82532e43bbf010 Author: Gordon Bergling AuthorDate: 2021-08-22 05:58:22 +0000 Commit: Gordon Bergling CommitDate: 2021-08-22 05:58:22 +0000 ext2fs(5): Correct a typo in an error message - s/talbes/tables/ MFC after: 1 week --- sys/fs/ext2fs/ext2_vfsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index d15fed3d2913..b39d04649d17 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -434,7 +434,7 @@ ext2_cg_validate(struct m_ext2fs *fs) } if (i_tables <= last_cg_block) { SDT_PROBE2(ext2fs, , vfsops, ext2_cg_validate_error, - "inode talbes overlaps gds", i); + "inode tables overlaps gds", i); return (EINVAL); } if (i_tables < first_block || From owner-dev-commits-src-main@freebsd.org Sun Aug 22 06:17:41 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E13F667ECD2; Sun, 22 Aug 2021 06:17:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GslXj5lZHz3G4H; Sun, 22 Aug 2021 06:17:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADB7E1BC41; Sun, 22 Aug 2021 06:17:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17M6HfH2000177; Sun, 22 Aug 2021 06:17:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17M6HfPH000176; Sun, 22 Aug 2021 06:17:41 GMT (envelope-from git) Date: Sun, 22 Aug 2021 06:17:41 GMT Message-Id: <202108220617.17M6HfPH000176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 0d55bc8eb2ab - main - rpc(3): Correct a few common typos in source code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d55bc8eb2ab9508c43e135616ca887ed719ea9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 06:17:41 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0d55bc8eb2ab9508c43e135616ca887ed719ea9a commit 0d55bc8eb2ab9508c43e135616ca887ed719ea9a Author: Gordon Bergling AuthorDate: 2021-08-22 06:16:09 +0000 Commit: Gordon Bergling CommitDate: 2021-08-22 06:16:09 +0000 rpc(3): Correct a few common typos in source code comments - s/therfore/therefor/ - s/activte/active/ Obtained from: NetBSD MFC after: 3 days --- lib/libc/rpc/clnt_dg.c | 4 ++-- lib/libc/rpc/clnt_vc.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/rpc/clnt_dg.c b/lib/libc/rpc/clnt_dg.c index a1cd7502e2ad..26bf34633623 100644 --- a/lib/libc/rpc/clnt_dg.c +++ b/lib/libc/rpc/clnt_dg.c @@ -92,9 +92,9 @@ static void clnt_dg_destroy(CLIENT *); * This machinery implements per-fd locks for MT-safety. It is not * sufficient to do per-CLIENT handle locks for MT-safety because a * user may create more than one CLIENT handle with the same fd behind - * it. Therfore, we allocate an array of flags (dg_fd_locks), protected + * it. Therefore, we allocate an array of flags (dg_fd_locks), protected * by the clnt_fd_lock mutex, and an array (dg_cv) of condition variables - * similarly protected. Dg_fd_lock[fd] == 1 => a call is activte on some + * similarly protected. Dg_fd_lock[fd] == 1 => a call is active on some * CLIENT handle created for that fd. * The current implementation holds locks across the entire RPC and reply, * including retransmissions. Yes, this is silly, and as soon as this diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c index dec1791dcc95..ebd4e303916f 100644 --- a/lib/libc/rpc/clnt_vc.c +++ b/lib/libc/rpc/clnt_vc.c @@ -123,9 +123,9 @@ struct ct_data { * This machinery implements per-fd locks for MT-safety. It is not * sufficient to do per-CLIENT handle locks for MT-safety because a * user may create more than one CLIENT handle with the same fd behind - * it. Therfore, we allocate an array of flags (vc_fd_locks), protected + * it. Therefore, we allocate an array of flags (vc_fd_locks), protected * by the clnt_fd_lock mutex, and an array (vc_cv) of condition variables - * similarly protected. Vc_fd_lock[fd] == 1 => a call is activte on some + * similarly protected. Vc_fd_lock[fd] == 1 => a call is active on some * CLIENT handle created for that fd. * The current implementation holds locks across the entire RPC and reply. * Yes, this is silly, and as soon as this code is proven to work, this From owner-dev-commits-src-main@freebsd.org Sun Aug 22 08:49:26 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C0BDE650EAE; Sun, 22 Aug 2021 08:49:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gspvp4TTHz4fgR; Sun, 22 Aug 2021 08:49:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76D851DDC3; Sun, 22 Aug 2021 08:49:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17M8nQOi000105; Sun, 22 Aug 2021 08:49:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17M8nQGH000104; Sun, 22 Aug 2021 08:49:26 GMT (envelope-from git) Date: Sun, 22 Aug 2021 08:49:26 GMT Message-Id: <202108220849.17M8nQGH000104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: f8c1b1a92966 - main - lltable: fix crash introduced in c541bd368f86. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8c1b1a9296696f70ac209612a00ae0722d07ed9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 08:49:26 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f8c1b1a9296696f70ac209612a00ae0722d07ed9 commit f8c1b1a9296696f70ac209612a00ae0722d07ed9 Author: Alexander V. Chernikov AuthorDate: 2021-08-22 08:47:49 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-22 08:49:18 +0000 lltable: fix crash introduced in c541bd368f86. Reported by: cy MFC after: 2 weeks --- sys/netinet6/in6.c | 7 ++++--- sys/netinet6/nd6_rtr.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 142a05ded2b6..d54aba58edb6 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2323,6 +2323,7 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) { const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)l3addr; + int family = flags >> 16; struct llentry *lle; IF_AFDATA_LOCK_ASSERT(llt->llt_ifp); @@ -2333,13 +2334,13 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, ("wrong lle request flags: %#x", flags)); lle = in6_lltable_find_dst(llt, &sin6->sin6_addr); - if (lle == NULL) - return (NULL); - int family = flags >> 16; if (__predict_false(family != AF_INET6)) lle = llentry_lookup_family(lle, family); + if (lle == NULL) + return (NULL); + if (flags & LLE_UNLOCKED) return (lle); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 2960b6cad951..cec9fccd63c4 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -972,7 +972,7 @@ defrouter_select_fib(int fibnum) 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)) && + (ln = nd6_lookup(&dr->rtaddr, LLE_SF(AF_INET6, 0), dr->ifp)) && ND6_IS_LLINFO_PROBREACH(ln)) { selected_dr = dr; defrouter_ref(selected_dr); @@ -1814,7 +1814,8 @@ find_pfxlist_reachable_router(struct nd_prefix *pr) NET_EPOCH_ENTER(et); LIST_FOREACH(pfxrtr, &pr->ndpr_advrtrs, pfr_entry) { - ln = nd6_lookup(&pfxrtr->router->rtaddr, 0, pfxrtr->router->ifp); + ln = nd6_lookup(&pfxrtr->router->rtaddr, LLE_SF(AF_INET6, 0), + pfxrtr->router->ifp); if (ln == NULL) continue; canreach = ND6_IS_LLINFO_PROBREACH(ln); From owner-dev-commits-src-main@freebsd.org Sun Aug 22 08:50:59 2021 Return-Path: Delivered-To: dev-commits-src-main@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 3750B651185; Sun, 22 Aug 2021 08:50:59 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:100]) (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 4GspxX3Wh6z4gbJ; Sun, 22 Aug 2021 08:50:55 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from iva3-22c7ad945a2f.qloud-c.yandex.net (iva3-22c7ad945a2f.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:4918:0:640:22c7:ad94]) by forward100p.mail.yandex.net (Yandex) with ESMTP id F200059822C4; Sun, 22 Aug 2021 11:50:44 +0300 (MSK) Received: from iva7-f62245f79210.qloud-c.yandex.net (iva7-f62245f79210.qloud-c.yandex.net [2a02:6b8:c0c:2e83:0:640:f622:45f7]) by iva3-22c7ad945a2f.qloud-c.yandex.net (mxback/Yandex) with ESMTP id orPLkDuuds-oiIaMvE7; Sun, 22 Aug 2021 11:50:44 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1629622244; bh=qX2aw3UHHKbHX744AHHdG/xTJnP7WYC5qqhPpD6ZAhA=; h=To:In-Reply-To:References:Date:Subject:Cc:Message-Id:From; b=YdRzU95igCsoOj5THexRLMTFjzBbop83VhyZfkRBnfR3KXRqJMBoO07TackGE6Lnt TqbDB8J4yyqVnoueogxgSxk22YRiBGCiFIuByJeNWohtdiMqmG3kLRK+7iHa0iO7fb SJTfRZDlzbw4eLMNmxVgwJZ+VC+7/4CcSbsDqCe4= Received: by iva7-f62245f79210.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id dcacoXlRL7-og08gfn4; Sun, 22 Aug 2021 11:50:43 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) From: "Alexander V. Chernikov" Message-Id: Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: c541bd368f86 - main - lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries. Date: Sun, 22 Aug 2021 09:50:41 +0100 In-Reply-To: <202108220558.17M5wAuq003114@slippy.cwsent.com> Cc: "Alexander V. Chernikov" , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Cy Schubert References: <202108211735.17LHZ0WI081502@gitrepo.freebsd.org> <202108220558.17M5wAuq003114@slippy.cwsent.com> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4GspxX3Wh6z4gbJ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ipfw.ru header.s=mail header.b=YdRzU95i; dmarc=none; spf=pass (mx1.freebsd.org: domain of melifaro@ipfw.ru designates 2a02:6b8:0:1472:2741:0:8b7:100 as permitted sender) smtp.mailfrom=melifaro@ipfw.ru X-Spamd-Result: default: False [-3.10 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[ipfw.ru:s=mail]; FREEFALL_USER(0.00)[melifaro]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2a02:6b8:0:1000::/52]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[ipfw.ru]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[ipfw.ru:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13238, ipnet:2a02:6b8::/32, country:RU]; MID_RHS_MATCH_FROM(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_IN_DNSWL_LOW(-0.10)[2a02:6b8:0:1472:2741:0:8b7:100:from] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 08:50:59 -0000 > On 22 Aug 2021, at 06:58, Cy Schubert = wrote: >=20 > In message <202108211735.17LHZ0WI081502@gitrepo.freebsd.org = >, "Alexander V.=20= > Che > rnikov" writes: >> The branch main has been updated by melifaro: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dc541bd368f863bbf5c08dd5c1ecce016= >> 6ad47389 >>=20 >> commit c541bd368f863bbf5c08dd5c1ecce0166ad47389 >> Author: Alexander V. Chernikov >> AuthorDate: 2021-08-21 14:13:32 +0000 >> Commit: Alexander V. Chernikov >> CommitDate: 2021-08-21 17:34:35 +0000 >>=20 >> lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 = entries >> . >>=20 >> Currently we use pre-calculated headers inside LLE entries as = prepend dat >> a >> for `if_output` functions. Using these headers allows saving some >> CPU cycles/memory accesses on the fast path. >>=20 >> However, this approach makes adding L2 header for IPv4 traffic = with IPv6 >> nexthops more complex, as it is not possible to store multiple >> pre-calculated headers inside lle. Additionally, the solution = space is >> limited by the fact that PCB caching saves LLEs in addition to = the nexth >> op. >>=20 >> Thus, add support for creating special "child" LLEs for the = purpose of ho >> lding >> custom family encaps and store mbufs pending resolution. To = simplify han >> dling >> of those LLEs, store them in a linked-list inside a "parent" = (e.g. norma >> l) LLE. >> Such LLEs are not visible when iterating LLE table. Their = lifecycle is b >> ound >> to the "parent" LLE - it is not possible to delete "child" when = parent i >> s alive. >> Furthermore, "child" LLEs are static (RTF_STATIC), avoding = complex state >> machine used by the standard LLEs. >>=20 >> nd6_lookup() and nd6_resolve() now accepts an additional argument, = family >> , >> allowing to return such child LLEs. This change uses `LLE_SF()` = macro wh >> ich >> packs family and flags in a single int field. This is done to = simplify m >> erging >> back to stable/. Once this code lands, most of the cases will be = convert >> ed to >> use a dedicated `family` parameter. >>=20 >> Differential Revision: https://reviews.freebsd.org/D31379 >> MFC after: 2 weeks >> --- >> sys/net/if_ethersubr.c | 4 +- >> sys/net/if_fwsubr.c | 4 +- >> sys/net/if_infiniband.c | 3 +- >> sys/net/if_llatbl.c | 70 +++++++++++- >> sys/net/if_llatbl.h | 12 +- >> sys/netinet/toecore.c | 2 +- >> sys/netinet6/icmp6.c | 2 +- >> sys/netinet6/in6.c | 5 + >> sys/netinet6/nd6.c | 176 = +++++++++++++++++++++++---- >> -- >> sys/netinet6/nd6.h | 1 + >> sys/netinet6/nd6_nbr.c | 6 +- >> sys/ofed/drivers/infiniband/core/ib_addr.c | 5 +- >> 12 files changed, 241 insertions(+), 49 deletions(-) >=20 > This commit causes two of my machines a bit of gas. Sorry for the breakage, should be fixed by = f8c1b1a9296696f70ac209612a00ae0722d07ed9. >=20 > Fatal trap 12: page fault while in kernel mode > cpuid =3D 0; apic id =3D 00 > fault virtual address =3D 0x128 > fault code =3D supervisor read data, page not present > instruction pointer =3D 0x20:0xffffffff806cb53d > stack pointer =3D 0x28:0xfffffe008da1a210 > frame pointer =3D 0x28:0xfffffe008da1a210 > code segment =3D base 0x0, limit 0xfffff, type 0x1b > =3D DPL 0, pres 1, long 1, def32 0, gran 1 > processor eflags =3D interrupt enabled, resume, IOPL =3D 0 > current process =3D 0 (bge0 taskq) > trap number =3D 12 > panic: page fault > cpuid =3D 0 > time =3D 1629610416 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame=20 > 0xfffffe008da19eb0 > vpanic() at vpanic+0x187/frame 0xfffffe008da19f10 > panic() at panic+0x43/frame 0xfffffe008da19f70 > trap_fatal() at trap_fatal+0x387/frame 0xfffffe008da19fd0 > trap_pfault() at trap_pfault+0x4f/frame 0xfffffe008da1a030 > trap() at trap+0x26a/frame 0xfffffe008da1a140 > calltrap() at calltrap+0x8/frame 0xfffffe008da1a140 > --- trap 0xc, rip =3D 0xffffffff806cb53d, rsp =3D 0xfffffe008da1a210, = rbp =3D=20 > 0xfffffe008da1a210 --- > __rw_rlock_int() at __rw_rlock_int+0xd/frame 0xfffffe008da1a210 > in6_lltable_lookup() at in6_lltable_lookup+0xa7/frame = 0xfffffe008da1a240 > nd6_lookup() at nd6_lookup+0x4e/frame 0xfffffe008da1a270 > pfxlist_onlink_check() at pfxlist_onlink_check+0xfb/frame = 0xfffffe008da1a310 > nd6_ra_input() at nd6_ra_input+0x147f/frame 0xfffffe008da1a5d0 > icmp6_input() at icmp6_input+0x685/frame 0xfffffe008da1a7b0 > ip6_input() at ip6_input+0xa9a/frame 0xfffffe008da1a890 > netisr_dispatch_src() at netisr_dispatch_src+0xca/frame = 0xfffffe008da1a8e0 > ether_demux() at ether_demux+0x138/frame 0xfffffe008da1a910 > ether_nh_input() at ether_nh_input+0x34e/frame 0xfffffe008da1a970 > netisr_dispatch_src() at netisr_dispatch_src+0xca/frame = 0xfffffe008da1a9c0 > ether_input() at ether_input+0x69/frame 0xfffffe008da1aa20 > if_input() at if_input+0xa/frame 0xfffffe008da1aa30 > bge_rxeof() at bge_rxeof+0x4dc/frame 0xfffffe008da1aab0 > bge_intr_task() at bge_intr_task+0x1a7/frame 0xfffffe008da1ab00 > taskqueue_run_locked() at taskqueue_run_locked+0x191/frame=20 > 0xfffffe008da1ab80 > taskqueue_thread_loop() at taskqueue_thread_loop+0xc3/frame=20 > 0xfffffe008da1abb0 > fork_exit() at fork_exit+0x8a/frame 0xfffffe008da1abf0 > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe008da1abf0 > --- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- > Uptime: 1m18s > Dumping 511 out of 7972 = MB:..4%..13%..22%..32%..41%..51%..63%..72%..82%..91% > ---<>--- > Copyright (c) 1992-2021 The FreeBSD Project. > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, = 1994 > The Regents of the University of California. All rights = reserved. > FreeBSD is a registered trademark of The FreeBSD Foundation. > FreeBSD 14.0-CURRENT #85 komquats-n248853-efa24221b032: Sat Aug 21 = 20:41:37=20 > PDT 2021 > root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64 > FreeBSD clang version 12.0.1 (git@github.com = :llvm/llvm-project.git=20 > llvmorg-12.0.1-0-gfed41342a82f) > VT(vga): text 80x25 > module_register: cannot register tmpfs from kernel; already loaded = from=20 > tmpfs.ko > Module tmpfs failed to register: 17 > CPU: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz (2294.83-MHz K8-class = CPU) > Origin=3D"GenuineIntel" Id=3D0x206a7 Family=3D0x6 Model=3D0x2a = Stepping=3D7 > = Features=3D0xbfebfbff CA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> > = Features2=3D0x1dbae3bf = 16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,XSAVE,OSXSAVE,AVX> > AMD Features=3D0x28100800 > AMD Features2=3D0x1 > XSAVE Features=3D0x1 > VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID > TSC: P-state invariant, performance statistics > real memory =3D 8589934592 (8192 MB) > avail memory =3D 8082354176 (7707 MB) > Event timer "LAPIC" quality 600 > ACPI APIC Table: > FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs > FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 hardware threads > random: unblocking device. > ioapic0 irqs 0-23 > Launching APs: 1 3 2 > Timecounter "TSC-low" frequency 1147416650 Hz quality 1000 > random: entropy device external interface > kbd1 at kbdmux0 > vtvga0: > aesni0: No AES or SHA support. > acpi0: > acpi0: Power Button (fixed) > cpu0: on acpi0 > hpet0: iomem 0xfed00000-0xfed003ff on = acpi0 > Timecounter "HPET" frequency 14318180 Hz quality 950 > Event timer "HPET" frequency 14318180 Hz quality 550 > Event timer "HPET1" frequency 14318180 Hz quality 440 > Event timer "HPET2" frequency 14318180 Hz quality 440 > Event timer "HPET3" frequency 14318180 Hz quality 440 > Event timer "HPET4" frequency 14318180 Hz quality 440 > atrtc0: port 0x70-0x77 irq 8 on acpi0 > atrtc0: Warning: Couldn't map I/O. > atrtc0: registered as a time-of-day clock, resolution 1.000000s > Event timer "RTC" frequency 32768 Hz quality 0 > attimer0: port 0x40-0x43,0x50-0x53 irq 0 on acpi0 > Timecounter "i8254" frequency 1193182 Hz quality 0 > Event timer "i8254" frequency 1193182 Hz quality 100 > Timecounter "ACPI-fast" frequency 3579545 Hz quality 900 > acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0 > acpi_ec0: port 0x62,0x66 on acpi0 > pcib0: port 0xcf8-0xcff on acpi0 > pci0: on pcib0 > vgapci0: port 0x2000-0x203f mem=20 > 0xf0000000-0xf03fffff,0xe0000000-0xefffffff irq 16 at device 2.0 on = pci0 > vgapci0: Boot video device > pci0: at device 22.0 (no driver attached) > ehci0: mem = 0xf060a000-0xf060a3ff=20 > irq 16 at device 26.0 on pci0 > usbus0: EHCI version 1.0 > usbus0 on ehci0 > usbus0: 480Mbps High Speed USB v2.0 > hdac0: mem 0xf0600000-0xf0603fff = irq 22=20 > at device 27.0 on pci0 > pcib1: irq 16 at device 28.0 on pci0 > pci1: on pcib1 > pcib2: irq 17 at device 28.1 on pci0 > pci2: on pcib2 > iwn0: mem 0xf0500000-0xf0501fff irq = 17 at=20 > device 0.0 on pci2 > pcib3: irq 19 at device 28.3 on pci0 > pci3: on pcib3 > bge0: mem=20 > 0xf0400000-0xf040ffff,0xf0410000-0xf041ffff irq 19 at device 0.0 on = pci3 > bge0: CHIP ID 0x57785100; ASIC REV 0x57785; CHIP REV 0x577851; PCI-E > miibus0: on bge0 > brgphy0: PHY 1 on miibus0 > brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT,=20= > 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto, auto-flow > <6>bge0: Using defaults for TSO: 65518/35/2048 > <6>bge0: Ethernet address: 20:6a:8a:72:03:17 > sdhci_pci0: mem=20 > 0xf0420000-0xf042ffff irq 16 at device 0.1 on pci3 > sdhci_pci0: 1 slot(s) allocated > ehci1: mem = 0xf0609000-0xf06093ff=20 > irq 23 at device 29.0 on pci0 > usbus1: EHCI version 1.0 > usbus1 on ehci1 > usbus1: 480Mbps High Speed USB v2.0 > isab0: at device 31.0 on pci0 > isa0: on isab0 > ahci0: port=20 > 0x2088-0x208f,0x2094-0x2097,0x2080-0x2087,0x2090-0x2093,0x2060-0x207f = mem=20 > 0xf0608000-0xf06087ff irq 19 at device 31.2 on pci0 > ahci0: AHCI v1.30 with 6 6Gbps ports, Port Multiplier not supported > ahcich0: at channel 0 on ahci0 > ahcich1: at channel 1 on ahci0 > ahcich5: at channel 5 on ahci0 > ahciem0: on ahci0 > ichsmb0: port 0xefa0-0xefbf mem=20= > 0xf0604000-0xf06040ff irq 18 at device 31.3 on pci0 > acpi_lid0: on acpi0 > acpi_button0: on acpi0 > acpi_tz0: on acpi0 > acpi_tz1: on acpi0 > atkbdc0: port 0x60,0x64 irq 1 on acpi0 > atkbd0: irq 1 on atkbdc0 > kbd0 at atkbd0 > atkbd0: [GIANT-LOCKED] > psm0: irq 12 on atkbdc0 > psm0: [GIANT-LOCKED] > WARNING: Device "psm" is Giant locked and may be deleted before = FreeBSD=20 > 14.0. > psm0: model Synaptics Touchpad, device ID 0 > acpi_acad0: on acpi0 > battery0: on acpi0 > vga0: at port 0x3c0-0x3df iomem 0xa0000-0xbffff = pnpid=20 > PNP0900 on isa0 > ata0: at port 0x1f0-0x1f7,0x3f6 irq 14 on isa0 > ata1: at port 0x170-0x177,0x376 irq 15 on isa0 > acpi_perf0: on cpu0 > acpi_throttle0: on cpu0 > coretemp0: on cpu0 > acpi_throttle1: failed to attach P_CNT > device_attach: acpi_throttle1 attach returned 6 > acpi_throttle2: failed to attach P_CNT > device_attach: acpi_throttle2 attach returned 6 > acpi_throttle3: failed to attach P_CNT > device_attach: acpi_throttle3 attach returned 6 > module_register_init: MOD_LOAD (tmpfs, 0xffffffff807a2760,=20 > 0xffffffff80c88540) error 17 > Timecounters tick every 10.000 msec > ZFS filesystem version: 5 > ZFS storage pool version: features support (5000) > IP Filter: v5.1.2 initialized. Default =3D pass all, Logging =3D = enabled > hdacc0: at cad 0 on hdac0 > hdaa0: at nid 1 on hdacc0 > pcm0: at nid 20,33 and 27 on = hdaa0 > pcm1: at nid 24 on hdaa0 > hdacc1: at cad 3 on hdac0 > hdaa1: at nid 1 on hdacc1 > pcm2: at nid 5 on hdaa1 > smbus0: on ichsmb0 > smb0: on smbus0 > sysctl_unregister_oid: failed(22) to unregister sysctl(tmpfs) > ugen1.1: at usbus1 > ugen0.1: at usbus0 > uhub0 on usbus1 > Trying to mount root from ufs:/dev/ufs/Sroot [rw]... > Root mount waiting for: usbus0 usbus1 CAM > uhub1 on usbus0 > uhub1: on = usbus0 > uhub0: on = usbus1 > ses0 at ahciem0 bus 0 scbus3 target 0 lun 0 > ses0: SEMB S-E-S 2.00 device > ses0: SEMB SES Device > ada0 at ahcich0 bus 0 scbus0 target 0 lun 0 > ada0: ATA8-ACS SATA 3.x device > ada0: Serial Number JR1000D33969RE > ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) > ada0: Command Queueing enabled > ada0: 953869MB (1953525168 512 byte sectors) > ses0: pass0,ada0 in 'Slot 00', SATA Slot: scbus0 target 0 > ses0: pass1,cd0 in 'Slot 01', SATA Slot: scbus1 target 0 > cd0 at ahcich1 bus 0 scbus1 target 0 lun 0 > cd0: Removable CD-ROM SCSI device > cd0: Serial Number SBB5103801 > cd0: 150.000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO = 8192bytes) > cd0: Attempt to query device size failed: NOT READY, Medium not = present -=20 > tray closed > uhub1: 2 ports with 2 removable, self powered > uhub0: 2 ports with 2 removable, self powered > Root mount waiting for: usbus0 usbus1 > ugen0.2: at usbus0 > uhub2 on uhub1 > uhub2: on=20 > usbus0 > ugen1.2: at usbus1 > uhub3 on uhub0 > uhub3: on=20 > usbus1 > Root mount waiting for: usbus0 usbus1 > uhub3: 6 ports with 6 removable, self powered > uhub2: 6 ports with 6 removable, self powered > ugen1.3: at usbus1 > uhub4 on uhub3 > uhub4: on = usbus1 > ugen0.3: at usbus0 > uhub5 on uhub2 > uhub5: on=20= > usbus0 > Root mount waiting for: usbus0 usbus1 > uhub4: 4 ports with 4 removable, self powered > uhub5: 4 ports with 4 removable, self powered > ugen1.4: at usbus1 > ukbd0 on uhub4 > ukbd0: on = usbus1 > kbd2 at ukbd0 > ums0 on uhub4 > ums0: on = usbus1 > ums0: 16 buttons and [XYZT] coordinates ID=3D2 > ugen0.4: at usbus0 > uhub6 on uhub5 > uhub6: on=20= > usbus0 > Root mount waiting for: usbus0 usbus1 > ugen1.5: at usbus1 > ukbd1 on uhub4 > ukbd1: on=20= > usbus1 > kbd3 at ukbd1 > uhub6: 4 ports with 4 removable, self powered > ugen0.5: at usbus0 > umass0 on uhub6 > umass0: on = usbus0 > umass0: SCSI over Bulk-Only; quirks =3D 0x4100 > umass0:6:0: Attached to scbus6 > Root mount waiting for: usbus0 CAM > da0 at umass-sim0 bus 0 scbus6 target 0 lun 0 > da0: Fixed Direct Access SCSI device > da0: 40.000MB/s transfers > da0: 76351MB (156368016 512 byte sectors) > da0: quirks=3D0x2 > ugen0.6: at usbus0 > umass1 on uhub6 > umass1: = on=20 > usbus0 > umass1: SCSI over Bulk-Only; quirks =3D 0x408c > umass1:7:1: Attached to scbus7 > da1 at umass-sim1 bus 1 scbus7 target 0 lun 0 > da1: Fixed Direct Access SCSI device > da1: 40.000MB/s transfers > da1: 76319MB (156301488 512 byte sectors) > da1: quirks=3D0x2 > ugen0.7: at usbus0 > umass2 on uhub5 > umass2: = on=20 > usbus0 > umass2: SCSI over Bulk-Only; quirks =3D 0x4101 > umass2:8:2: Attached to scbus8 > da2 at umass-sim2 bus 2 scbus8 target 0 lun 0 > da2: < Flash Disk 8.07> Removable Direct Access SCSI-2 device > da2: Serial Number 029B4D84 > da2: 40.000MB/s transfers > da2: 246MB (504320 512 byte sectors) > da2: quirks=3D0x2 > Root mount waiting for: usbus0 > ugen0.8: at usbus0 > mountroot: waiting for device /dev/ufs/Sroot... > WARNING: / was not properly dismounted > WARNING: /: mount pending error: blocks 24 files 0 > <118>Setting hostuuid: 34f5ed40-8938-11da-b265-efe316da850d. > <118>Setting hostid: 0x7f5a03b9. > <118>Starting file system checks: > <118>** SU+J Recovering /dev/ufs/Sroot > <118>** Reading 16777216 byte journal from inode 4. > <118>** Building recovery table. > <118>** Resolving unreferenced inode list. > <118>** Processing journal entries. > <118>** 7 journal records in 1536 bytes for 14.58% utilization > <118>** Freed 1 inodes (0 dirs) 0 blocks, and 3 frags. > <118> > <118>***** FILE SYSTEM MARKED CLEAN ***** > <118>** SU+J Recovering /dev/ufs/Svar > <118>** Reading 16777216 byte journal from inode 4. > <118>** Building recovery table. > <118>** Resolving unreferenced inode list. > <118>** Processing journal entries. > <118>** SU+J Recovering /dev/ufs/Susr > <118>** Reading 25165824 byte journal from inode 4. > <118>** 40 journal records in 4096 bytes for 31.25% utilization > <118>** Freed 0 inodes (0 dirs) 0 blocks, and 0 frags. > <118> > <118>***** FILE SYSTEM MARKED CLEAN ***** > <118>** Building recovery table. > <118>** Resolving unreferenced inode list. > <118>** Processing journal entries. > <118> > <118>***** FILE SYSTEM MARKED CLEAN ***** > <118>/dev/ada0s3a: 7535 files, 131352 used, 376431 free (1135 frags, = 46912=20 > blocks, 0.2% fragmentation) > <118>/dev/ada0s3e: 24573 files, 319053 used, 442234 free (1082 frags, = 55144=20 > blocks, 0.1% fragmentation) > <118>/dev/ada0s3d: 22537 files, 105401 used, 402382 free (270 frags, = 50264=20 > blocks, 0.1% fragmentation) > <118>/dev/ada0s3f: 18331 files, 109447 used, 398336 free (576 frags, = 49720=20 > blocks, 0.1% fragmentation) > <118>/dev/ada0s3h: 22924 files, 188609 used, 572677 free (685 frags, = 71499=20 > blocks, 0.1% fragmentation) > <118>/dev/ada0s3g: 5348 files, 49444 used, 458339 free (275 frags, = 57258=20 > blocks, 0.1% fragmentation) > <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk3p1 > <118>** Reading 33554432 byte journal from inode 4. > <118>** Building recovery table. > <118>** Resolving unreferenced inode list. > <118>** Processing journal entries. > <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk0s1a > <118>** Reading 16777216 byte journal from inode 827. > <118> > <118>***** FILE SYSTEM MARKED CLEAN ***** > <118>** Building recovery table. > <118>** Resolving unreferenced inode list. > <118>** Processing journal entries. > <118> > <118>***** FILE SYSTEM MARKED CLEAN ***** > <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk0s1d > <118>** Reading 16777216 byte journal from inode 117. > <118>** Building recovery table. > <118>** Resolving unreferenced inode list. > <118>** Processing journal entries. > <118> > <118>***** FILE SYSTEM MARKED CLEAN ***** > <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk0s1e > <118>** Reading 33554432 byte journal from inode 16. > <118>** Building recovery table. > <118>** Resolving unreferenced inode list. > <118>** Processing journal entries. > <118> > <118>***** FILE SYSTEM MARKED CLEAN ***** > <118>/dev/msdosfs/SHARED: 435 files, 6.2 GiB free (203709 clusters) > <118>FIXED > <118>/dev/msdosfs/SHARED: MARKING FILE SYSTEM CLEAN > <118>/dev/zvol/tank/VMs/current/i386/disk0s1a: 114555 files, 255948 = used,=20 > 251835 free (403 frags, 31429 blocks, 0.1% fragmentation) > <118>/dev/zvol/tank/VMs/current/i386/disk0s1d: 22759 files, 126960 = used,=20 > 380823 free (143 frags, 47585 blocks, 0.0% fragmentation) > <118>/dev/zvol/tank/VMs/current/i386/disk0s1e: 28564 files, 549004 = used,=20 > 973507 free (1603 frags, 121488 blocks, 0.1% fragmentation) > <118>Mounting local filesystems:. > <118>Mounting ZFS filesystems: (193/193) > <118>Local package initialization:error: ed0: No such device exists=20 > (BIOCSETIF failed: Device not configured) > <118>Unable to read the configuration file: No such file or directory = at=20 > /usr/local/lib/perl5/site_perl/Jail.pm line 50. > <118>Compilation failed in require at /usr/local/sbin/jailadmin line = 13. > <118>BEGIN failed--compilation aborted at /usr/local/sbin/jailadmin = line 13. > <118> Jails. > <118>Autoloading module: acpi_wmi > acpi_wmi0: on acpi0 > acpi_wmi0: Embedded MOF found > ACPI: \_SB.AMWA.WQEE: 1 arguments were passed to a non-method ACPI = object=20 > (Buffer) (20210730/nsarguments-361) > acpi_wmi1: on acpi0 > acpi_wmi1: Embedded MOF found > ACPI: \_SB.AMW0.WQDD: 1 arguments were passed to a non-method ACPI = object=20 > (Buffer) (20210730/nsarguments-361) > <118>Updating CPU Microcode... > CPU: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz (2294.83-MHz K8-class = CPU) > Origin=3D"GenuineIntel" Id=3D0x206a7 Family=3D0x6 Model=3D0x2a = Stepping=3D7 > = Features=3D0xbfebfbff CA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> > = Features2=3D0x1dbae3bf = 16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,XSAVE,OSXSAVE,AVX> > AMD Features=3D0x28100800 > AMD Features2=3D0x1 > Structured Extended = Features3=3D0x9c000400 > XSAVE Features=3D0x1 > VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID > TSC: P-state invariant, performance statistics > <118>Done. > <118>ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib=20= > /usr/local/lib/compat/pkg /usr/local/krb5/lib /usr/local/kde4/lib=20 > /usr/local/dt/lib /usr/local/lib/compat/pkg /usr/local/lib/dovecot=20 > /usr/local/lib/e2fsprogs /usr/local/lib/expect5.45.4=20 > /usr/local/lib/freeradius-3.0.23 /usr/local/lib/gcc10 = /usr/local/lib/gcc11=20 > /usr/local/lib/gcc12 /usr/local/lib/gcc8 /usr/local/lib/gcc9=20 > /usr/local/lib/graphviz /usr/local/lib/httrack /usr/local/lib/itcl3.4=20= > /usr/local/lib/mysql /usr/local/lib/mysql/plugin = /usr/local/lib/opencollada=20 > /usr/local/lib/perl5/5.30/mach/CORE = /usr/local/lib/perl5/5.32/mach/CORE=20 > /usr/local/lib/perl5/5.34/mach/CORE /usr/local/lib/pidgin=20 > /usr/local/lib/pth /usr/local/lib/qt5 /usr/local/lib/samba4=20 > /usr/local/lib/xrdp /usr/local/libexec/openldap = /usr/local/llvm-devel/lib=20 > /usr/local/llvm10/lib /usr/local/llvm11/lib /usr/local/llvm12/lib=20 > /usr/local/llvm70/lib /usr/local/llvm80/lib /usr/local/llvm90/lib=20 > /usr/local/share/chromium > <118>32-bit compatibility ldconfig path: /usr/lib32=20 > /alt/i386/root/usr/local/lib > <118>Setting hostname: slippy. > <118>Setting up harvesting: = [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER > ],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED > <118>Feeding entropy: . > <118>Starting ippool. > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > present in pool > <118>Additional TCP/IP options: rfc1323 extensions=3DNO. > <118>Enabling ipfilter. > <118>Installing NAT rules. > <118>0 entries flushed from NAT table > <118>0 entries flushed from NAT list > <118>Starting ipmon. > <6>wlan0: Ethernet address: 20:6a:8a:72:03:17 > <118>Created wlan(4) interfaces: wlan0. > <6>bridge0: Ethernet address: 58:9c:fc:10:ff:c8 > <118>Created clone interfaces: lagg0 bridge0. > <6>lo0: link state changed to UP > <6>bge0: link state changed to DOWN > iwn0: iwn_read_firmware: ucode rev=3D0x12a80601 > <118>Starting wpa_supplicant. > <6>lagg0: link state changed to DOWN > <6>lagg0: IPv6 addresses on wlan0 have been removed before adding it = as a=20 > member to prevent IPv6 address scope violation. > iwn0: iwn_read_firmware: ucode rev=3D0x12a80601 > <6>wlan0: link state changed to UP > <6>lagg0: link state changed to UP > <6>bge0: link state changed to UP >=20 >=20 > Fatal trap 12: page fault while in kernel mode > cpuid =3D 0; apic id =3D 00 > fault virtual address =3D 0x128 > fault code =3D supervisor read data, page not present > instruction pointer =3D 0x20:0xffffffff806cb53d > stack pointer =3D 0x28:0xfffffe00831a3210 > frame pointer =3D 0x28:0xfffffe00831a3210 > code segment =3D base 0x0, limit 0xfffff, type 0x1b > =3D DPL 0, pres 1, long 1, def32 0, gran 1 > processor eflags =3D interrupt enabled, resume, IOPL =3D 0 > current process =3D 0 (bge0 taskq) > trap number =3D 12 > panic: page fault > cpuid =3D 0 > time =3D 1629610531 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame=20 > 0xfffffe00831a2eb0 > vpanic() at vpanic+0x187/frame 0xfffffe00831a2f10 > panic() at panic+0x43/frame 0xfffffe00831a2f70 > trap_fatal() at trap_fatal+0x387/frame 0xfffffe00831a2fd0 > trap_pfault() at trap_pfault+0x4f/frame 0xfffffe00831a3030 > trap() at trap+0x26a/frame 0xfffffe00831a3140 > calltrap() at calltrap+0x8/frame 0xfffffe00831a3140 > --- trap 0xc, rip =3D 0xffffffff806cb53d, rsp =3D 0xfffffe00831a3210, = rbp =3D=20 > 0xfffffe00831a3210 --- > __rw_rlock_int() at __rw_rlock_int+0xd/frame 0xfffffe00831a3210 > in6_lltable_lookup() at in6_lltable_lookup+0xa7/frame = 0xfffffe00831a3240 > nd6_lookup() at nd6_lookup+0x4e/frame 0xfffffe00831a3270 > pfxlist_onlink_check() at pfxlist_onlink_check+0xfb/frame = 0xfffffe00831a3310 > nd6_ra_input() at nd6_ra_input+0x147f/frame 0xfffffe00831a35d0 > icmp6_input() at icmp6_input+0x685/frame 0xfffffe00831a37b0 > ip6_input() at ip6_input+0xa9a/frame 0xfffffe00831a3890 > netisr_dispatch_src() at netisr_dispatch_src+0xca/frame = 0xfffffe00831a38e0 > ether_demux() at ether_demux+0x138/frame 0xfffffe00831a3910 > ether_nh_input() at ether_nh_input+0x34e/frame 0xfffffe00831a3970 > netisr_dispatch_src() at netisr_dispatch_src+0xca/frame = 0xfffffe00831a39c0 > ether_input() at ether_input+0x69/frame 0xfffffe00831a3a20 > if_input() at if_input+0xa/frame 0xfffffe00831a3a30 > bge_rxeof() at bge_rxeof+0x4dc/frame 0xfffffe00831a3ab0 > bge_intr_task() at bge_intr_task+0x1a7/frame 0xfffffe00831a3b00 > taskqueue_run_locked() at taskqueue_run_locked+0x191/frame=20 > 0xfffffe00831a3b80 > taskqueue_thread_loop() at taskqueue_thread_loop+0xc3/frame=20 > 0xfffffe00831a3bb0 > fork_exit() at fork_exit+0x8a/frame 0xfffffe00831a3bf0 > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00831a3bf0 > --- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- > Uptime: 1m28s > Dumping 512 out of 7972 = MB:..4%..13%..22%..32%..41%..54%..63%..72%..82%..91% >=20 > __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 > 55 __asm("movq %%gs:%P1,%0" : "=3Dr" (td) : "n" = (offsetof(struct pcpu, > (kgdb) bt > #0 __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 > #1 doadump (textdump=3Dtextdump@entry=3D1) at = /opt/src/git-src/sys/kern/kern_sh > utdown.c:399 > #2 0xffffffff806cf9ab in kern_reboot (howto=3D260) at=20 > /opt/src/git-src/sys/kern/kern_shutdown.c:486 > #3 0xffffffff806cfe26 in vpanic (fmt=3D0xffffffff80a94e2f "%s",=20 > ap=3D) at /opt/src/git-src/sys/kern/kern_shutdown.c:919 > #4 0xffffffff806cfc23 in panic (fmt=3D) at=20 > /opt/src/git-src/sys/kern/kern_shutdown.c:843 > #5 0xffffffff80a342c7 in trap_fatal (frame=3D0xfffffe00831a3150, = eva=3D296) at=20 > /opt/src/git-src/sys/amd64/amd64/trap.c:946 > #6 0xffffffff80a3431f in trap_pfault = (frame=3Dframe@entry=3D0xfffffe00831a3150, > usermode=3Dfalse, signo=3D, signo@entry=3D0x0, = ucode=3D out>, ucode@entry=3D0x0) at = /opt/src/git-src/sys/amd64/amd64/trap.c:765 > #7 0xffffffff80a3399a in trap (frame=3D0xfffffe00831a3150) at=20 > /opt/src/git-src/sys/amd64/amd64/trap.c:443 > #8 > #9 __rw_rlock_int (rw=3D0x110) at = /opt/src/git-src/sys/kern/kern_rwlock.c:679 > #10 0xffffffff8087cd07 in in6_lltable_lookup (llt=3D,=20= > flags=3D, l3addr=3D) at = /opt/src/git-src/sys/netin > et6/in6.c:2349 > #11 0xffffffff80897dae in lla_lookup (llt=3D0x110, flags=3D2374593664,=20= > flags@entry=3D0, l3addr=3D0xfffffe00831a3250) at = /opt/src/git-src/sys/net/if_lla > tbl.h:261 > #12 nd6_lookup (addr6=3D, flags=3D-1920373632, = flags@entry=3D0,=20 > ifp=3D) at /opt/src/git-src/sys/netinet6/nd6.c:1204 > #13 0xffffffff8089ff7b in find_pfxlist_reachable_router=20 > (pr=3D0xfffff8002b64f100) at = /opt/src/git-src/sys/netinet6/nd6_rtr.c:1817 > #14 pfxlist_onlink_check () at = /opt/src/git-src/sys/netinet6/nd6_rtr.c:1861 > #15 0xffffffff8089fc5f in nd6_ra_input (m=3D,=20 > m@entry=3D0xfffff8003a3e1d00, off=3D, = icmp6len=3D,=20 > icmp6len@entry=3D48) at /opt/src/git-src/sys/netinet6/nd6_rtr.c:597 > #16 0xffffffff80874aa5 in icmp6_input (mp=3D0xfffffe00831a37f8,=20 > offp=3D0xfffffe00831a37f0, proto=3D) at=20 > /opt/src/git-src/sys/netinet6/icmp6.c:780 > #17 0xffffffff8088beca in ip6_input (m=3D0xfffff8003a3e1d00) at=20 > /opt/src/git-src/sys/netinet6/ip6_input.c:929 > #18 0xffffffff80806d6a in netisr_dispatch_src (proto=3D6, = source=3D out>, source@entry=3D0, m=3D0x0) at = /opt/src/git-src/sys/net/netisr.c:1143 > #19 0xffffffff8080704f in netisr_dispatch (proto=3D272, m=3D0x10) at=20= > /opt/src/git-src/sys/net/netisr.c:1234 > #20 0xffffffff807f3d58 in ether_demux = (ifp=3Difp@entry=3D0xfffff8003a30e800,=20 > m=3D0xfffffe008d896c80) at /opt/src/git-src/sys/net/if_ethersubr.c:925 > #21 0xffffffff807f50fe in ether_input_internal = (ifp=3D0xfffff8003a30e800,=20 > m=3D0xfffffe008d896c80) at /opt/src/git-src/sys/net/if_ethersubr.c:711 > #22 ether_nh_input (m=3D) at = /opt/src/git-src/sys/net/if_ethers > ubr.c:741 > #23 0xffffffff80806d6a in netisr_dispatch_src (proto=3Dproto@entry=3D5,=20= > source=3D, source@entry=3D0, m=3D0x0, = m@entry=3D0xfffff8003a3e1d00)=20 > at /opt/src/git-src/sys/net/netisr.c:1143 > #24 0xffffffff8080704f in netisr_dispatch (proto=3D272, proto@entry=3D5,= =20 > m=3D0x10, m@entry=3D0xfffff8003a3e1d00) at = /opt/src/git-src/sys/net/netisr.c:123 > 4 > #25 0xffffffff807f41a9 in ether_input (ifp=3D,=20 > m=3D0xfffff8003a3e1d00) at /opt/src/git-src/sys/net/if_ethersubr.c:832 > #26 0xffffffff807f042a in if_input (ifp=3D0x110, = ifp@entry=3D0xfffff8000516b800, > sendmp=3D0xfffffe008d896c80, sendmp@entry=3D0xfffff8003a3e1d00) at=20 > /opt/src/git-src/sys/net/if.c:4444 > #27 0xffffffff818eaabc in bge_rxeof (sc=3D,=20 > sc@entry=3D0xfffffe00107d0000, rx_prod=3Drx_prod@entry=3D2,=20 > holdlck=3Dholdlck@entry=3D0) at = /opt/src/git-src/sys/dev/bge/if_bge.c:4436 > #28 0xffffffff818e7d57 in bge_intr_task (arg=3D0xfffffe00107d0000,=20 > pending=3D) at = /opt/src/git-src/sys/dev/bge/if_bge.c:4666 > #29 0xffffffff80731d81 in taskqueue_run_locked = (queue=3Dqueue@entry=3D0xfffff800 > 03890600) at /opt/src/git-src/sys/kern/subr_taskqueue.c:476 > #30 0xffffffff80733073 in taskqueue_thread_loop (arg=3D,=20 > arg@entry=3D0xfffffe00107d7568) at = /opt/src/git-src/sys/kern/subr_taskqueue.c: > 793 > #31 0xffffffff8068b80a in fork_exit (callout=3D0xffffffff80732fb0=20 > , arg=3D0xfffffe00107d7568, = frame=3D0xfffffe00831a3c00)=20 > at /opt/src/git-src/sys/kern/kern_fork.c:1087 > #32 > (kgdb) frame 9 > #9 __rw_rlock_int (rw=3D0x110) at = /opt/src/git-src/sys/kern/kern_rwlock.c:679 > 679 v =3D RW_READ_VALUE(rw); > (kgdb) l > 674 KASSERT(rw_wowner(rw) !=3D td, > 675 ("rw_rlock: wlock already held for %s @ %s:%d", > 676 rw->lock_object.lo_name, file, line)); > 677 WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, = line, NULL); > 678=09 > 679 v =3D RW_READ_VALUE(rw); > 680 if = (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || > 681 !__rw_rlock_try(rw, td, &v, true = LOCK_FILE_LINE_ARG))) > 682 __rw_rlock_hard(rw, td, v LOCK_FILE_LINE_ARG); > 683 else > (kgdb) p rw > $1 =3D (struct rwlock *) 0x110 > (kgdb) frame 10 > #10 0xffffffff8087cd07 in in6_lltable_lookup (llt=3D,=20= > flags=3D, l3addr=3D) at = /opt/src/git-src/sys/netin > et6/in6.c:2349 > 2349 LLE_RLOCK(lle); > (kgdb) l > 2344 return (lle); > 2345=09 > 2346 if (flags & LLE_EXCLUSIVE) > 2347 LLE_WLOCK(lle); > 2348 else > 2349 LLE_RLOCK(lle); > 2350=09 > 2351 /* > 2352 * If the afdata lock is not held, the LLE may have been = unlinked=20 > while > 2353 * we were blocked on the LLE lock. Check for this = case. > (kgdb) p lle > $2 =3D (struct llentry *) 0x0 > (kgdb)=20 >=20 >=20 >=20 > --=20 > Cheers, > Cy Schubert > > FreeBSD UNIX: > Web: = https://FreeBSD.org > NTP: > Web: = https://nwtime.org >=20 > The need of the many outweighs the greed of the few. From owner-dev-commits-src-main@freebsd.org Sun Aug 22 09:39:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4954E6515E0; Sun, 22 Aug 2021 09:39:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gsr211Nc0z4sVN; Sun, 22 Aug 2021 09:39:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 178DD1E894; Sun, 22 Aug 2021 09:39:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17M9dqSc066800; Sun, 22 Aug 2021 09:39:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17M9dqfp066799; Sun, 22 Aug 2021 09:39:52 GMT (envelope-from git) Date: Sun, 22 Aug 2021 09:39:52 GMT Message-Id: <202108220939.17M9dqfp066799@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 98399ab06f6c - main - netmap: import changes from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98399ab06f6c6adbd795266bc8a45e3f804ac6f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 09:39:53 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=98399ab06f6c6adbd795266bc8a45e3f804ac6f8 commit 98399ab06f6c6adbd795266bc8a45e3f804ac6f8 Author: Vincenzo Maffione AuthorDate: 2021-08-22 09:31:05 +0000 Commit: Vincenzo Maffione CommitDate: 2021-08-22 09:31:05 +0000 netmap: import changes from upstream - make sure rings are disabled during resets - introduce netmap_update_hostrings_mode(), with support for multiple host rings - always initialize ni_bufs_head in netmap_if ni_bufs_head was not properly initialized when no external buffers were requestedx and contained the ni_bufs_head from the last request. This was causing spurious buffer frees when alternating between apps that used external buffers and apps that did not use them. - check na validitity under lock on detach - netmap_mem: fix leak on error path - nm_dispatch: fix compilation on Raspberry Pi MFC after: 2 weeks --- sys/dev/netmap/netmap.c | 36 +++++++++++++++++++++++++++++++----- sys/dev/netmap/netmap_kern.h | 10 ---------- sys/dev/netmap/netmap_mem2.c | 7 ++++--- sys/net/netmap_user.h | 2 +- 4 files changed, 36 insertions(+), 19 deletions(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index 9f1edb246cae..ed3154a524db 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -1002,6 +1002,22 @@ netmap_mem_drop(struct netmap_adapter *na) } } +static void +netmap_update_hostrings_mode(struct netmap_adapter *na) +{ + enum txrx t; + struct netmap_kring *kring; + int i; + + for_rx_tx(t) { + for (i = nma_get_nrings(na, t); + i < netmap_real_rings(na, t); i++) { + kring = NMR(na, t)[i]; + kring->nr_mode = kring->nr_pending_mode; + } + } +} + /* * Undo everything that was done in netmap_do_regif(). In particular, * call nm_register(ifp,0) to stop netmap mode on the interface and @@ -1032,7 +1048,9 @@ netmap_do_unregif(struct netmap_priv_d *priv) #endif if (na->active_fds <= 0 || nm_kring_pending(priv)) { + netmap_set_all_rings(na, NM_KR_LOCKED); na->nm_register(na, 0); + netmap_set_all_rings(na, 0); } /* delete rings and buffers that are no longer needed */ @@ -2630,7 +2648,9 @@ netmap_do_regif(struct netmap_priv_d *priv, struct netmap_adapter *na, if (nm_kring_pending(priv)) { /* Some kring is switching mode, tell the adapter to * react on this. */ + netmap_set_all_rings(na, NM_KR_LOCKED); error = na->nm_register(na, 1); + netmap_set_all_rings(na, 0); if (error) goto err_del_if; } @@ -2858,6 +2878,8 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, &nifp->ni_bufs_head, req->nr_extra_bufs); if (netmap_verbose) nm_prinf("got %d extra buffers", req->nr_extra_bufs); + } else { + nifp->ni_bufs_head = 0; } req->nr_offset = netmap_mem_if_offset(na->nm_mem, nifp); @@ -4178,12 +4200,16 @@ netmap_hw_krings_create(struct netmap_adapter *na) void netmap_detach(struct ifnet *ifp) { - struct netmap_adapter *na = NA(ifp); + struct netmap_adapter *na; - if (!na) + NMG_LOCK(); + + if (!NM_NA_VALID(ifp)) { + NMG_UNLOCK(); return; + } - NMG_LOCK(); + na = NA(ifp); netmap_set_all_rings(na, NM_KR_LOCKED); /* * if the netmap adapter is not native, somebody @@ -4491,7 +4517,7 @@ nm_set_native_flags(struct netmap_adapter *na) na->na_flags |= NAF_NETMAP_ON; nm_os_onenter(ifp); - nm_update_hostrings_mode(na); + netmap_update_hostrings_mode(na); } void @@ -4505,7 +4531,7 @@ nm_clear_native_flags(struct netmap_adapter *na) return; } - nm_update_hostrings_mode(na); + netmap_update_hostrings_mode(na); nm_os_onexit(ifp); na->na_flags &= ~NAF_NETMAP_ON; diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index cc452657d8d5..5d8957241c21 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -1435,16 +1435,6 @@ nm_iszombie(struct netmap_adapter *na) return na == NULL || (na->na_flags & NAF_ZOMBIE); } -static inline void -nm_update_hostrings_mode(struct netmap_adapter *na) -{ - /* Process nr_mode and nr_pending_mode for host rings. */ - na->tx_rings[na->num_tx_rings]->nr_mode = - na->tx_rings[na->num_tx_rings]->nr_pending_mode; - na->rx_rings[na->num_rx_rings]->nr_mode = - na->rx_rings[na->num_rx_rings]->nr_pending_mode; -} - void nm_set_native_flags(struct netmap_adapter *); void nm_clear_native_flags(struct netmap_adapter *); diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c index e6c83efe9ea9..a6be490e5b09 100644 --- a/sys/dev/netmap/netmap_mem2.c +++ b/sys/dev/netmap/netmap_mem2.c @@ -1706,7 +1706,7 @@ _netmap_mem_private_new(size_t size, struct netmap_obj_params *p, int grp_id, if (memtotal < poolsz) { nm_prerr("%s: request too large", d->pools[i].name); err = ENOMEM; - goto error; + goto error_rel_id; } memtotal -= poolsz; } @@ -1731,14 +1731,15 @@ _netmap_mem_private_new(size_t size, struct netmap_obj_params *p, int grp_id, err = netmap_mem_config(d); if (err) - goto error_rel_id; + goto error_destroy_lock; d->flags &= ~NETMAP_MEM_FINALIZED; return d; -error_rel_id: +error_destroy_lock: NMA_LOCK_DESTROY(d); +error_rel_id: nm_mem_release_id(d); error_free: nm_os_free(d); diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h index 06b159d9bfe7..e17d2dcbe357 100644 --- a/sys/net/netmap_user.h +++ b/sys/net/netmap_user.h @@ -1131,7 +1131,7 @@ nm_dispatch(struct nm_desc *d, int cnt, nm_cb_t cb, u_char *arg) slot = &ring->slot[i]; d->hdr.len += slot->len; nbuf = (u_char *)NETMAP_BUF(ring, slot->buf_idx); - if (oldbuf != NULL && nbuf - oldbuf == ring->nr_buf_size && + if (oldbuf != NULL && (uint32_t)(nbuf - oldbuf) == ring->nr_buf_size && oldlen == ring->nr_buf_size) { d->hdr.caplen += slot->len; oldbuf = nbuf; From owner-dev-commits-src-main@freebsd.org Sun Aug 22 11:04:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 50BD7652CFC; Sun, 22 Aug 2021 11:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gssw21F9Bz3m5k; Sun, 22 Aug 2021 11:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CC1F1F7FD; Sun, 22 Aug 2021 11:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17MB4ndF086660; Sun, 22 Aug 2021 11:04:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17MB4n5W086658; Sun, 22 Aug 2021 11:04:49 GMT (envelope-from git) Date: Sun, 22 Aug 2021 11:04:49 GMT Message-Id: <202108221104.17MB4n5W086658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Thomas Munro Subject: git: f30a1ae8d529 - main - lio_listio(2): Allow LIO_READV and LIO_WRITEV. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tmunro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f30a1ae8d5290a52e898279bafc38556bf16bed8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 11:04:50 -0000 The branch main has been updated by tmunro: URL: https://cgit.FreeBSD.org/src/commit/?id=f30a1ae8d5290a52e898279bafc38556bf16bed8 commit f30a1ae8d5290a52e898279bafc38556bf16bed8 Author: Thomas Munro AuthorDate: 2021-08-22 09:48:59 +0000 Commit: Thomas Munro CommitDate: 2021-08-22 11:00:42 +0000 lio_listio(2): Allow LIO_READV and LIO_WRITEV. Allow multiple vector IOs to be started with one system call. aio_readv() and aio_writev() already used these opcodes under the covers. This commit makes them available to user space. Being non-standard extensions, they're only visible if __BSD_VISIBLE is defined, like the functions. Reviewed by: asomers, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31627 --- lib/libc/sys/lio_listio.2 | 16 ++++++- sys/kern/vfs_aio.c | 4 ++ sys/sys/aio.h | 4 +- tests/sys/aio/lio_test.c | 109 ++++++++++++++++++++++++++++++++++++---------- usr.bin/truss/syscalls.c | 2 +- 5 files changed, 110 insertions(+), 25 deletions(-) diff --git a/lib/libc/sys/lio_listio.2 b/lib/libc/sys/lio_listio.2 index 0e04e7c88338..ef1b1add3376 100644 --- a/lib/libc/sys/lio_listio.2 +++ b/lib/libc/sys/lio_listio.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 7, 2019 +.Dd August 22, 2021 .Dt LIO_LISTIO 2 .Os .Sh NAME @@ -66,11 +66,17 @@ The following operations are supported: .It Dv LIO_READ Read data as if by a call to .Xr aio_read 2 . +.It Dv LIO_READV +Read data as if by a call to +.Xr aio_readv 2 . .It Dv LIO_NOP No operation. .It Dv LIO_WRITE Write data as if by a call to .Xr aio_write 2 . +.It Dv LIO_WRITEV +Write data as if by a call to +.Xr aio_writev 2 . .El .Pp If the @@ -205,7 +211,9 @@ structure individually by calling .Sh SEE ALSO .Xr aio_error 2 , .Xr aio_read 2 , +.Xr aio_readv 2 , .Xr aio_write 2 , +.Xr aio_writev 2 , .Xr read 2 , .Xr write 2 , .Xr sigevent 3 , @@ -216,6 +224,12 @@ The .Fn lio_listio function is expected to conform to .St -p1003.1-2001 . +The +.Dv LIO_READV +and +.Dv LIO_WRITEV +operations are +.Fx extensions, and should not be used in portable code. .Sh HISTORY The .Fn lio_listio diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 7d4d9ac3e94b..602c91b542de 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1419,6 +1419,8 @@ aiocb_copyin(struct aiocb *ujob, struct kaiocb *kjob, int type) error = copyin(ujob, kcb, sizeof(struct aiocb)); if (error) return (error); + if (type == LIO_NOP) + type = kcb->aio_lio_opcode; if (type & LIO_VECTORED) { /* malloc a uio and copy in the iovec */ error = copyinuio(__DEVOLATILE(struct iovec*, kcb->aio_iov), @@ -1557,8 +1559,10 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, if (type == LIO_NOP) { switch (job->uaiocb.aio_lio_opcode) { case LIO_WRITE: + case LIO_WRITEV: case LIO_NOP: case LIO_READ: + case LIO_READV: opcode = job->uaiocb.aio_lio_opcode; break; default: diff --git a/sys/sys/aio.h b/sys/sys/aio.h index d3e03efa310e..7b931d04febc 100644 --- a/sys/sys/aio.h +++ b/sys/sys/aio.h @@ -43,10 +43,12 @@ #define LIO_NOP 0x0 #define LIO_WRITE 0x1 #define LIO_READ 0x2 -#if defined(_KERNEL) || defined(_WANT_ALL_LIO_OPCODES) +#if __BSD_VISIBLE #define LIO_VECTORED 0x4 #define LIO_WRITEV (LIO_WRITE | LIO_VECTORED) #define LIO_READV (LIO_READ | LIO_VECTORED) +#endif +#if defined(_KERNEL) || defined(_WANT_ALL_LIO_OPCODES) #define LIO_SYNC 0x8 #define LIO_DSYNC (0x10 | LIO_SYNC) #define LIO_MLOCK 0x20 diff --git a/tests/sys/aio/lio_test.c b/tests/sys/aio/lio_test.c index a4f5a6a38632..720fcc1fa94f 100644 --- a/tests/sys/aio/lio_test.c +++ b/tests/sys/aio/lio_test.c @@ -210,15 +210,96 @@ ATF_TC_BODY(lio_listio_empty_nowait_thread, tc) ATF_REQUIRE_EQ(0, sem_destroy(&completions)); } +/* + * A simple check that the allowed operations work. + */ +ATF_TC_WITHOUT_HEAD(lio_listio_opcodes); +ATF_TC_BODY(lio_listio_opcodes, tc) +{ + struct aiocb write_cb, read_cb, writev_cb, readv_cb; + struct aiocb *list[] = {&write_cb, &read_cb, &writev_cb, &readv_cb}; + struct iovec writev_iov[2]; + struct iovec readv_iov[2]; + char buffer[6]; + int fd; + + fd = open("testfile", O_CREAT | O_RDWR); + ATF_REQUIRE_MSG(fd >= 0, "open: %s", strerror(errno)); + + /* We start with numbers in a file and letters in memory... */ + ATF_CHECK_EQ(6, write(fd, "123456", 6)); + memcpy(buffer, "abcdef", 6); + + /* a -> 1 */ + bzero(&write_cb, sizeof(write_cb)); + write_cb.aio_sigevent.sigev_notify = SIGEV_NONE; + write_cb.aio_fildes = fd; + write_cb.aio_lio_opcode = LIO_WRITE; + write_cb.aio_buf = &buffer[0]; + write_cb.aio_nbytes = 1; + write_cb.aio_offset = 0; + + /* b <- 2 */ + bzero(&read_cb, sizeof(read_cb)); + read_cb.aio_sigevent.sigev_notify = SIGEV_NONE; + read_cb.aio_fildes = fd; + read_cb.aio_lio_opcode = LIO_READ; + read_cb.aio_buf = &buffer[1]; + read_cb.aio_nbytes = 1; + read_cb.aio_offset = 1; + + /* d -> 3, c -> 4 */ + writev_iov[0].iov_base = &buffer[3]; + writev_iov[0].iov_len = 1; + writev_iov[1].iov_base = &buffer[2]; + writev_iov[1].iov_len = 1; + bzero(&writev_cb, sizeof(writev_cb)); + writev_cb.aio_sigevent.sigev_notify = SIGEV_NONE; + writev_cb.aio_fildes = fd; + writev_cb.aio_lio_opcode = LIO_WRITEV; + writev_cb.aio_iov = &writev_iov; + writev_cb.aio_iovcnt = 2; + writev_cb.aio_offset = 2; + + /* f <- 5, e <- 6 */ + readv_iov[0].iov_base = &buffer[5]; + readv_iov[0].iov_len = 1; + readv_iov[1].iov_base = &buffer[4]; + readv_iov[1].iov_len = 1; + bzero(&readv_cb, sizeof(readv_cb)); + readv_cb.aio_sigevent.sigev_notify = SIGEV_NONE; + readv_cb.aio_fildes = fd; + readv_cb.aio_lio_opcode = LIO_READV; + readv_cb.aio_iov = &readv_iov; + readv_cb.aio_iovcnt = 2; + readv_cb.aio_offset = 4; + + ATF_CHECK_EQ(0, lio_listio(LIO_WAIT, list, nitems(list), NULL)); + ATF_CHECK_EQ(0, aio_error(&write_cb)); + ATF_CHECK_EQ(1, aio_return(&write_cb)); + ATF_CHECK_EQ(0, aio_error(&read_cb)); + ATF_CHECK_EQ(1, aio_return(&read_cb)); + ATF_CHECK_EQ(0, aio_error(&writev_cb)); + ATF_CHECK_EQ(2, aio_return(&writev_cb)); + ATF_CHECK_EQ(0, aio_error(&readv_cb)); + ATF_CHECK_EQ(2, aio_return(&readv_cb)); + + ATF_CHECK_EQ(0, memcmp(buffer, "a2cd65", 6)); + ATF_CHECK_EQ(6, pread(fd, buffer, 6, 0)); + ATF_CHECK_EQ(0, memcmp(buffer, "a2dc56", 6)); + + close(fd); +} + + /* * Only select opcodes are allowed with lio_listio */ ATF_TC_WITHOUT_HEAD(lio_listio_invalid_opcode); ATF_TC_BODY(lio_listio_invalid_opcode, tc) { - struct aiocb sync_cb, mlock_cb, writev_cb, readv_cb; - struct aiocb *list[] = {&sync_cb, &mlock_cb, &writev_cb, &readv_cb}; - struct iovec iov; + struct aiocb sync_cb, mlock_cb; + struct aiocb *list[] = {&sync_cb, &mlock_cb}; int fd; fd = open("testfile", O_CREAT | O_RDWR); @@ -231,30 +312,13 @@ ATF_TC_BODY(lio_listio_invalid_opcode, tc) bzero(&mlock_cb, sizeof(mlock_cb)); mlock_cb.aio_lio_opcode = LIO_MLOCK; - iov.iov_base = NULL; - iov.iov_len = 0; - - bzero(&readv_cb, sizeof(readv_cb)); - readv_cb.aio_fildes = fd; - readv_cb.aio_lio_opcode = LIO_READV; - readv_cb.aio_iov = &iov; - readv_cb.aio_iovcnt = 1; - - bzero(&writev_cb, sizeof(writev_cb)); - writev_cb.aio_fildes = fd; - writev_cb.aio_lio_opcode = LIO_WRITEV; - writev_cb.aio_iov = &iov; - writev_cb.aio_iovcnt = 1; - ATF_CHECK_ERRNO(EIO, lio_listio(LIO_WAIT, list, nitems(list), NULL)); ATF_CHECK_EQ(EINVAL, aio_error(&sync_cb)); ATF_CHECK_ERRNO(EINVAL, aio_return(&sync_cb) < 0); ATF_CHECK_EQ(EINVAL, aio_error(&mlock_cb)); ATF_CHECK_ERRNO(EINVAL, aio_return(&mlock_cb) < 0); - ATF_CHECK_EQ(EINVAL, aio_error(&readv_cb)); - ATF_CHECK_ERRNO(EINVAL, aio_return(&readv_cb) < 0); - ATF_CHECK_EQ(EINVAL, aio_error(&writev_cb)); - ATF_CHECK_ERRNO(EINVAL, aio_return(&writev_cb) < 0); + + close(fd); } @@ -267,6 +331,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_signal); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_thread); ATF_TP_ADD_TC(tp, lio_listio_empty_wait); + ATF_TP_ADD_TC(tp, lio_listio_opcodes); ATF_TP_ADD_TC(tp, lio_listio_invalid_opcode); return (atf_no_error()); diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 8c3e833adaec..055235f052bc 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -754,7 +754,7 @@ static struct xlat lio_modes[] = { }; static struct xlat lio_opcodes[] = { - X(LIO_WRITE) X(LIO_READ) X(LIO_NOP) + X(LIO_WRITE) X(LIO_READ) X(LIO_READV) X(LIO_WRITEV) X(LIO_NOP) XEND }; From owner-dev-commits-src-main@freebsd.org Sun Aug 22 12:16:12 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5ADBF65461D; Sun, 22 Aug 2021 12:16:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsvVN1w39z4b6Y; Sun, 22 Aug 2021 12:16:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29B5C20828; Sun, 22 Aug 2021 12:16:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17MCGC2S079645; Sun, 22 Aug 2021 12:16:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17MCGCC6079644; Sun, 22 Aug 2021 12:16:12 GMT (envelope-from git) Date: Sun, 22 Aug 2021 12:16:12 GMT Message-Id: <202108221216.17MCGCC6079644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Thomas Munro Subject: git: 3904e7966eb3 - main - Fix aio_readv(2), aio_writev(2) with SIGEV_THREAD. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tmunro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3904e7966eb353c636c6aa638a6fdf1489ee514c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 12:16:12 -0000 The branch main has been updated by tmunro: URL: https://cgit.FreeBSD.org/src/commit/?id=3904e7966eb353c636c6aa638a6fdf1489ee514c commit 3904e7966eb353c636c6aa638a6fdf1489ee514c Author: Thomas Munro AuthorDate: 2021-08-22 11:34:07 +0000 Commit: Thomas Munro CommitDate: 2021-08-22 11:49:23 +0000 Fix aio_readv(2), aio_writev(2) with SIGEV_THREAD. Add missing wrapper code to librt for these new functions so that SIGEV_THREAD works. Without machinery to convert it to SIGEV_THREAD_ID, you got EINVAL. Reviewed by: asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31618 --- lib/libc/sys/Symbol.map | 2 ++ lib/librt/Symbol.map | 5 +++++ lib/librt/aio.c | 18 ++++++++++++++++++ tests/sys/aio/aio_test.c | 7 +++++++ 4 files changed, 32 insertions(+) diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index 93fbc947a7e1..764d712958be 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -495,10 +495,12 @@ FBSDprivate_1.0 { __sys_aio_error; __sys_aio_fsync; __sys_aio_read; + __sys_aio_readv; __sys_aio_return; __sys_aio_suspend; __sys_aio_waitcomplete; __sys_aio_write; + __sys_aio_writev; _audit; __sys_audit; _auditctl; diff --git a/lib/librt/Symbol.map b/lib/librt/Symbol.map index c11b88397afd..b8fde3dd33b8 100644 --- a/lib/librt/Symbol.map +++ b/lib/librt/Symbol.map @@ -31,6 +31,11 @@ FBSD_1.5 { timer_oshandle_np; }; +FBSD_1.6 { + aio_readv; + aio_writev; +}; + FBSDprivate_1.0 { _mq_open; _mq_close; diff --git a/lib/librt/aio.c b/lib/librt/aio.c index 9c35644ecf3d..8e819a002613 100644 --- a/lib/librt/aio.c +++ b/lib/librt/aio.c @@ -42,7 +42,9 @@ #include "un-namespace.h" __weak_reference(__aio_read, aio_read); +__weak_reference(__aio_readv, aio_readv); __weak_reference(__aio_write, aio_write); +__weak_reference(__aio_writev, aio_writev); __weak_reference(__aio_return, aio_return); __weak_reference(__aio_waitcomplete, aio_waitcomplete); __weak_reference(__aio_fsync, aio_fsync); @@ -51,7 +53,9 @@ __weak_reference(__lio_listio, lio_listio); typedef void (*aio_func)(union sigval val, struct aiocb *iocb); extern int __sys_aio_read(struct aiocb *iocb); +extern int __sys_aio_readv(struct aiocb *iocb); extern int __sys_aio_write(struct aiocb *iocb); +extern int __sys_aio_writev(struct aiocb *iocb); extern ssize_t __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout); extern ssize_t __sys_aio_return(struct aiocb *iocb); extern int __sys_aio_error(struct aiocb *iocb); @@ -130,6 +134,13 @@ __aio_read(struct aiocb *iocb) return aio_io(iocb, &__sys_aio_read); } +int +__aio_readv(struct aiocb *iocb) +{ + + return aio_io(iocb, &__sys_aio_readv); +} + int __aio_write(struct aiocb *iocb) { @@ -137,6 +148,13 @@ __aio_write(struct aiocb *iocb) return aio_io(iocb, &__sys_aio_write); } +int +__aio_writev(struct aiocb *iocb) +{ + + return aio_io(iocb, &__sys_aio_writev); +} + ssize_t __aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout) { diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index 35bd5dc1264b..1c694ad0c18b 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -1627,6 +1627,12 @@ ATF_TC_BODY(vectored_file_poll, tc) aio_file_test(poll, NULL, true); } +ATF_TC_WITHOUT_HEAD(vectored_thread); +ATF_TC_BODY(vectored_thread, tc) +{ + aio_file_test(poll_signaled, setup_thread(), true); +} + ATF_TC_WITH_CLEANUP(vectored_md_poll); ATF_TC_HEAD(vectored_md_poll, tc) { @@ -1814,6 +1820,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, vectored_zvol_poll); ATF_TP_ADD_TC(tp, vectored_unaligned); ATF_TP_ADD_TC(tp, vectored_socket_poll); + ATF_TP_ADD_TC(tp, vectored_thread); return (atf_no_error()); } From owner-dev-commits-src-main@freebsd.org Sun Aug 22 14:15:30 2021 Return-Path: Delivered-To: dev-commits-src-main@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 298D8655D81; Sun, 22 Aug 2021 14:15:30 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gsy815tF8z3M5n; Sun, 22 Aug 2021 14:15:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 17MEFDQK061734 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 22 Aug 2021 17:15:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 17MEFDQK061734 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 17MEFDRa061732; Sun, 22 Aug 2021 17:15:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 22 Aug 2021 17:15:13 +0300 From: Konstantin Belousov To: Thomas Munro Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3904e7966eb3 - main - Fix aio_readv(2), aio_writev(2) with SIGEV_THREAD. Message-ID: References: <202108221216.17MCGCC6079644@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202108221216.17MCGCC6079644@gitrepo.freebsd.org> 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.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4Gsy815tF8z3M5n X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 14:15:30 -0000 On Sun, Aug 22, 2021 at 12:16:12PM +0000, Thomas Munro wrote: > The branch main has been updated by tmunro: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3904e7966eb353c636c6aa638a6fdf1489ee514c > > commit 3904e7966eb353c636c6aa638a6fdf1489ee514c > Author: Thomas Munro > AuthorDate: 2021-08-22 11:34:07 +0000 > Commit: Thomas Munro > CommitDate: 2021-08-22 11:49:23 +0000 > > Fix aio_readv(2), aio_writev(2) with SIGEV_THREAD. > > Add missing wrapper code to librt for these new functions so that > SIGEV_THREAD works. Without machinery to convert it to SIGEV_THREAD_ID, > you got EINVAL. > > Reviewed by: asomers > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D31618 > --- > lib/libc/sys/Symbol.map | 2 ++ > lib/librt/Symbol.map | 5 +++++ > lib/librt/aio.c | 18 ++++++++++++++++++ > tests/sys/aio/aio_test.c | 7 +++++++ > 4 files changed, 32 insertions(+) > > diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map > index 93fbc947a7e1..764d712958be 100644 > --- a/lib/libc/sys/Symbol.map > +++ b/lib/libc/sys/Symbol.map > @@ -495,10 +495,12 @@ FBSDprivate_1.0 { > __sys_aio_error; > __sys_aio_fsync; > __sys_aio_read; > + __sys_aio_readv; > __sys_aio_return; > __sys_aio_suspend; > __sys_aio_waitcomplete; > __sys_aio_write; > + __sys_aio_writev; > _audit; > __sys_audit; > _auditctl; > diff --git a/lib/librt/Symbol.map b/lib/librt/Symbol.map > index c11b88397afd..b8fde3dd33b8 100644 > --- a/lib/librt/Symbol.map > +++ b/lib/librt/Symbol.map > @@ -31,6 +31,11 @@ FBSD_1.5 { > timer_oshandle_np; > }; > > +FBSD_1.6 { > + aio_readv; > + aio_writev; > +}; This must be FBSD_1.7. > + > FBSDprivate_1.0 { > _mq_open; > _mq_close; > diff --git a/lib/librt/aio.c b/lib/librt/aio.c > index 9c35644ecf3d..8e819a002613 100644 > --- a/lib/librt/aio.c > +++ b/lib/librt/aio.c > @@ -42,7 +42,9 @@ > #include "un-namespace.h" > > __weak_reference(__aio_read, aio_read); > +__weak_reference(__aio_readv, aio_readv); > __weak_reference(__aio_write, aio_write); > +__weak_reference(__aio_writev, aio_writev); > __weak_reference(__aio_return, aio_return); > __weak_reference(__aio_waitcomplete, aio_waitcomplete); > __weak_reference(__aio_fsync, aio_fsync); > @@ -51,7 +53,9 @@ __weak_reference(__lio_listio, lio_listio); > typedef void (*aio_func)(union sigval val, struct aiocb *iocb); > > extern int __sys_aio_read(struct aiocb *iocb); > +extern int __sys_aio_readv(struct aiocb *iocb); > extern int __sys_aio_write(struct aiocb *iocb); > +extern int __sys_aio_writev(struct aiocb *iocb); > extern ssize_t __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout); > extern ssize_t __sys_aio_return(struct aiocb *iocb); > extern int __sys_aio_error(struct aiocb *iocb); > @@ -130,6 +134,13 @@ __aio_read(struct aiocb *iocb) > return aio_io(iocb, &__sys_aio_read); > } > > +int > +__aio_readv(struct aiocb *iocb) > +{ > + > + return aio_io(iocb, &__sys_aio_readv); > +} > + > int > __aio_write(struct aiocb *iocb) > { > @@ -137,6 +148,13 @@ __aio_write(struct aiocb *iocb) > return aio_io(iocb, &__sys_aio_write); > } > > +int > +__aio_writev(struct aiocb *iocb) > +{ > + > + return aio_io(iocb, &__sys_aio_writev); > +} > + > ssize_t > __aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout) > { > diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c > index 35bd5dc1264b..1c694ad0c18b 100644 > --- a/tests/sys/aio/aio_test.c > +++ b/tests/sys/aio/aio_test.c > @@ -1627,6 +1627,12 @@ ATF_TC_BODY(vectored_file_poll, tc) > aio_file_test(poll, NULL, true); > } > > +ATF_TC_WITHOUT_HEAD(vectored_thread); > +ATF_TC_BODY(vectored_thread, tc) > +{ > + aio_file_test(poll_signaled, setup_thread(), true); > +} > + > ATF_TC_WITH_CLEANUP(vectored_md_poll); > ATF_TC_HEAD(vectored_md_poll, tc) > { > @@ -1814,6 +1820,7 @@ ATF_TP_ADD_TCS(tp) > ATF_TP_ADD_TC(tp, vectored_zvol_poll); > ATF_TP_ADD_TC(tp, vectored_unaligned); > ATF_TP_ADD_TC(tp, vectored_socket_poll); > + ATF_TP_ADD_TC(tp, vectored_thread); > > return (atf_no_error()); > } From owner-dev-commits-src-main@freebsd.org Sun Aug 22 14:18:55 2021 Return-Path: Delivered-To: dev-commits-src-main@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 DE3BB655E52; Sun, 22 Aug 2021 14:18:55 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GsyCy6dcvz3NMk; Sun, 22 Aug 2021 14:18:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 17MEIigW062337 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 22 Aug 2021 17:18:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 17MEIigW062337 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 17MEIi0J062336; Sun, 22 Aug 2021 17:18:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 22 Aug 2021 17:18:44 +0300 From: Konstantin Belousov To: Thomas Munro Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3904e7966eb3 - main - Fix aio_readv(2), aio_writev(2) with SIGEV_THREAD. Message-ID: References: <202108221216.17MCGCC6079644@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4GsyCy6dcvz3NMk 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 [1.22 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; 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(-0.46)[-0.456]; TO_DN_SOME(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; NEURAL_SPAM_MEDIUM(0.98)[0.976]; NEURAL_SPAM_SHORT(0.70)[0.702]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 14:18:55 -0000 On Sun, Aug 22, 2021 at 05:15:22PM +0300, Konstantin Belousov wrote: > On Sun, Aug 22, 2021 at 12:16:12PM +0000, Thomas Munro wrote: > > The branch main has been updated by tmunro: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3904e7966eb353c636c6aa638a6fdf1489ee514c > > > > commit 3904e7966eb353c636c6aa638a6fdf1489ee514c > > Author: Thomas Munro > > AuthorDate: 2021-08-22 11:34:07 +0000 > > Commit: Thomas Munro > > CommitDate: 2021-08-22 11:49:23 +0000 > > > > Fix aio_readv(2), aio_writev(2) with SIGEV_THREAD. > > > > Add missing wrapper code to librt for these new functions so that > > SIGEV_THREAD works. Without machinery to convert it to SIGEV_THREAD_ID, > > you got EINVAL. > > > > Reviewed by: asomers > > MFC after: 2 weeks > > Differential Revision: https://reviews.freebsd.org/D31618 > > --- > > lib/libc/sys/Symbol.map | 2 ++ > > lib/librt/Symbol.map | 5 +++++ > > lib/librt/aio.c | 18 ++++++++++++++++++ > > tests/sys/aio/aio_test.c | 7 +++++++ > > 4 files changed, 32 insertions(+) > > > > diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map > > index 93fbc947a7e1..764d712958be 100644 > > --- a/lib/libc/sys/Symbol.map > > +++ b/lib/libc/sys/Symbol.map > > @@ -495,10 +495,12 @@ FBSDprivate_1.0 { > > __sys_aio_error; > > __sys_aio_fsync; > > __sys_aio_read; > > + __sys_aio_readv; > > __sys_aio_return; > > __sys_aio_suspend; > > __sys_aio_waitcomplete; > > __sys_aio_write; > > + __sys_aio_writev; > > _audit; > > __sys_audit; > > _auditctl; > > diff --git a/lib/librt/Symbol.map b/lib/librt/Symbol.map > > index c11b88397afd..b8fde3dd33b8 100644 > > --- a/lib/librt/Symbol.map > > +++ b/lib/librt/Symbol.map > > @@ -31,6 +31,11 @@ FBSD_1.5 { > > timer_oshandle_np; > > }; > > > > +FBSD_1.6 { > > + aio_readv; > > + aio_writev; > > +}; > This must be FBSD_1.7. No, I was wrong and the commit as is is right, assuming that the intent is to interpose libc symbols with librt functionality. Of course this is very fragile and would not work if e.g. librt is loaded after libc is linked in and symbols resolved. I fixed this (mostly) for libthr, but librt is not. > > > + > > FBSDprivate_1.0 { > > _mq_open; > > _mq_close; > > diff --git a/lib/librt/aio.c b/lib/librt/aio.c > > index 9c35644ecf3d..8e819a002613 100644 > > --- a/lib/librt/aio.c > > +++ b/lib/librt/aio.c > > @@ -42,7 +42,9 @@ > > #include "un-namespace.h" > > > > __weak_reference(__aio_read, aio_read); > > +__weak_reference(__aio_readv, aio_readv); > > __weak_reference(__aio_write, aio_write); > > +__weak_reference(__aio_writev, aio_writev); > > __weak_reference(__aio_return, aio_return); > > __weak_reference(__aio_waitcomplete, aio_waitcomplete); > > __weak_reference(__aio_fsync, aio_fsync); > > @@ -51,7 +53,9 @@ __weak_reference(__lio_listio, lio_listio); > > typedef void (*aio_func)(union sigval val, struct aiocb *iocb); > > > > extern int __sys_aio_read(struct aiocb *iocb); > > +extern int __sys_aio_readv(struct aiocb *iocb); > > extern int __sys_aio_write(struct aiocb *iocb); > > +extern int __sys_aio_writev(struct aiocb *iocb); > > extern ssize_t __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout); > > extern ssize_t __sys_aio_return(struct aiocb *iocb); > > extern int __sys_aio_error(struct aiocb *iocb); > > @@ -130,6 +134,13 @@ __aio_read(struct aiocb *iocb) > > return aio_io(iocb, &__sys_aio_read); > > } > > > > +int > > +__aio_readv(struct aiocb *iocb) > > +{ > > + > > + return aio_io(iocb, &__sys_aio_readv); > > +} > > + > > int > > __aio_write(struct aiocb *iocb) > > { > > @@ -137,6 +148,13 @@ __aio_write(struct aiocb *iocb) > > return aio_io(iocb, &__sys_aio_write); > > } > > > > +int > > +__aio_writev(struct aiocb *iocb) > > +{ > > + > > + return aio_io(iocb, &__sys_aio_writev); > > +} > > + > > ssize_t > > __aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout) > > { > > diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c > > index 35bd5dc1264b..1c694ad0c18b 100644 > > --- a/tests/sys/aio/aio_test.c > > +++ b/tests/sys/aio/aio_test.c > > @@ -1627,6 +1627,12 @@ ATF_TC_BODY(vectored_file_poll, tc) > > aio_file_test(poll, NULL, true); > > } > > > > +ATF_TC_WITHOUT_HEAD(vectored_thread); > > +ATF_TC_BODY(vectored_thread, tc) > > +{ > > + aio_file_test(poll_signaled, setup_thread(), true); > > +} > > + > > ATF_TC_WITH_CLEANUP(vectored_md_poll); > > ATF_TC_HEAD(vectored_md_poll, tc) > > { > > @@ -1814,6 +1820,7 @@ ATF_TP_ADD_TCS(tp) > > ATF_TP_ADD_TC(tp, vectored_zvol_poll); > > ATF_TP_ADD_TC(tp, vectored_unaligned); > > ATF_TP_ADD_TC(tp, vectored_socket_poll); > > + ATF_TP_ADD_TC(tp, vectored_thread); > > > > return (atf_no_error()); > > } From owner-dev-commits-src-main@freebsd.org Sun Aug 22 15:24:10 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2FFFF657136; Sun, 22 Aug 2021 15:24:10 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (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 4GszgF6Sp5z3txQ; Sun, 22 Aug 2021 15:24:09 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTP id HlK2msjTpFRDpHpKTmDPSu; Sun, 22 Aug 2021 15:24:09 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id HpKRmpPZPB9dPHpKSmLILJ; Sun, 22 Aug 2021 15:24:09 +0000 X-Authority-Analysis: v=2.4 cv=Ac10o1bG c=1 sm=1 tr=0 ts=61226c19 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=MhDmnRu9jo8A:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=sVRy8H1vAAAA:8 a=NEAV23lmAAAA:8 a=yIXMFWWi4zmPt0PzZbgA:9 a=_5RweO4AWL2MXcZC:21 a=xL1mDByAUm-bXbnJ:21 a=0wDwsOqeTLLA_pT6:21 a=CjuIK1q_8ugA:10 a=UJ0tAi3fqDAA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 a=mL5YggztzNiiHV2pp1Gt:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id D8C27A5; Sun, 22 Aug 2021 08:24:07 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 17MFO3IE002937; Sun, 22 Aug 2021 08:24:06 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202108221524.17MFO3IE002937@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: "Alexander V. Chernikov" cc: Cy Schubert , "Alexander V. Chernikov" , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: c541bd368f86 - main - lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries. In-reply-to: References: <202108211735.17LHZ0WI081502@gitrepo.freebsd.org> <202108220558.17M5wAuq003114@slippy.cwsent.com> Comments: In-reply-to "Alexander V. Chernikov" message dated "Sun, 22 Aug 2021 09:50:41 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 22 Aug 2021 08:24:03 -0700 X-CMAE-Envelope: MS4xfEWz0+rEebsuvrklaHGCX0RwiSyRbUCuvG3Rh+i3e+kyc8AQOI7WiPEdlCA+dUSpn4NYlDbhFIk0VcNrRpdAILbh6P2fvqgwc7Yy9m0gIjWoodSGihE3 kSQQAYgeMHgjVjdYxZ8mjTCrVWUPzW9DJZca2EkE4Sh/O8+7kaW9v8wu11kmi9od649JcJA0pOpO3rwdV5wKhe4MUot4Lq0BZWJtN+8aCaSkZxvZJVJPccRq x7xM2FeuDmYjYa5QfnmaR8Xi5GNdbFWLscAGLUbQj2E3wqmSCs4HyoiaZfRwruBWAhV7YJDwdYi4y+bg02TnHU2Lfiv5qhhSSGrt1uUVACs+tap79/juB4M7 XNBJqXaH X-Rspamd-Queue-Id: 4GszgF6Sp5z3txQ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 15:24:10 -0000 Thank you. This fixes it. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. In message , "Alexander V. Cherni kov" writes: > > > > On 22 Aug 2021, at 06:58, Cy Schubert = > wrote: > >=20 > > In message <202108211735.17LHZ0WI081502@gitrepo.freebsd.org = > >, "Alexander V.=20= > > > Che > > rnikov" writes: > >> The branch main has been updated by melifaro: > >>=20 > >> URL: = > https://cgit.FreeBSD.org/src/commit/?id=3Dc541bd368f863bbf5c08dd5c1ecce016= > > >> 6ad47389 > >>=20 > >> commit c541bd368f863bbf5c08dd5c1ecce0166ad47389 > >> Author: Alexander V. Chernikov > >> AuthorDate: 2021-08-21 14:13:32 +0000 > >> Commit: Alexander V. Chernikov > >> CommitDate: 2021-08-21 17:34:35 +0000 > >>=20 > >> lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 = > entries > >> . > >>=20 > >> Currently we use pre-calculated headers inside LLE entries as = > prepend dat > >> a > >> for `if_output` functions. Using these headers allows saving some > >> CPU cycles/memory accesses on the fast path. > >>=20 > >> However, this approach makes adding L2 header for IPv4 traffic = > with IPv6 > >> nexthops more complex, as it is not possible to store multiple > >> pre-calculated headers inside lle. Additionally, the solution = > space is > >> limited by the fact that PCB caching saves LLEs in addition to = > the nexth > >> op. > >>=20 > >> Thus, add support for creating special "child" LLEs for the = > purpose of ho > >> lding > >> custom family encaps and store mbufs pending resolution. To = > simplify han > >> dling > >> of those LLEs, store them in a linked-list inside a "parent" = > (e.g. norma > >> l) LLE. > >> Such LLEs are not visible when iterating LLE table. Their = > lifecycle is b > >> ound > >> to the "parent" LLE - it is not possible to delete "child" when = > parent i > >> s alive. > >> Furthermore, "child" LLEs are static (RTF_STATIC), avoding = > complex state > >> machine used by the standard LLEs. > >>=20 > >> nd6_lookup() and nd6_resolve() now accepts an additional argument, = > family > >> , > >> allowing to return such child LLEs. This change uses `LLE_SF()` = > macro wh > >> ich > >> packs family and flags in a single int field. This is done to = > simplify m > >> erging > >> back to stable/. Once this code lands, most of the cases will be = > convert > >> ed to > >> use a dedicated `family` parameter. > >>=20 > >> Differential Revision: https://reviews.freebsd.org/D31379 > >> MFC after: 2 weeks > >> --- > >> sys/net/if_ethersubr.c | 4 +- > >> sys/net/if_fwsubr.c | 4 +- > >> sys/net/if_infiniband.c | 3 +- > >> sys/net/if_llatbl.c | 70 +++++++++++- > >> sys/net/if_llatbl.h | 12 +- > >> sys/netinet/toecore.c | 2 +- > >> sys/netinet6/icmp6.c | 2 +- > >> sys/netinet6/in6.c | 5 + > >> sys/netinet6/nd6.c | 176 = > +++++++++++++++++++++++---- > >> -- > >> sys/netinet6/nd6.h | 1 + > >> sys/netinet6/nd6_nbr.c | 6 +- > >> sys/ofed/drivers/infiniband/core/ib_addr.c | 5 +- > >> 12 files changed, 241 insertions(+), 49 deletions(-) > >=20 > > This commit causes two of my machines a bit of gas. > Sorry for the breakage, should be fixed by = > f8c1b1a9296696f70ac209612a00ae0722d07ed9. > > >=20 > > Fatal trap 12: page fault while in kernel mode > > cpuid =3D 0; apic id =3D 00 > > fault virtual address =3D 0x128 > > fault code =3D supervisor read data, page not present > > instruction pointer =3D 0x20:0xffffffff806cb53d > > stack pointer =3D 0x28:0xfffffe008da1a210 > > frame pointer =3D 0x28:0xfffffe008da1a210 > > code segment =3D base 0x0, limit 0xfffff, type 0x1b > > =3D DPL 0, pres 1, long 1, def32 0, gran 1 > > processor eflags =3D interrupt enabled, resume, IOPL =3D 0 > > current process =3D 0 (bge0 taskq) > > trap number =3D 12 > > panic: page fault > > cpuid =3D 0 > > time =3D 1629610416 > > KDB: stack backtrace: > > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame=20 > > 0xfffffe008da19eb0 > > vpanic() at vpanic+0x187/frame 0xfffffe008da19f10 > > panic() at panic+0x43/frame 0xfffffe008da19f70 > > trap_fatal() at trap_fatal+0x387/frame 0xfffffe008da19fd0 > > trap_pfault() at trap_pfault+0x4f/frame 0xfffffe008da1a030 > > trap() at trap+0x26a/frame 0xfffffe008da1a140 > > calltrap() at calltrap+0x8/frame 0xfffffe008da1a140 > > --- trap 0xc, rip =3D 0xffffffff806cb53d, rsp =3D 0xfffffe008da1a210, = > rbp =3D=20 > > 0xfffffe008da1a210 --- > > __rw_rlock_int() at __rw_rlock_int+0xd/frame 0xfffffe008da1a210 > > in6_lltable_lookup() at in6_lltable_lookup+0xa7/frame = > 0xfffffe008da1a240 > > nd6_lookup() at nd6_lookup+0x4e/frame 0xfffffe008da1a270 > > pfxlist_onlink_check() at pfxlist_onlink_check+0xfb/frame = > 0xfffffe008da1a310 > > nd6_ra_input() at nd6_ra_input+0x147f/frame 0xfffffe008da1a5d0 > > icmp6_input() at icmp6_input+0x685/frame 0xfffffe008da1a7b0 > > ip6_input() at ip6_input+0xa9a/frame 0xfffffe008da1a890 > > netisr_dispatch_src() at netisr_dispatch_src+0xca/frame = > 0xfffffe008da1a8e0 > > ether_demux() at ether_demux+0x138/frame 0xfffffe008da1a910 > > ether_nh_input() at ether_nh_input+0x34e/frame 0xfffffe008da1a970 > > netisr_dispatch_src() at netisr_dispatch_src+0xca/frame = > 0xfffffe008da1a9c0 > > ether_input() at ether_input+0x69/frame 0xfffffe008da1aa20 > > if_input() at if_input+0xa/frame 0xfffffe008da1aa30 > > bge_rxeof() at bge_rxeof+0x4dc/frame 0xfffffe008da1aab0 > > bge_intr_task() at bge_intr_task+0x1a7/frame 0xfffffe008da1ab00 > > taskqueue_run_locked() at taskqueue_run_locked+0x191/frame=20 > > 0xfffffe008da1ab80 > > taskqueue_thread_loop() at taskqueue_thread_loop+0xc3/frame=20 > > 0xfffffe008da1abb0 > > fork_exit() at fork_exit+0x8a/frame 0xfffffe008da1abf0 > > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe008da1abf0 > > --- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- > > Uptime: 1m18s > > Dumping 511 out of 7972 = > MB:..4%..13%..22%..32%..41%..51%..63%..72%..82%..91% > > ---<>--- > > Copyright (c) 1992-2021 The FreeBSD Project. > > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, = > 1994 > > The Regents of the University of California. All rights = > reserved. > > FreeBSD is a registered trademark of The FreeBSD Foundation. > > FreeBSD 14.0-CURRENT #85 komquats-n248853-efa24221b032: Sat Aug 21 = > 20:41:37=20 > > PDT 2021 > > root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64 > > FreeBSD clang version 12.0.1 (git@github.com = > :llvm/llvm-project.git=20 > > llvmorg-12.0.1-0-gfed41342a82f) > > VT(vga): text 80x25 > > module_register: cannot register tmpfs from kernel; already loaded = > from=20 > > tmpfs.ko > > Module tmpfs failed to register: 17 > > CPU: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz (2294.83-MHz K8-class = > CPU) > > Origin=3D"GenuineIntel" Id=3D0x206a7 Family=3D0x6 Model=3D0x2a = > Stepping=3D7 > > = > Features=3D0xbfebfbff ,M > > CA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> > > = > Features2=3D0x1dbae3bf CX > > = > 16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,XSAVE,OSXSAVE,AVX> > > AMD Features=3D0x28100800 > > AMD Features2=3D0x1 > > XSAVE Features=3D0x1 > > VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID > > TSC: P-state invariant, performance statistics > > real memory =3D 8589934592 (8192 MB) > > avail memory =3D 8082354176 (7707 MB) > > Event timer "LAPIC" quality 600 > > ACPI APIC Table: > > FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs > > FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 hardware threads > > random: unblocking device. > > ioapic0 irqs 0-23 > > Launching APs: 1 3 2 > > Timecounter "TSC-low" frequency 1147416650 Hz quality 1000 > > random: entropy device external interface > > kbd1 at kbdmux0 > > vtvga0: > > aesni0: No AES or SHA support. > > acpi0: > > acpi0: Power Button (fixed) > > cpu0: on acpi0 > > hpet0: iomem 0xfed00000-0xfed003ff on = > acpi0 > > Timecounter "HPET" frequency 14318180 Hz quality 950 > > Event timer "HPET" frequency 14318180 Hz quality 550 > > Event timer "HPET1" frequency 14318180 Hz quality 440 > > Event timer "HPET2" frequency 14318180 Hz quality 440 > > Event timer "HPET3" frequency 14318180 Hz quality 440 > > Event timer "HPET4" frequency 14318180 Hz quality 440 > > atrtc0: port 0x70-0x77 irq 8 on acpi0 > > atrtc0: Warning: Couldn't map I/O. > > atrtc0: registered as a time-of-day clock, resolution 1.000000s > > Event timer "RTC" frequency 32768 Hz quality 0 > > attimer0: port 0x40-0x43,0x50-0x53 irq 0 on acpi0 > > Timecounter "i8254" frequency 1193182 Hz quality 0 > > Event timer "i8254" frequency 1193182 Hz quality 100 > > Timecounter "ACPI-fast" frequency 3579545 Hz quality 900 > > acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0 > > acpi_ec0: port 0x62,0x66 on acpi0 > > pcib0: port 0xcf8-0xcff on acpi0 > > pci0: on pcib0 > > vgapci0: port 0x2000-0x203f mem=20 > > 0xf0000000-0xf03fffff,0xe0000000-0xefffffff irq 16 at device 2.0 on = > pci0 > > vgapci0: Boot video device > > pci0: at device 22.0 (no driver attached) > > ehci0: mem = > 0xf060a000-0xf060a3ff=20 > > irq 16 at device 26.0 on pci0 > > usbus0: EHCI version 1.0 > > usbus0 on ehci0 > > usbus0: 480Mbps High Speed USB v2.0 > > hdac0: mem 0xf0600000-0xf0603fff = > irq 22=20 > > at device 27.0 on pci0 > > pcib1: irq 16 at device 28.0 on pci0 > > pci1: on pcib1 > > pcib2: irq 17 at device 28.1 on pci0 > > pci2: on pcib2 > > iwn0: mem 0xf0500000-0xf0501fff irq = > 17 at=20 > > device 0.0 on pci2 > > pcib3: irq 19 at device 28.3 on pci0 > > pci3: on pcib3 > > bge0: mem=20 > > 0xf0400000-0xf040ffff,0xf0410000-0xf041ffff irq 19 at device 0.0 on = > pci3 > > bge0: CHIP ID 0x57785100; ASIC REV 0x57785; CHIP REV 0x577851; PCI-E > > miibus0: on bge0 > > brgphy0: PHY 1 on miibus0 > > brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT,=20= > > > 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto, auto-flow > > <6>bge0: Using defaults for TSO: 65518/35/2048 > > <6>bge0: Ethernet address: 20:6a:8a:72:03:17 > > sdhci_pci0: mem=20 > > 0xf0420000-0xf042ffff irq 16 at device 0.1 on pci3 > > sdhci_pci0: 1 slot(s) allocated > > ehci1: mem = > 0xf0609000-0xf06093ff=20 > > irq 23 at device 29.0 on pci0 > > usbus1: EHCI version 1.0 > > usbus1 on ehci1 > > usbus1: 480Mbps High Speed USB v2.0 > > isab0: at device 31.0 on pci0 > > isa0: on isab0 > > ahci0: port=20 > > 0x2088-0x208f,0x2094-0x2097,0x2080-0x2087,0x2090-0x2093,0x2060-0x207f = > mem=20 > > 0xf0608000-0xf06087ff irq 19 at device 31.2 on pci0 > > ahci0: AHCI v1.30 with 6 6Gbps ports, Port Multiplier not supported > > ahcich0: at channel 0 on ahci0 > > ahcich1: at channel 1 on ahci0 > > ahcich5: at channel 5 on ahci0 > > ahciem0: on ahci0 > > ichsmb0: port 0xefa0-0xefbf mem=20= > > > 0xf0604000-0xf06040ff irq 18 at device 31.3 on pci0 > > acpi_lid0: on acpi0 > > acpi_button0: on acpi0 > > acpi_tz0: on acpi0 > > acpi_tz1: on acpi0 > > atkbdc0: port 0x60,0x64 irq 1 on acpi0 > > atkbd0: irq 1 on atkbdc0 > > kbd0 at atkbd0 > > atkbd0: [GIANT-LOCKED] > > psm0: irq 12 on atkbdc0 > > psm0: [GIANT-LOCKED] > > WARNING: Device "psm" is Giant locked and may be deleted before = > FreeBSD=20 > > 14.0. > > psm0: model Synaptics Touchpad, device ID 0 > > acpi_acad0: on acpi0 > > battery0: on acpi0 > > vga0: at port 0x3c0-0x3df iomem 0xa0000-0xbffff = > pnpid=20 > > PNP0900 on isa0 > > ata0: at port 0x1f0-0x1f7,0x3f6 irq 14 on isa0 > > ata1: at port 0x170-0x177,0x376 irq 15 on isa0 > > acpi_perf0: on cpu0 > > acpi_throttle0: on cpu0 > > coretemp0: on cpu0 > > acpi_throttle1: failed to attach P_CNT > > device_attach: acpi_throttle1 attach returned 6 > > acpi_throttle2: failed to attach P_CNT > > device_attach: acpi_throttle2 attach returned 6 > > acpi_throttle3: failed to attach P_CNT > > device_attach: acpi_throttle3 attach returned 6 > > module_register_init: MOD_LOAD (tmpfs, 0xffffffff807a2760,=20 > > 0xffffffff80c88540) error 17 > > Timecounters tick every 10.000 msec > > ZFS filesystem version: 5 > > ZFS storage pool version: features support (5000) > > IP Filter: v5.1.2 initialized. Default =3D pass all, Logging =3D = > enabled > > hdacc0: at cad 0 on hdac0 > > hdaa0: at nid 1 on hdacc0 > > pcm0: at nid 20,33 and 27 on = > hdaa0 > > pcm1: at nid 24 on hdaa0 > > hdacc1: at cad 3 on hdac0 > > hdaa1: at nid 1 on hdacc1 > > pcm2: at nid 5 on hdaa1 > > smbus0: on ichsmb0 > > smb0: on smbus0 > > sysctl_unregister_oid: failed(22) to unregister sysctl(tmpfs) > > ugen1.1: at usbus1 > > ugen0.1: at usbus0 > > uhub0 on usbus1 > > Trying to mount root from ufs:/dev/ufs/Sroot [rw]... > > Root mount waiting for: usbus0 usbus1 CAM > > uhub1 on usbus0 > > uhub1: on = > usbus0 > > uhub0: on = > usbus1 > > ses0 at ahciem0 bus 0 scbus3 target 0 lun 0 > > ses0: SEMB S-E-S 2.00 device > > ses0: SEMB SES Device > > ada0 at ahcich0 bus 0 scbus0 target 0 lun 0 > > ada0: ATA8-ACS SATA 3.x device > > ada0: Serial Number JR1000D33969RE > > ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) > > ada0: Command Queueing enabled > > ada0: 953869MB (1953525168 512 byte sectors) > > ses0: pass0,ada0 in 'Slot 00', SATA Slot: scbus0 target 0 > > ses0: pass1,cd0 in 'Slot 01', SATA Slot: scbus1 target 0 > > cd0 at ahcich1 bus 0 scbus1 target 0 lun 0 > > cd0: Removable CD-ROM SCSI device > > cd0: Serial Number SBB5103801 > > cd0: 150.000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO = > 8192bytes) > > cd0: Attempt to query device size failed: NOT READY, Medium not = > present -=20 > > tray closed > > uhub1: 2 ports with 2 removable, self powered > > uhub0: 2 ports with 2 removable, self powered > > Root mount waiting for: usbus0 usbus1 > > ugen0.2: at usbus0 > > uhub2 on uhub1 > > uhub2: 2> on=20 > > usbus0 > > ugen1.2: at usbus1 > > uhub3 on uhub0 > > uhub3: 2> on=20 > > usbus1 > > Root mount waiting for: usbus0 usbus1 > > uhub3: 6 ports with 6 removable, self powered > > uhub2: 6 ports with 6 removable, self powered > > ugen1.3: at usbus1 > > uhub4 on uhub3 > > uhub4: on = > usbus1 > > ugen0.3: at usbus0 > > uhub5 on uhub2 > > uhub5: on=20= > > > usbus0 > > Root mount waiting for: usbus0 usbus1 > > uhub4: 4 ports with 4 removable, self powered > > uhub5: 4 ports with 4 removable, self powered > > ugen1.4: at usbus1 > > ukbd0 on uhub4 > > ukbd0: on = > usbus1 > > kbd2 at ukbd0 > > ums0 on uhub4 > > ums0: on = > usbus1 > > ums0: 16 buttons and [XYZT] coordinates ID=3D2 > > ugen0.4: at usbus0 > > uhub6 on uhub5 > > uhub6: on=20= > > > usbus0 > > Root mount waiting for: usbus0 usbus1 > > ugen1.5: at usbus1 > > ukbd1 on uhub4 > > ukbd1: on=20= > > > usbus1 > > kbd3 at ukbd1 > > uhub6: 4 ports with 4 removable, self powered > > ugen0.5: at usbus0 > > umass0 on uhub6 > > umass0: on = > usbus0 > > umass0: SCSI over Bulk-Only; quirks =3D 0x4100 > > umass0:6:0: Attached to scbus6 > > Root mount waiting for: usbus0 CAM > > da0 at umass-sim0 bus 0 scbus6 target 0 lun 0 > > da0: Fixed Direct Access SCSI device > > da0: 40.000MB/s transfers > > da0: 76351MB (156368016 512 byte sectors) > > da0: quirks=3D0x2 > > ugen0.6: at usbus0 > > umass1 on uhub6 > > umass1: = > on=20 > > usbus0 > > umass1: SCSI over Bulk-Only; quirks =3D 0x408c > > umass1:7:1: Attached to scbus7 > > da1 at umass-sim1 bus 1 scbus7 target 0 lun 0 > > da1: Fixed Direct Access SCSI device > > da1: 40.000MB/s transfers > > da1: 76319MB (156301488 512 byte sectors) > > da1: quirks=3D0x2 > > ugen0.7: at usbus0 > > umass2 on uhub5 > > umass2: = > on=20 > > usbus0 > > umass2: SCSI over Bulk-Only; quirks =3D 0x4101 > > umass2:8:2: Attached to scbus8 > > da2 at umass-sim2 bus 2 scbus8 target 0 lun 0 > > da2: < Flash Disk 8.07> Removable Direct Access SCSI-2 device > > da2: Serial Number 029B4D84 > > da2: 40.000MB/s transfers > > da2: 246MB (504320 512 byte sectors) > > da2: quirks=3D0x2 > > Root mount waiting for: usbus0 > > ugen0.8: at usbus0 > > mountroot: waiting for device /dev/ufs/Sroot... > > WARNING: / was not properly dismounted > > WARNING: /: mount pending error: blocks 24 files 0 > > <118>Setting hostuuid: 34f5ed40-8938-11da-b265-efe316da850d. > > <118>Setting hostid: 0x7f5a03b9. > > <118>Starting file system checks: > > <118>** SU+J Recovering /dev/ufs/Sroot > > <118>** Reading 16777216 byte journal from inode 4. > > <118>** Building recovery table. > > <118>** Resolving unreferenced inode list. > > <118>** Processing journal entries. > > <118>** 7 journal records in 1536 bytes for 14.58% utilization > > <118>** Freed 1 inodes (0 dirs) 0 blocks, and 3 frags. > > <118> > > <118>***** FILE SYSTEM MARKED CLEAN ***** > > <118>** SU+J Recovering /dev/ufs/Svar > > <118>** Reading 16777216 byte journal from inode 4. > > <118>** Building recovery table. > > <118>** Resolving unreferenced inode list. > > <118>** Processing journal entries. > > <118>** SU+J Recovering /dev/ufs/Susr > > <118>** Reading 25165824 byte journal from inode 4. > > <118>** 40 journal records in 4096 bytes for 31.25% utilization > > <118>** Freed 0 inodes (0 dirs) 0 blocks, and 0 frags. > > <118> > > <118>***** FILE SYSTEM MARKED CLEAN ***** > > <118>** Building recovery table. > > <118>** Resolving unreferenced inode list. > > <118>** Processing journal entries. > > <118> > > <118>***** FILE SYSTEM MARKED CLEAN ***** > > <118>/dev/ada0s3a: 7535 files, 131352 used, 376431 free (1135 frags, = > 46912=20 > > blocks, 0.2% fragmentation) > > <118>/dev/ada0s3e: 24573 files, 319053 used, 442234 free (1082 frags, = > 55144=20 > > blocks, 0.1% fragmentation) > > <118>/dev/ada0s3d: 22537 files, 105401 used, 402382 free (270 frags, = > 50264=20 > > blocks, 0.1% fragmentation) > > <118>/dev/ada0s3f: 18331 files, 109447 used, 398336 free (576 frags, = > 49720=20 > > blocks, 0.1% fragmentation) > > <118>/dev/ada0s3h: 22924 files, 188609 used, 572677 free (685 frags, = > 71499=20 > > blocks, 0.1% fragmentation) > > <118>/dev/ada0s3g: 5348 files, 49444 used, 458339 free (275 frags, = > 57258=20 > > blocks, 0.1% fragmentation) > > <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk3p1 > > <118>** Reading 33554432 byte journal from inode 4. > > <118>** Building recovery table. > > <118>** Resolving unreferenced inode list. > > <118>** Processing journal entries. > > <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk0s1a > > <118>** Reading 16777216 byte journal from inode 827. > > <118> > > <118>***** FILE SYSTEM MARKED CLEAN ***** > > <118>** Building recovery table. > > <118>** Resolving unreferenced inode list. > > <118>** Processing journal entries. > > <118> > > <118>***** FILE SYSTEM MARKED CLEAN ***** > > <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk0s1d > > <118>** Reading 16777216 byte journal from inode 117. > > <118>** Building recovery table. > > <118>** Resolving unreferenced inode list. > > <118>** Processing journal entries. > > <118> > > <118>***** FILE SYSTEM MARKED CLEAN ***** > > <118>** SU+J Recovering /dev/zvol/tank/VMs/current/amd64/disk0s1e > > <118>** Reading 33554432 byte journal from inode 16. > > <118>** Building recovery table. > > <118>** Resolving unreferenced inode list. > > <118>** Processing journal entries. > > <118> > > <118>***** FILE SYSTEM MARKED CLEAN ***** > > <118>/dev/msdosfs/SHARED: 435 files, 6.2 GiB free (203709 clusters) > > <118>FIXED > > <118>/dev/msdosfs/SHARED: MARKING FILE SYSTEM CLEAN > > <118>/dev/zvol/tank/VMs/current/i386/disk0s1a: 114555 files, 255948 = > used,=20 > > 251835 free (403 frags, 31429 blocks, 0.1% fragmentation) > > <118>/dev/zvol/tank/VMs/current/i386/disk0s1d: 22759 files, 126960 = > used,=20 > > 380823 free (143 frags, 47585 blocks, 0.0% fragmentation) > > <118>/dev/zvol/tank/VMs/current/i386/disk0s1e: 28564 files, 549004 = > used,=20 > > 973507 free (1603 frags, 121488 blocks, 0.1% fragmentation) > > <118>Mounting local filesystems:. > > <118>Mounting ZFS filesystems: (193/193) > > <118>Local package initialization:error: ed0: No such device exists=20 > > (BIOCSETIF failed: Device not configured) > > <118>Unable to read the configuration file: No such file or directory = > at=20 > > /usr/local/lib/perl5/site_perl/Jail.pm line 50. > > <118>Compilation failed in require at /usr/local/sbin/jailadmin line = > 13. > > <118>BEGIN failed--compilation aborted at /usr/local/sbin/jailadmin = > line 13. > > <118> Jails. > > <118>Autoloading module: acpi_wmi > > acpi_wmi0: on acpi0 > > acpi_wmi0: Embedded MOF found > > ACPI: \_SB.AMWA.WQEE: 1 arguments were passed to a non-method ACPI = > object=20 > > (Buffer) (20210730/nsarguments-361) > > acpi_wmi1: on acpi0 > > acpi_wmi1: Embedded MOF found > > ACPI: \_SB.AMW0.WQDD: 1 arguments were passed to a non-method ACPI = > object=20 > > (Buffer) (20210730/nsarguments-361) > > <118>Updating CPU Microcode... > > CPU: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz (2294.83-MHz K8-class = > CPU) > > Origin=3D"GenuineIntel" Id=3D0x206a7 Family=3D0x6 Model=3D0x2a = > Stepping=3D7 > > = > Features=3D0xbfebfbff ,M > > CA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> > > = > Features2=3D0x1dbae3bf CX > > = > 16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,XSAVE,OSXSAVE,AVX> > > AMD Features=3D0x28100800 > > AMD Features2=3D0x1 > > Structured Extended = > Features3=3D0x9c000400 > > XSAVE Features=3D0x1 > > VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID > > TSC: P-state invariant, performance statistics > > <118>Done. > > <118>ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib=20= > > > /usr/local/lib/compat/pkg /usr/local/krb5/lib /usr/local/kde4/lib=20 > > /usr/local/dt/lib /usr/local/lib/compat/pkg /usr/local/lib/dovecot=20 > > /usr/local/lib/e2fsprogs /usr/local/lib/expect5.45.4=20 > > /usr/local/lib/freeradius-3.0.23 /usr/local/lib/gcc10 = > /usr/local/lib/gcc11=20 > > /usr/local/lib/gcc12 /usr/local/lib/gcc8 /usr/local/lib/gcc9=20 > > /usr/local/lib/graphviz /usr/local/lib/httrack /usr/local/lib/itcl3.4=20= > > > /usr/local/lib/mysql /usr/local/lib/mysql/plugin = > /usr/local/lib/opencollada=20 > > /usr/local/lib/perl5/5.30/mach/CORE = > /usr/local/lib/perl5/5.32/mach/CORE=20 > > /usr/local/lib/perl5/5.34/mach/CORE /usr/local/lib/pidgin=20 > > /usr/local/lib/pth /usr/local/lib/qt5 /usr/local/lib/samba4=20 > > /usr/local/lib/xrdp /usr/local/libexec/openldap = > /usr/local/llvm-devel/lib=20 > > /usr/local/llvm10/lib /usr/local/llvm11/lib /usr/local/llvm12/lib=20 > > /usr/local/llvm70/lib /usr/local/llvm80/lib /usr/local/llvm90/lib=20 > > /usr/local/share/chromium > > <118>32-bit compatibility ldconfig path: /usr/lib32=20 > > /alt/i386/root/usr/local/lib > > <118>Setting hostname: slippy. > > <118>Setting up harvesting: = > [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER > > ],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED > > <118>Feeding entropy: . > > <118>Starting ippool. > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>70018:add pool node(252.0.0.1/255.255.255.255: node entry already=20= > > > present in pool > > <118>Additional TCP/IP options: rfc1323 extensions=3DNO. > > <118>Enabling ipfilter. > > <118>Installing NAT rules. > > <118>0 entries flushed from NAT table > > <118>0 entries flushed from NAT list > > <118>Starting ipmon. > > <6>wlan0: Ethernet address: 20:6a:8a:72:03:17 > > <118>Created wlan(4) interfaces: wlan0. > > <6>bridge0: Ethernet address: 58:9c:fc:10:ff:c8 > > <118>Created clone interfaces: lagg0 bridge0. > > <6>lo0: link state changed to UP > > <6>bge0: link state changed to DOWN > > iwn0: iwn_read_firmware: ucode rev=3D0x12a80601 > > <118>Starting wpa_supplicant. > > <6>lagg0: link state changed to DOWN > > <6>lagg0: IPv6 addresses on wlan0 have been removed before adding it = > as a=20 > > member to prevent IPv6 address scope violation. > > iwn0: iwn_read_firmware: ucode rev=3D0x12a80601 > > <6>wlan0: link state changed to UP > > <6>lagg0: link state changed to UP > > <6>bge0: link state changed to UP > >=20 > >=20 > > Fatal trap 12: page fault while in kernel mode > > cpuid =3D 0; apic id =3D 00 > > fault virtual address =3D 0x128 > > fault code =3D supervisor read data, page not present > > instruction pointer =3D 0x20:0xffffffff806cb53d > > stack pointer =3D 0x28:0xfffffe00831a3210 > > frame pointer =3D 0x28:0xfffffe00831a3210 > > code segment =3D base 0x0, limit 0xfffff, type 0x1b > > =3D DPL 0, pres 1, long 1, def32 0, gran 1 > > processor eflags =3D interrupt enabled, resume, IOPL =3D 0 > > current process =3D 0 (bge0 taskq) > > trap number =3D 12 > > panic: page fault > > cpuid =3D 0 > > time =3D 1629610531 > > KDB: stack backtrace: > > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame=20 > > 0xfffffe00831a2eb0 > > vpanic() at vpanic+0x187/frame 0xfffffe00831a2f10 > > panic() at panic+0x43/frame 0xfffffe00831a2f70 > > trap_fatal() at trap_fatal+0x387/frame 0xfffffe00831a2fd0 > > trap_pfault() at trap_pfault+0x4f/frame 0xfffffe00831a3030 > > trap() at trap+0x26a/frame 0xfffffe00831a3140 > > calltrap() at calltrap+0x8/frame 0xfffffe00831a3140 > > --- trap 0xc, rip =3D 0xffffffff806cb53d, rsp =3D 0xfffffe00831a3210, = > rbp =3D=20 > > 0xfffffe00831a3210 --- > > __rw_rlock_int() at __rw_rlock_int+0xd/frame 0xfffffe00831a3210 > > in6_lltable_lookup() at in6_lltable_lookup+0xa7/frame = > 0xfffffe00831a3240 > > nd6_lookup() at nd6_lookup+0x4e/frame 0xfffffe00831a3270 > > pfxlist_onlink_check() at pfxlist_onlink_check+0xfb/frame = > 0xfffffe00831a3310 > > nd6_ra_input() at nd6_ra_input+0x147f/frame 0xfffffe00831a35d0 > > icmp6_input() at icmp6_input+0x685/frame 0xfffffe00831a37b0 > > ip6_input() at ip6_input+0xa9a/frame 0xfffffe00831a3890 > > netisr_dispatch_src() at netisr_dispatch_src+0xca/frame = > 0xfffffe00831a38e0 > > ether_demux() at ether_demux+0x138/frame 0xfffffe00831a3910 > > ether_nh_input() at ether_nh_input+0x34e/frame 0xfffffe00831a3970 > > netisr_dispatch_src() at netisr_dispatch_src+0xca/frame = > 0xfffffe00831a39c0 > > ether_input() at ether_input+0x69/frame 0xfffffe00831a3a20 > > if_input() at if_input+0xa/frame 0xfffffe00831a3a30 > > bge_rxeof() at bge_rxeof+0x4dc/frame 0xfffffe00831a3ab0 > > bge_intr_task() at bge_intr_task+0x1a7/frame 0xfffffe00831a3b00 > > taskqueue_run_locked() at taskqueue_run_locked+0x191/frame=20 > > 0xfffffe00831a3b80 > > taskqueue_thread_loop() at taskqueue_thread_loop+0xc3/frame=20 > > 0xfffffe00831a3bb0 > > fork_exit() at fork_exit+0x8a/frame 0xfffffe00831a3bf0 > > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00831a3bf0 > > --- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- > > Uptime: 1m28s > > Dumping 512 out of 7972 = > MB:..4%..13%..22%..32%..41%..54%..63%..72%..82%..91% > >=20 > > __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 > > 55 __asm("movq %%gs:%P1,%0" : "=3Dr" (td) : "n" = > (offsetof(struct pcpu, > > (kgdb) bt > > #0 __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 > > #1 doadump (textdump=3Dtextdump@entry=3D1) at = > /opt/src/git-src/sys/kern/kern_sh > > utdown.c:399 > > #2 0xffffffff806cf9ab in kern_reboot (howto=3D260) at=20 > > /opt/src/git-src/sys/kern/kern_shutdown.c:486 > > #3 0xffffffff806cfe26 in vpanic (fmt=3D0xffffffff80a94e2f "%s",=20 > > ap=3D) at /opt/src/git-src/sys/kern/kern_shutdown.c:919 > > #4 0xffffffff806cfc23 in panic (fmt=3D) at=20 > > /opt/src/git-src/sys/kern/kern_shutdown.c:843 > > #5 0xffffffff80a342c7 in trap_fatal (frame=3D0xfffffe00831a3150, = > eva=3D296) at=20 > > /opt/src/git-src/sys/amd64/amd64/trap.c:946 > > #6 0xffffffff80a3431f in trap_pfault = > (frame=3Dframe@entry=3D0xfffffe00831a3150, > > usermode=3Dfalse, signo=3D, signo@entry=3D0x0, = > ucode=3D > out>, ucode@entry=3D0x0) at = > /opt/src/git-src/sys/amd64/amd64/trap.c:765 > > #7 0xffffffff80a3399a in trap (frame=3D0xfffffe00831a3150) at=20 > > /opt/src/git-src/sys/amd64/amd64/trap.c:443 > > #8 > > #9 __rw_rlock_int (rw=3D0x110) at = > /opt/src/git-src/sys/kern/kern_rwlock.c:679 > > #10 0xffffffff8087cd07 in in6_lltable_lookup (llt=3D,=20= > > > flags=3D, l3addr=3D) at = > /opt/src/git-src/sys/netin > > et6/in6.c:2349 > > #11 0xffffffff80897dae in lla_lookup (llt=3D0x110, flags=3D2374593664,=20= > > > flags@entry=3D0, l3addr=3D0xfffffe00831a3250) at = > /opt/src/git-src/sys/net/if_lla > > tbl.h:261 > > #12 nd6_lookup (addr6=3D, flags=3D-1920373632, = > flags@entry=3D0,=20 > > ifp=3D) at /opt/src/git-src/sys/netinet6/nd6.c:1204 > > #13 0xffffffff8089ff7b in find_pfxlist_reachable_router=20 > > (pr=3D0xfffff8002b64f100) at = > /opt/src/git-src/sys/netinet6/nd6_rtr.c:1817 > > #14 pfxlist_onlink_check () at = > /opt/src/git-src/sys/netinet6/nd6_rtr.c:1861 > > #15 0xffffffff8089fc5f in nd6_ra_input (m=3D,=20 > > m@entry=3D0xfffff8003a3e1d00, off=3D, = > icmp6len=3D,=20 > > icmp6len@entry=3D48) at /opt/src/git-src/sys/netinet6/nd6_rtr.c:597 > > #16 0xffffffff80874aa5 in icmp6_input (mp=3D0xfffffe00831a37f8,=20 > > offp=3D0xfffffe00831a37f0, proto=3D) at=20 > > /opt/src/git-src/sys/netinet6/icmp6.c:780 > > #17 0xffffffff8088beca in ip6_input (m=3D0xfffff8003a3e1d00) at=20 > > /opt/src/git-src/sys/netinet6/ip6_input.c:929 > > #18 0xffffffff80806d6a in netisr_dispatch_src (proto=3D6, = > source=3D > out>, source@entry=3D0, m=3D0x0) at = > /opt/src/git-src/sys/net/netisr.c:1143 > > #19 0xffffffff8080704f in netisr_dispatch (proto=3D272, m=3D0x10) at=20= > > > /opt/src/git-src/sys/net/netisr.c:1234 > > #20 0xffffffff807f3d58 in ether_demux = > (ifp=3Difp@entry=3D0xfffff8003a30e800,=20 > > m=3D0xfffffe008d896c80) at /opt/src/git-src/sys/net/if_ethersubr.c:925 > > #21 0xffffffff807f50fe in ether_input_internal = > (ifp=3D0xfffff8003a30e800,=20 > > m=3D0xfffffe008d896c80) at /opt/src/git-src/sys/net/if_ethersubr.c:711 > > #22 ether_nh_input (m=3D) at = > /opt/src/git-src/sys/net/if_ethers > > ubr.c:741 > > #23 0xffffffff80806d6a in netisr_dispatch_src (proto=3Dproto@entry=3D5,=20= > > > source=3D, source@entry=3D0, m=3D0x0, = > m@entry=3D0xfffff8003a3e1d00)=20 > > at /opt/src/git-src/sys/net/netisr.c:1143 > > #24 0xffffffff8080704f in netisr_dispatch (proto=3D272, proto@entry=3D5,= > =20 > > m=3D0x10, m@entry=3D0xfffff8003a3e1d00) at = > /opt/src/git-src/sys/net/netisr.c:123 > > 4 > > #25 0xffffffff807f41a9 in ether_input (ifp=3D,=20 > > m=3D0xfffff8003a3e1d00) at /opt/src/git-src/sys/net/if_ethersubr.c:832 > > #26 0xffffffff807f042a in if_input (ifp=3D0x110, = > ifp@entry=3D0xfffff8000516b800, > > sendmp=3D0xfffffe008d896c80, sendmp@entry=3D0xfffff8003a3e1d00) at=20 > > /opt/src/git-src/sys/net/if.c:4444 > > #27 0xffffffff818eaabc in bge_rxeof (sc=3D,=20 > > sc@entry=3D0xfffffe00107d0000, rx_prod=3Drx_prod@entry=3D2,=20 > > holdlck=3Dholdlck@entry=3D0) at = > /opt/src/git-src/sys/dev/bge/if_bge.c:4436 > > #28 0xffffffff818e7d57 in bge_intr_task (arg=3D0xfffffe00107d0000,=20 > > pending=3D) at = > /opt/src/git-src/sys/dev/bge/if_bge.c:4666 > > #29 0xffffffff80731d81 in taskqueue_run_locked = > (queue=3Dqueue@entry=3D0xfffff800 > > 03890600) at /opt/src/git-src/sys/kern/subr_taskqueue.c:476 > > #30 0xffffffff80733073 in taskqueue_thread_loop (arg=3D out>,=20 > > arg@entry=3D0xfffffe00107d7568) at = > /opt/src/git-src/sys/kern/subr_taskqueue.c: > > 793 > > #31 0xffffffff8068b80a in fork_exit (callout=3D0xffffffff80732fb0=20 > > , arg=3D0xfffffe00107d7568, = > frame=3D0xfffffe00831a3c00)=20 > > at /opt/src/git-src/sys/kern/kern_fork.c:1087 > > #32 > > (kgdb) frame 9 > > #9 __rw_rlock_int (rw=3D0x110) at = > /opt/src/git-src/sys/kern/kern_rwlock.c:679 > > 679 v =3D RW_READ_VALUE(rw); > > (kgdb) l > > 674 KASSERT(rw_wowner(rw) !=3D td, > > 675 ("rw_rlock: wlock already held for %s @ %s:%d", > > 676 rw->lock_object.lo_name, file, line)); > > 677 WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, = > line, NULL); > > 678=09 > > 679 v =3D RW_READ_VALUE(rw); > > 680 if = > (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || > > 681 !__rw_rlock_try(rw, td, &v, true = > LOCK_FILE_LINE_ARG))) > > 682 __rw_rlock_hard(rw, td, v LOCK_FILE_LINE_ARG); > > 683 else > > (kgdb) p rw > > $1 =3D (struct rwlock *) 0x110 > > (kgdb) frame 10 > > #10 0xffffffff8087cd07 in in6_lltable_lookup (llt=3D,=20= > > > flags=3D, l3addr=3D) at = > /opt/src/git-src/sys/netin > > et6/in6.c:2349 > > 2349 LLE_RLOCK(lle); > > (kgdb) l > > 2344 return (lle); > > 2345=09 > > 2346 if (flags & LLE_EXCLUSIVE) > > 2347 LLE_WLOCK(lle); > > 2348 else > > 2349 LLE_RLOCK(lle); > > 2350=09 > > 2351 /* > > 2352 * If the afdata lock is not held, the LLE may have bee > n = > unlinked=20 > > while > > 2353 * we were blocked on the LLE lock. Check for this = > case. > > (kgdb) p lle > > $2 =3D (struct llentry *) 0x0 > > (kgdb)=20 > >=20 > >=20 > >=20 > > --=20 > > Cheers, > > Cy Schubert > > > FreeBSD UNIX: > Web: = > https://FreeBSD.org > > NTP: > Web: = > https://nwtime.org > >=20 > > The need of the many outweighs the greed of the few. From owner-dev-commits-src-main@freebsd.org Sun Aug 22 16:20:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E7A16657B31; Sun, 22 Aug 2021 16:20:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gt0wj5zsBz4hM8; Sun, 22 Aug 2021 16:20:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5C8A23E2B; Sun, 22 Aug 2021 16:20:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17MGKr9d007087; Sun, 22 Aug 2021 16:20:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17MGKrfp007086; Sun, 22 Aug 2021 16:20:53 GMT (envelope-from git) Date: Sun, 22 Aug 2021 16:20:53 GMT Message-Id: <202108221620.17MGKrfp007086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 614faa32691b - main - vfs: fix cache-relatecd LOR introduced in the previous change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 614faa32691bf9ccd2690624ad37470e08fd14d3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 16:20:54 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=614faa32691bf9ccd2690624ad37470e08fd14d3 commit 614faa32691bf9ccd2690624ad37470e08fd14d3 Author: Mateusz Guzik AuthorDate: 2021-08-22 16:17:42 +0000 Commit: Mateusz Guzik CommitDate: 2021-08-22 16:20:07 +0000 vfs: fix cache-relatecd LOR introduced in the previous change Reported by: kib Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/kern/vfs_mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 166d7336eaf1..6804f6eb68bf 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1212,10 +1212,10 @@ vfs_domount_first( MNT_IUNLOCK(mp); VI_LOCK(vp); - cache_purge(vp); vn_irflag_set_locked(vp, VIRF_MOUNTPOINT); vp->v_mountedhere = mp; VI_UNLOCK(vp); + cache_purge(vp); /* * We need to lock both vnodes. From owner-dev-commits-src-main@freebsd.org Sun Aug 22 17:44:39 2021 Return-Path: Delivered-To: dev-commits-src-main@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 86EA1659D7C; Sun, 22 Aug 2021 17:44:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gt2nM35yLz3Ky5; Sun, 22 Aug 2021 17:44:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 535AA24E23; Sun, 22 Aug 2021 17:44:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17MHidfv017896; Sun, 22 Aug 2021 17:44:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17MHidtW017895; Sun, 22 Aug 2021 17:44:39 GMT (envelope-from git) Date: Sun, 22 Aug 2021 17:44:39 GMT Message-Id: <202108221744.17MHidtW017895@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: eccb516db8b7 - main - vm: use __func__ for the correct function name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eccb516db8b7fec957b139c3a9a2e16175551067 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 17:44:39 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=eccb516db8b7fec957b139c3a9a2e16175551067 commit eccb516db8b7fec957b139c3a9a2e16175551067 Author: Bjoern A. Zeeb AuthorDate: 2021-08-22 17:21:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-08-22 17:43:12 +0000 vm: use __func__ for the correct function name In fee2a2fa39834d8d5eaa981298fce9d2ed31546d the KASSERTs in vm_page_unwire_noq() changed from "vm_page_unwire" to "vm_page_unref". While the former no longer was part of that function the latter does not exist as a function and is highly confusing when hit when using tools to lookup the functions and not doing a full-text search. Use %s __func__ for printing the function name, as that will do the right thing as code moves around and functions get renamed. Hit: while debugging a wired page leak with linuxkpi/iwlwifi Sponsored by: The FreeBSD Foundation Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31635 --- sys/vm/vm_page.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index d435b871b7cb..4ecea30e9219 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -4050,9 +4050,9 @@ vm_page_unwire_noq(vm_page_t m) old = vm_page_drop(m, 1); KASSERT(VPRC_WIRE_COUNT(old) != 0, - ("vm_page_unref: counter underflow for page %p", m)); + ("%s: counter underflow for page %p", __func__, m)); KASSERT((m->flags & PG_FICTITIOUS) == 0 || VPRC_WIRE_COUNT(old) > 1, - ("vm_page_unref: missing ref on fictitious page %p", m)); + ("%s: missing ref on fictitious page %p", __func__, m)); if (VPRC_WIRE_COUNT(old) > 1) return (false); From owner-dev-commits-src-main@freebsd.org Sun Aug 22 22:58:41 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A8E8665F1B4; Sun, 22 Aug 2021 22:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gt9lj4FRhz4g6D; Sun, 22 Aug 2021 22:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B08E11F2; Sun, 22 Aug 2021 22:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17MMwfED030420; Sun, 22 Aug 2021 22:58:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17MMwfdM030419; Sun, 22 Aug 2021 22:58:41 GMT (envelope-from git) Date: Sun, 22 Aug 2021 22:58:41 GMT Message-Id: <202108222258.17MMwfdM030419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 62e1a437f328 - main - routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62e1a437f3285e785d9b35a476d36a469a90028d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 22:58:41 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=62e1a437f3285e785d9b35a476d36a469a90028d commit 62e1a437f3285e785d9b35a476d36a469a90028d Author: Zhenlei Huang AuthorDate: 2021-08-22 22:28:47 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-22 22:56:08 +0000 routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). Implement kernel support for RFC 5549/8950. * Relax control plane restrictions and allow specifying IPv6 gateways for IPv4 routes. This behavior is controlled by the net.route.rib_route_ipv6_nexthop sysctl (on by default). * Always pass final destination in ro->ro_dst in ip_forward(). * Use ro->ro_dst to exract packet family inside if_output() routines. Consistently use RO_GET_FAMILY() macro to handle ro=NULL case. * Pass extracted family to nd6_resolve() to get the LLE with proper encap. It leverages recent lltable changes committed in c541bd368f86. Presence of the functionality can be checked using ipv4_rfc5549_support feature(3). Example usage: route add -net 192.0.0.0/24 -inet6 fe80::5054:ff:fe14:e319%vtnet0 Differential Revision: https://reviews.freebsd.org/D30398 MFC after: 2 weeks --- sys/contrib/ipfilter/netinet/ip_fil_freebsd.c | 33 +++++++++-------- sys/dev/cxgbe/tom/t4_listen.c | 5 ++- sys/dev/iicbus/if_ic.c | 2 +- sys/net/debugnet.c | 1 + sys/net/if_disc.c | 2 +- sys/net/if_ethersubr.c | 11 +++--- sys/net/if_fwsubr.c | 28 +++++++++++--- sys/net/if_gif.c | 2 +- sys/net/if_gre.c | 2 +- sys/net/if_infiniband.c | 7 ++-- sys/net/if_loop.c | 2 +- sys/net/if_me.c | 4 +- sys/net/if_spppsubr.c | 11 +++--- sys/net/if_tuntap.c | 2 +- sys/net/route.h | 4 ++ sys/net/route/route_ctl.c | 30 ++++++++++++++- sys/netgraph/netflow/netflow.c | 4 ++ sys/netgraph/ng_iface.c | 2 +- sys/netinet/ip_fastfwd.c | 29 +++++++++------ sys/netinet/ip_input.c | 11 ++++-- sys/netinet/ip_output.c | 53 ++++++++++++--------------- sys/netinet/toecore.c | 3 +- sys/ofed/drivers/infiniband/core/ib_addr.c | 14 +++++-- 23 files changed, 168 insertions(+), 94 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c index 072ab8bcd4e5..7e0ac4bc2927 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c @@ -689,7 +689,9 @@ ipf_fastroute(m0, mpp, fin, fdp) register struct mbuf *m = *mpp; int len, off, error = 0, hlen, code; struct ifnet *ifp, *sifp; - struct sockaddr_in dst; + struct route ro; + struct sockaddr_in *dst; + const struct sockaddr *gw; struct nhop_object *nh; u_long fibnum = 0; u_short ip_off; @@ -739,10 +741,12 @@ ipf_fastroute(m0, mpp, fin, fdp) /* * Route packet. */ - bzero(&dst, sizeof (dst)); - dst.sin_family = AF_INET; - dst.sin_addr = ip->ip_dst; - dst.sin_len = sizeof(dst); + bzero(&ro, sizeof (ro)); + dst = (struct sockaddr_in *)&ro.ro_dst; + dst->sin_family = AF_INET; + dst->sin_addr = ip->ip_dst; + dst->sin_len = sizeof(dst); + gw = (const struct sockaddr *)dst; fr = fin->fin_fr; if ((fr != NULL) && !(fr->fr_flags & FR_KEEPSTATE) && (fdp != NULL) && @@ -762,11 +766,11 @@ ipf_fastroute(m0, mpp, fin, fdp) } if ((fdp != NULL) && (fdp->fd_ip.s_addr != 0)) - dst.sin_addr = fdp->fd_ip; + dst->sin_addr = fdp->fd_ip; fibnum = M_GETFIB(m0); NET_EPOCH_ASSERT(); - nh = fib4_lookup(fibnum, dst.sin_addr, 0, NHR_NONE, 0); + nh = fib4_lookup(fibnum, dst->sin_addr, 0, NHR_NONE, 0); if (nh == NULL) { if (in_localaddr(ip->ip_dst)) error = EHOSTUNREACH; @@ -777,8 +781,10 @@ ipf_fastroute(m0, mpp, fin, fdp) if (ifp == NULL) ifp = nh->nh_ifp; - if (nh->nh_flags & NHF_GATEWAY) - dst.sin_addr = nh->gw4_sa.sin_addr; + if (nh->nh_flags & NHF_GATEWAY) { + gw = &nh->gw_sa; + ro.ro_flags |= RT_HAS_GW; + } /* * For input packets which are being "fastrouted", they won't @@ -822,9 +828,7 @@ ipf_fastroute(m0, mpp, fin, fdp) if (ntohs(ip->ip_len) <= ifp->if_mtu) { if (!ip->ip_sum) ip->ip_sum = in_cksum(m, hlen); - error = (*ifp->if_output)(ifp, m, (struct sockaddr *)&dst, - NULL - ); + error = (*ifp->if_output)(ifp, m, gw, &ro); goto done; } /* @@ -904,10 +908,7 @@ sendorfree: m0 = m->m_act; m->m_act = 0; if (error == 0) - error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)&dst, - NULL - ); + error = (*ifp->if_output)(ifp, m, gw, &ro); else FREE_MB_T(m); } diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index 8623079fe429..4d98597409d6 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -1113,7 +1113,10 @@ get_l2te_for_nexthop(struct port_info *pi, struct ifnet *ifp, if (nh->nh_ifp != ifp) return (NULL); if (nh->nh_flags & NHF_GATEWAY) - ((struct sockaddr_in *)dst)->sin_addr = nh->gw4_sa.sin_addr; + if (nh->gw_sa.sa_family == AF_INET) + ((struct sockaddr_in *)dst)->sin_addr = nh->gw4_sa.sin_addr; + else + *((struct sockaddr_in6 *)dst) = nh->gw6_sa; else ((struct sockaddr_in *)dst)->sin_addr = inc->inc_faddr; } diff --git a/sys/dev/iicbus/if_ic.c b/sys/dev/iicbus/if_ic.c index 4dac86141230..603265a52b13 100644 --- a/sys/dev/iicbus/if_ic.c +++ b/sys/dev/iicbus/if_ic.c @@ -372,7 +372,7 @@ icoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &hdr, sizeof(hdr)); else - hdr = dst->sa_family; + hdr = RO_GET_FAMILY(ro, dst); mtx_lock(&sc->ic_lock); ifp->if_drv_flags |= IFF_DRV_RUNNING; diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c index bb59ff33a93f..8652597c55db 100644 --- a/sys/net/debugnet.c +++ b/sys/net/debugnet.c @@ -673,6 +673,7 @@ debugnet_connect(const struct debugnet_conn_params *dcp, goto cleanup; } + /* TODO support AF_INET6 */ if (nh->gw_sa.sa_family == AF_INET) gw_sin = &nh->gw4_sa; else { diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c index ac0028c42f70..14d544dfd86a 100644 --- a/sys/net/if_disc.c +++ b/sys/net/if_disc.c @@ -185,7 +185,7 @@ discoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); if (bpf_peers_present(ifp->if_bpf)) bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 6d8b79d4dd12..3209e8a82978 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -236,10 +236,11 @@ ether_resolve_addr(struct ifnet *ifp, struct mbuf *m, #endif #ifdef INET6 case AF_INET6: - if ((m->m_flags & M_MCAST) == 0) - error = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), m, dst, phdr, + if ((m->m_flags & M_MCAST) == 0) { + int af = RO_GET_FAMILY(ro, dst); + error = nd6_resolve(ifp, LLE_SF(af, 0), m, dst, phdr, &lleflags, plle); - else { + } else { const struct in6_addr *a6; a6 = &(((const struct sockaddr_in6 *)dst)->sin6_addr); ETHER_MAP_IPV6_MULTICAST(a6, eh->ether_dhost); @@ -353,7 +354,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, if ((pflags & RT_L2_ME) != 0) { update_mbuf_csumflags(m, m); - return (if_simloop(ifp, m, dst->sa_family, 0)); + return (if_simloop(ifp, m, RO_GET_FAMILY(ro, dst), 0)); } loop_copy = (pflags & RT_MAY_LOOP) != 0; @@ -400,7 +401,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, */ if ((n = m_dup(m, M_NOWAIT)) != NULL) { update_mbuf_csumflags(m, n); - (void)if_simloop(ifp, n, dst->sa_family, hlen); + (void)if_simloop(ifp, n, RO_GET_FAMILY(ro, dst), hlen); } else if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); } diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c index a6c43d4d05a4..321721737d36 100644 --- a/sys/net/if_fwsubr.c +++ b/sys/net/if_fwsubr.c @@ -94,6 +94,7 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, #if defined(INET) || defined(INET6) int is_gw = 0; #endif + int af = RO_GET_FAMILY(ro, dst); #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); @@ -137,6 +138,26 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, destfw = NULL; } + switch (af) { +#ifdef INET + case AF_INET: + type = ETHERTYPE_IP; + break; + case AF_ARP: + type = ETHERTYPE_ARP; + break; +#endif +#ifdef INET6 + case AF_INET6: + type = ETHERTYPE_IPV6; + break; +#endif + default: + if_printf(ifp, "can't handle af%d\n", af); + error = EAFNOSUPPORT; + goto bad; + } + switch (dst->sa_family) { #ifdef INET case AF_INET: @@ -151,7 +172,6 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (error) return (error == EWOULDBLOCK ? 0 : error); } - type = ETHERTYPE_IP; break; case AF_ARP: @@ -159,7 +179,6 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct arphdr *ah; ah = mtod(m, struct arphdr *); ah->ar_hrd = htons(ARPHRD_IEEE1394); - type = ETHERTYPE_ARP; if (unicast) *destfw = *(struct fw_hwaddr *) ar_tha(ah); @@ -176,12 +195,11 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, #ifdef INET6 case AF_INET6: if (unicast) { - error = nd6_resolve(fc->fc_ifp, LLE_SF(AF_INET6, is_gw), - m, dst, (u_char *) destfw, NULL, NULL); + error = nd6_resolve(fc->fc_ifp, LLE_SF(af, is_gw), m, + dst, (u_char *) destfw, NULL, NULL); if (error) return (error == EWOULDBLOCK ? 0 : error); } - type = ETHERTYPE_IPV6; break; #endif diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 113bcb5c916e..796f427e356b 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -409,7 +409,7 @@ gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); /* * Now save the af in the inbound pkt csum data, this is a cheat since * we are using the inbound csum_data field to carry the af over to diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 19014f9fd3de..5ad452ac38e0 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -613,7 +613,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); /* * Now save the af in the inbound pkt csum data, this is a cheat since * we are using the inbound csum_data field to carry the af over to diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c index 244b2a5ba117..4dfbd5272d15 100644 --- a/sys/net/if_infiniband.c +++ b/sys/net/if_infiniband.c @@ -253,8 +253,9 @@ infiniband_resolve_addr(struct ifnet *ifp, struct mbuf *m, #ifdef INET6 case AF_INET6: if ((m->m_flags & M_MCAST) == 0) { - error = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), m, dst, - phdr, &lleflags, plle); + int af = RO_GET_FAMILY(ro, dst); + error = nd6_resolve(ifp, LLE_SF(af, 0), m, dst, phdr, + &lleflags, plle); } else { infiniband_ipv6_multicast_map( &((const struct sockaddr_in6 *)dst)->sin6_addr, @@ -371,7 +372,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, if ((pflags & RT_L2_ME) != 0) { update_mbuf_csumflags(m, m); - return (if_simloop(ifp, m, dst->sa_family, 0)); + return (if_simloop(ifp, m, RO_GET_FAMILY(ro, dst), 0)); } /* diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index cbff8200806a..643ef2240fe1 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -235,7 +235,7 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); #if 1 /* XXX */ switch (af) { diff --git a/sys/net/if_me.c b/sys/net/if_me.c index aafc07c2b203..067ab22cd84d 100644 --- a/sys/net/if_me.c +++ b/sys/net/if_me.c @@ -533,14 +533,14 @@ drop: static int me_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct route *ro __unused) + struct route *ro) { uint32_t af; if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); m->m_pkthdr.csum_data = af; return (ifp->if_transmit(ifp, m)); } diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index fbf7b0ea8f4c..804367025532 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -780,6 +780,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, int ipproto = PPP_IP; #endif int debug = ifp->if_flags & IFF_DEBUG; + int af = RO_GET_FAMILY(ro, dst); SPPP_LOCK(sp); @@ -805,7 +806,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, * dialout event in case IPv6 has been * administratively disabled on that interface. */ - if (dst->sa_family == AF_INET6 && + if (af == AF_INET6 && !(sp->confflags & CONF_ENABLE_IPV6)) goto drop; #endif @@ -818,7 +819,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, } #ifdef INET - if (dst->sa_family == AF_INET) { + if (af == AF_INET) { /* XXX Check mbuf length here? */ struct ip *ip = mtod (m, struct ip*); struct tcphdr *tcp = (struct tcphdr*) ((long*)ip + ip->ip_hl); @@ -888,14 +889,14 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, #endif #ifdef INET6 - if (dst->sa_family == AF_INET6) { + if (af == AF_INET6) { /* XXX do something tricky here? */ } #endif if (sp->pp_mode == PP_FR) { /* Add frame relay header. */ - m = sppp_fr_header (sp, m, dst->sa_family); + m = sppp_fr_header (sp, m, af); if (! m) goto nobufs; goto out; @@ -926,7 +927,7 @@ nobufs: if (debug) h->control = PPP_UI; /* Unnumbered Info */ } - switch (dst->sa_family) { + switch (af) { #ifdef INET case AF_INET: /* Internet Protocol */ if (sp->pp_mode == IFF_CISCO) diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c index b4b1b77ddc7c..bd9fc811d19f 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -1402,7 +1402,7 @@ tunoutput(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); if (bpf_peers_present(ifp->if_bpf)) bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m0); diff --git a/sys/net/route.h b/sys/net/route.h index 67217f237e0b..ec77d39b9649 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -394,6 +394,10 @@ struct rt_addrinfo { } \ } while (0) +#define RO_GET_FAMILY(ro, dst) ((ro) != NULL && \ + (ro)->ro_flags & RT_HAS_GW \ + ? (ro)->ro_dst.sa_family : (dst)->sa_family) + /* * Validate a cached route based on a supplied cookie. If there is an * out-of-date cache, simply free it. Update the generation number diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index a686d1623053..6db088102cd3 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -106,6 +106,14 @@ SYSCTL_UINT(_net_route, OID_AUTO, multipath, _MP_FLAGS | CTLFLAG_VNET, &VNET_NAME(rib_route_multipath), 0, "Enable route multipath"); #undef _MP_FLAGS +#if defined(INET) && defined(INET6) +FEATURE(ipv4_rfc5549_support, "Route IPv4 packets via IPv6 nexthops"); +#define V_rib_route_ipv6_nexthop VNET(rib_route_ipv6_nexthop) +VNET_DEFINE(u_int, rib_route_ipv6_nexthop) = 1; +SYSCTL_UINT(_net_route, OID_AUTO, ipv6_nexthop, CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(rib_route_ipv6_nexthop), 0, "Enable IPv4 route via IPv6 Next Hop address"); +#endif + /* Routing table UMA zone */ VNET_DEFINE_STATIC(uma_zone_t, rtzone); #define V_rtzone VNET(rtzone) @@ -197,6 +205,20 @@ get_rnh(uint32_t fibnum, const struct rt_addrinfo *info) return (rnh); } +#if defined(INET) && defined(INET6) +static bool +rib_can_ipv6_nexthop_address(struct rib_head *rh) +{ + int result; + + CURVNET_SET(rh->rib_vnet); + result = !!V_rib_route_ipv6_nexthop; + CURVNET_RESTORE(); + + return (result); +} +#endif + #ifdef ROUTE_MPATH static bool rib_can_multipath(struct rib_head *rh) @@ -582,7 +604,13 @@ check_gateway(struct rib_head *rnh, struct sockaddr *dst, return (true); else if (gateway->sa_family == AF_LINK) return (true); - return (false); +#if defined(INET) && defined(INET6) + else if (dst->sa_family == AF_INET && gateway->sa_family == AF_INET6 && + rib_can_ipv6_nexthop_address(rnh)) + return (true); +#endif + else + return (false); } /* diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c index 7d4108ee59a7..5c0358d9b67a 100644 --- a/sys/netgraph/netflow/netflow.c +++ b/sys/netgraph/netflow/netflow.c @@ -364,6 +364,10 @@ hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, fle->f.fle_o_ifx = nh->nh_ifp->if_index; if (nh->gw_sa.sa_family == AF_INET) fle->f.next_hop = nh->gw4_sa.sin_addr; + /* + * XXX we're leaving an empty gateway here for + * IPv6 nexthops. + */ fle->f.dst_mask = plen; } } diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index 1e586d687244..e6871435fa88 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -371,7 +371,7 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); /* Berkeley packet filter */ ng_iface_bpftap(ifp, m, af); diff --git a/sys/netinet/ip_fastfwd.c b/sys/netinet/ip_fastfwd.c index 44da6b73e41c..facf876f18cc 100644 --- a/sys/netinet/ip_fastfwd.c +++ b/sys/netinet/ip_fastfwd.c @@ -199,7 +199,9 @@ ip_tryforward(struct mbuf *m) struct ip *ip; struct mbuf *m0 = NULL; struct nhop_object *nh = NULL; - struct sockaddr_in dst; + struct route ro; + struct sockaddr_in *dst; + const struct sockaddr *gw; struct in_addr dest, odest, rtdest; uint16_t ip_len, ip_off; int error = 0; @@ -421,19 +423,23 @@ passout: ip_len = ntohs(ip->ip_len); ip_off = ntohs(ip->ip_off); - bzero(&dst, sizeof(dst)); - dst.sin_family = AF_INET; - dst.sin_len = sizeof(dst); - if (nh->nh_flags & NHF_GATEWAY) - dst.sin_addr = nh->gw4_sa.sin_addr; - else - dst.sin_addr = dest; + bzero(&ro, sizeof(ro)); + dst = (struct sockaddr_in *)&ro.ro_dst; + dst->sin_family = AF_INET; + dst->sin_len = sizeof(*dst); + dst->sin_addr = dest; + if (nh->nh_flags & NHF_GATEWAY) { + gw = &nh->gw_sa; + ro.ro_flags |= RT_HAS_GW; + } else + gw = (const struct sockaddr *)dst; /* * Handle redirect case. */ redest.s_addr = 0; - if (V_ipsendredirects && (nh->nh_ifp == m->m_pkthdr.rcvif)) + if (V_ipsendredirects && (nh->nh_ifp == m->m_pkthdr.rcvif) && + gw->sa_family == AF_INET) mcopy = ip_redir_alloc(m, nh, ip, &redest.s_addr); /* @@ -448,8 +454,7 @@ passout: * Send off the packet via outgoing interface */ IP_PROBE(send, NULL, NULL, ip, nh->nh_ifp, ip, NULL); - error = (*nh->nh_ifp->if_output)(nh->nh_ifp, m, - (struct sockaddr *)&dst, NULL); + error = (*nh->nh_ifp->if_output)(nh->nh_ifp, m, gw, &ro); } else { /* * Handle EMSGSIZE with icmp reply needfrag for TCP MTU discovery @@ -484,7 +489,7 @@ passout: mtod(m, struct ip *), nh->nh_ifp, mtod(m, struct ip *), NULL); error = (*nh->nh_ifp->if_output)(nh->nh_ifp, m, - (struct sockaddr *)&dst, NULL); + gw, &ro); if (error) break; } while ((m = m0) != NULL); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 733cc2901879..465c00e4dac7 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1065,13 +1065,16 @@ ip_forward(struct mbuf *m, int srcrt) if (nh_ia != NULL && (src & nh_ia->ia_subnetmask) == nh_ia->ia_subnet) { - if (nh->nh_flags & NHF_GATEWAY) - dest.s_addr = nh->gw4_sa.sin_addr.s_addr; - else - dest.s_addr = ip->ip_dst.s_addr; /* Router requirements says to only send host redirects */ type = ICMP_REDIRECT; code = ICMP_REDIRECT_HOST; + if (nh->nh_flags & NHF_GATEWAY) { + if (nh->gw_sa.sa_family == AF_INET) + dest.s_addr = nh->gw4_sa.sin_addr.s_addr; + else /* Do not redirect in case gw is AF_INET6 */ + type = 0; + } else + dest.s_addr = ip->ip_dst.s_addr; } } } diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 3041232b7223..ad41c9df0b8c 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -212,7 +212,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, int flags, static int ip_output_send(struct inpcb *inp, struct ifnet *ifp, struct mbuf *m, - const struct sockaddr_in *gw, struct route *ro, bool stamp_tag) + const struct sockaddr *gw, struct route *ro, bool stamp_tag) { #ifdef KERN_TLS struct ktls_session *tls = NULL; @@ -273,7 +273,7 @@ ip_output_send(struct inpcb *inp, struct ifnet *ifp, struct mbuf *m, m->m_pkthdr.csum_flags |= CSUM_SND_TAG; } - error = (*ifp->if_output)(ifp, m, (const struct sockaddr *)gw, ro); + error = (*ifp->if_output)(ifp, m, gw, ro); done: /* Check for route change invalidating send tags. */ @@ -329,12 +329,13 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, int mtu = 0; int error = 0; int vlan_pcp = -1; - struct sockaddr_in *dst, sin; - const struct sockaddr_in *gw; + struct sockaddr_in *dst; + const struct sockaddr *gw; struct in_ifaddr *ia = NULL; struct in_addr src; int isbroadcast; uint16_t ip_len, ip_off; + struct route iproute; uint32_t fibnum; #if defined(IPSEC) || defined(IPSEC_SUPPORT) int no_route_but_check_spd = 0; @@ -386,23 +387,23 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, * therefore we need restore gw if we're redoing lookup. */ fibnum = (inp != NULL) ? inp->inp_inc.inc_fibnum : M_GETFIB(m); - if (ro != NULL) - dst = (struct sockaddr_in *)&ro->ro_dst; - else - dst = &sin; - if (ro == NULL || ro->ro_nh == NULL) { - bzero(dst, sizeof(*dst)); + if (ro == NULL) { + ro = &iproute; + bzero(ro, sizeof (*ro)); + } + dst = (struct sockaddr_in *)&ro->ro_dst; + if (ro->ro_nh == NULL) { dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = ip->ip_dst; } - gw = dst; + gw = (const struct sockaddr *)dst; again: /* * Validate route against routing table additions; * a better/more specific route might have been added. */ - if (inp != NULL && ro != NULL && ro->ro_nh != NULL) + if (inp != NULL && ro->ro_nh != NULL) NH_VALIDATE(ro, &inp->inp_rt_cookie, fibnum); /* * If there is a cached route, @@ -412,7 +413,7 @@ again: * cache with IPv6. * Also check whether routing cache needs invalidation. */ - if (ro != NULL && ro->ro_nh != NULL && + if (ro->ro_nh != NULL && ((!NH_IS_VALID(ro->ro_nh)) || dst->sin_family != AF_INET || dst->sin_addr.s_addr != ip->ip_dst.s_addr)) RO_INVALIDATE_CACHE(ro); @@ -469,7 +470,7 @@ again: src = IA_SIN(ia)->sin_addr; else src.s_addr = INADDR_ANY; - } else if (ro != NULL) { + } else if (ro != &iproute) { if (ro->ro_nh == NULL) { /* * We want to do any cloning requested by the link @@ -502,11 +503,11 @@ again: counter_u64_add(nh->nh_pksent, 1); rt_update_ro_flags(ro, nh); if (nh->nh_flags & NHF_GATEWAY) - gw = &nh->gw4_sa; + gw = &nh->gw_sa; if (nh->nh_flags & NHF_HOST) isbroadcast = (nh->nh_flags & NHF_BROADCAST); - else if (ifp->if_flags & IFF_BROADCAST) - isbroadcast = in_ifaddr_broadcast(gw->sin_addr, ia); + else if ((ifp->if_flags & IFF_BROADCAST) && (gw->sa_family == AF_INET)) + isbroadcast = in_ifaddr_broadcast(((const struct sockaddr_in *)gw)->sin_addr, ia); else isbroadcast = 0; mtu = nh->nh_mtu; @@ -531,22 +532,16 @@ again: } ifp = nh->nh_ifp; mtu = nh->nh_mtu; - /* - * We are rewriting here dst to be gw actually, contradicting - * comment at the beginning of the function. However, in this - * case we are always dealing with on stack dst. - * In case if pfil(9) sends us back to beginning of the - * function, the dst would be rewritten by ip_output_pfil(). - */ - MPASS(dst == &sin); + rt_update_ro_flags(ro, nh); if (nh->nh_flags & NHF_GATEWAY) - dst->sin_addr = nh->gw4_sa.sin_addr; + gw = &nh->gw_sa; ia = ifatoia(nh->nh_ifa); src = IA_SIN(ia)->sin_addr; isbroadcast = (((nh->nh_flags & (NHF_HOST | NHF_BROADCAST)) == (NHF_HOST | NHF_BROADCAST)) || ((ifp->if_flags & IFF_BROADCAST) && - in_ifaddr_broadcast(dst->sin_addr, ia))); + (gw->sa_family == AF_INET) && + in_ifaddr_broadcast(((const struct sockaddr_in *)gw)->sin_addr, ia))); } /* Catch a possible divide by zero later. */ @@ -561,7 +556,7 @@ again: * still points to the address in "ro". (It may have been * changed to point to a gateway address, above.) */ - gw = dst; + gw = (const struct sockaddr *)dst; /* * See if the caller provided any multicast options */ @@ -721,7 +716,7 @@ sendit: RO_NHFREE(ro); ro->ro_prepend = NULL; } - gw = dst; + gw = (const struct sockaddr *)dst; ip = mtod(m, struct ip *); goto again; } diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c index 1c0be6011253..0bf55958c618 100644 --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -483,7 +483,8 @@ toe_l2_resolve(struct toedev *tod, struct ifnet *ifp, struct sockaddr *sa, #endif #ifdef INET6 case AF_INET6: - rc = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), NULL, sa, lladdr, NULL, NULL); + rc = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), NULL, sa, lladdr, + NULL, NULL); break; #endif default: diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index 297469bd4d87..2ac79ca64664 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -397,9 +398,16 @@ static int addr4_resolve(struct sockaddr_in *src_in, } else { bool is_gw = (nh->nh_flags & NHF_GATEWAY) != 0; memset(edst, 0, MAX_ADDR_LEN); - error = arpresolve(ifp, is_gw, NULL, is_gw ? - &nh->gw_sa : (const struct sockaddr *)&dst_tmp, - edst, NULL, NULL); +#ifdef INET6 + if (is_gw && nh->gw_sa.sa_family == AF_INET6) + error = nd6_resolve(ifp, LLE_SF(AF_INET, is_gw), NULL, + &nh->gw_sa, edst, NULL, NULL); + else +#endif + error = arpresolve(ifp, is_gw, NULL, is_gw ? + &nh->gw_sa : (const struct sockaddr *)&dst_tmp, + edst, NULL, NULL); + if (error != 0) goto error_put_ifp; else if (is_gw)