From owner-dev-commits-src-main@freebsd.org Mon May 24 01:34: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 7FC3065349A; Mon, 24 May 2021 01:34: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 4FpKWn2lQ4z4bn1; Mon, 24 May 2021 01:34: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 4705121A9C; Mon, 24 May 2021 01:34: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 14O1Yjij094933; Mon, 24 May 2021 01:34:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14O1YjXd094932; Mon, 24 May 2021 01:34:45 GMT (envelope-from git) Date: Mon, 24 May 2021 01:34:45 GMT Message-Id: <202105240134.14O1YjXd094932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: ac02945f7e2b - main - cxgbetool(8): add a 'clip' subcommand to deal with the CLIP table. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac02945f7e2b5ab84fe510fc052c35350e31220d 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, 24 May 2021 01:34:45 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=ac02945f7e2b5ab84fe510fc052c35350e31220d commit ac02945f7e2b5ab84fe510fc052c35350e31220d Author: Navdeep Parhar AuthorDate: 2021-05-23 23:28:31 +0000 Commit: Navdeep Parhar CommitDate: 2021-05-23 23:28:31 +0000 cxgbetool(8): add a 'clip' subcommand to deal with the CLIP table. MFC after: 2 weeks Sponsored by: Chelsio Communications --- usr.sbin/cxgbetool/cxgbetool.8 | 30 ++++++++++++++- usr.sbin/cxgbetool/cxgbetool.c | 84 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 110 insertions(+), 4 deletions(-) diff --git a/usr.sbin/cxgbetool/cxgbetool.8 b/usr.sbin/cxgbetool/cxgbetool.8 index 56980e42795f..02dc1a176eb0 100644 --- a/usr.sbin/cxgbetool/cxgbetool.8 +++ b/usr.sbin/cxgbetool/cxgbetool.8 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sep 21, 2018 +.Dd May 23, 2021 .Dt CXGBETOOL 8 .Os .Sh NAME @@ -46,6 +46,10 @@ .It .Nm Ar nexus Cm clearstats Ar port_id .It +.Nm Ar nexus Cm clip Bro Cm hold | release Brc Ar ipv6-address +.It +.Nm Ar nexus Cm clip Cm list +.It .Nm Ar nexus Cm context Bro Cm ingress | egress | fl | cong Brc Ar cntxt_id .It .Nm Ar nexus Cm hashfilter mode @@ -119,6 +123,30 @@ identifies a port within this range. .Pp .Bl -item -compact .It +.Cm clip hold Ar ipv6-address +.El +Install a reference on the given +.Ar ipv6-address +in the CLIP (Compressed Local IPv6) table. +The address is added to the CLIP table if it is not present there already. +.Pp +.Bl -item -compact +.It +.Cm clip list +.El +List the contents of the CLIP table. +.Pp +.Bl -item -compact +.It +.Cm clip release Ar ipv6-address +.El +Release a reference on the given +.Ar ipv6-address +in the CLIP table. +A reference on the address must have been acquired previously. +.Pp +.Bl -item -compact +.It .Cm context ingress Ar ingress_cntxt_id .It .Cm context cong Ar ingress_cntxt_id diff --git a/usr.sbin/cxgbetool/cxgbetool.c b/usr.sbin/cxgbetool/cxgbetool.c index 139a0bd8e564..77f092123de9 100644 --- a/usr.sbin/cxgbetool/cxgbetool.c +++ b/usr.sbin/cxgbetool/cxgbetool.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -58,7 +59,8 @@ __FBSDID("$FreeBSD$"); #define max(x, y) ((x) > (y) ? (x) : (y)) static const char *progname, *nexus; -static int chip_id; /* 4 for T4, 5 for T5 */ +static int chip_id; /* 4 for T4, 5 for T5, and so on. */ +static int inst; /* instance of nexus device */ struct reg_info { const char *name; @@ -91,6 +93,8 @@ usage(FILE *fp) fprintf(fp, "Usage: %s [operation]\n", progname); fprintf(fp, "\tclearstats clear port statistics\n" + "\tclip hold|release hold/release an address\n" + "\tclip list list the CLIP table\n" "\tcontext show an SGE context\n" "\tdumpstate dump chip state\n" "\tfilter [ ] ... set a filter\n" @@ -3506,6 +3510,69 @@ load_offload_policy(int argc, const char *argv[]) return (rc); } +static int +display_clip(void) +{ + size_t clip_buf_size = 4096; + char *buf, name[32]; + int rc; + + buf = malloc(clip_buf_size); + if (buf == NULL) { + warn("%s", __func__); + return (errno); + } + + snprintf(name, sizeof(name), "dev.t%unex.%u.misc.clip", chip_id, inst); + rc = sysctlbyname(name, buf, &clip_buf_size, NULL, 0); + if (rc != 0) { + warn("sysctl %s", name); + free(buf); + return (errno); + } + + printf("%s\n", buf); + free(buf); + return (0); +} + +static int +clip_cmd(int argc, const char *argv[]) +{ + int rc, af = AF_INET6, add; + struct t4_clip_addr ca = {0}; + + if (argc == 1 && !strcmp(argv[0], "list")) { + rc = display_clip(); + return (rc); + } + + if (argc != 2) { + warnx("incorrect number of arguments."); + return (EINVAL); + } + + if (!strcmp(argv[0], "hold")) { + add = 1; + } else if (!strcmp(argv[0], "rel") || !strcmp(argv[0], "release")) { + add = 0; + } else { + warnx("first argument must be \"hold\" or \"release\""); + return (EINVAL); + } + + rc = parse_ipaddr(argv[0], argv, &af, &ca.addr[0], &ca.mask[0], 1); + if (rc != 0) + return (rc); + + if (add) + rc = doit(CHELSIO_T4_HOLD_CLIP_ADDR, &ca); + else + rc = doit(CHELSIO_T4_RELEASE_CLIP_ADDR, &ca); + + return (rc); +} + static int run_cmd(int argc, const char *argv[]) { @@ -3556,6 +3623,8 @@ run_cmd(int argc, const char *argv[]) rc = load_offload_policy(argc, argv); else if (!strcmp(cmd, "hashfilter")) rc = filter_cmd(argc, argv, 1); + else if (!strcmp(cmd, "clip")) + rc = clip_cmd(argc, argv); else { rc = EINVAL; warnx("invalid command \"%s\"", cmd); @@ -3609,6 +3678,16 @@ run_cmd_loop(void) return (rc); } +static void +parse_nexus_name(const char *s) +{ + char junk; + + if (sscanf(s, "t%unex%u%c", &chip_id, &inst, &junk) != 2) + errx(EINVAL, "invalid nexus \"%s\"", s); + nexus = s; +} + int main(int argc, const char *argv[]) { @@ -3628,8 +3707,7 @@ main(int argc, const char *argv[]) exit(EINVAL); } - nexus = argv[1]; - chip_id = nexus[1] - '0'; + parse_nexus_name(argv[1]); /* progname and nexus */ argc -= 2; From owner-dev-commits-src-main@freebsd.org Mon May 24 09:44: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 BB42963147E; Mon, 24 May 2021 09:44: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 4FpXNz4n4fz4dbR; Mon, 24 May 2021 09:44: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 8BD4627E53; Mon, 24 May 2021 09:44: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 14O9iZVU047467; Mon, 24 May 2021 09:44:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14O9iZJm047466; Mon, 24 May 2021 09:44:35 GMT (envelope-from git) Date: Mon, 24 May 2021 09:44:35 GMT Message-Id: <202105240944.14O9iZJm047466@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: e779604f1d4e - main - Clean up early arm64 pmap code 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: e779604f1d4e5fd0cdf3a9d1bb756b168f97b39c 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, 24 May 2021 09:44:35 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e779604f1d4e5fd0cdf3a9d1bb756b168f97b39c commit e779604f1d4e5fd0cdf3a9d1bb756b168f97b39c Author: Andrew Turner AuthorDate: 2021-05-20 06:52:15 +0000 Commit: Andrew Turner CommitDate: 2021-05-24 09:22:19 +0000 Clean up early arm64 pmap code Early in the arm64 pmap code we need to translate between a virtual address and a physical address. Rather than manually walking the page table we can ask the hardware to do it for us. Reviewed by: kib, markj Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D30357 --- sys/arm64/arm64/locore.S | 6 ------ sys/arm64/arm64/pmap.c | 28 +++------------------------- sys/arm64/include/vmparam.h | 1 - 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index f5e6bbd604a5..472a052e9903 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -735,10 +735,6 @@ ENTRY(abort) b abort END(abort) - .align 3 -init_pt_va: - .quad pagetable /* XXX: Keep page tables VA */ - .section .init_pagetable, "aw", %nobits .align PAGE_SHIFT /* @@ -773,8 +769,6 @@ pagetable_end: el2_pagetable: .space PAGE_SIZE - .globl init_pt_va - .align 4 initstack: .space (PAGE_SIZE * KSTACK_PAGES) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index a3be232a56bf..bc5d228af5ad 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -742,35 +742,13 @@ pmap_resident_count_dec(pmap_t pmap, int count) pmap->pm_stats.resident_count -= count; } -static pt_entry_t * -pmap_early_page_idx(vm_offset_t l1pt, vm_offset_t va, u_int *l1_slot, - u_int *l2_slot) -{ - pt_entry_t *l2; - pd_entry_t *l1; - - l1 = (pd_entry_t *)l1pt; - *l1_slot = (va >> L1_SHIFT) & Ln_ADDR_MASK; - - /* Check locore has used a table L1 map */ - KASSERT((l1[*l1_slot] & ATTR_DESCR_MASK) == L1_TABLE, - ("Invalid bootstrap L1 table")); - /* Find the address of the L2 table */ - l2 = (pt_entry_t *)init_pt_va; - *l2_slot = pmap_l2_index(va); - - return (l2); -} - static vm_paddr_t pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va) { - u_int l1_slot, l2_slot; - pt_entry_t *l2; - - l2 = pmap_early_page_idx(l1pt, va, &l1_slot, &l2_slot); + vm_paddr_t pa_page; - return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET)); + pa_page = arm64_address_translate_s1e1r(va) & PAR_PA_MASK; + return (pa_page | (va & PAR_LOW_MASK)); } static vm_offset_t diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h index 4a90c7711e01..a42c68d52887 100644 --- a/sys/arm64/include/vmparam.h +++ b/sys/arm64/include/vmparam.h @@ -228,7 +228,6 @@ extern vm_paddr_t dmap_phys_base; extern vm_paddr_t dmap_phys_max; extern vm_offset_t dmap_max_addr; extern vm_offset_t vm_max_kernel_address; -extern vm_offset_t init_pt_va; #endif From owner-dev-commits-src-main@freebsd.org Mon May 24 10:20: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 0CB50631CA1; Mon, 24 May 2021 10:20:10 +0000 (UTC) (envelope-from SRS0=UsST=KT=klop.ws=ronald-lists@realworks.nl) Received: from smtp-relay-int.realworks.nl (smtp-relay-int.realworks.nl [194.109.157.24]) (using TLSv1.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 4FpYB1618rz4syv; Mon, 24 May 2021 10:20:09 +0000 (UTC) (envelope-from SRS0=UsST=KT=klop.ws=ronald-lists@realworks.nl) Date: Mon, 24 May 2021 12:20:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=klop.ws; s=rw2; t=1621851607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=EZk2/KAaaBatyTlsPEOSTCaz8PaQJ5zwvMgayKxWXmE=; b=Id6+L3OdV9ElWVgAaRHHjQntCDVJWE+IloWeklG6x5nqx2cl65r2zCeCtKsH0IZ1lmD2gp XfCInjor5LryHaCjL4+coYla2Ld8onBWSKt1GqyHHPWZSn8EyX+urSd24yHYqDxQQtstTR L4Qhz8UQZ31hU4uKKeNKDBEa3tcTO5ECQ3a3YOlgFK5r0GPDiV8Vwl3NoeCSHf6BhgyRex Cv8vAEMaXKNt0FLjabDSCuGil+h9qvsBNvLczsfK8IWYW/bbrx7NHCILjnMW2md+xgCWGL ydU5oXoBSaG98lDVCGaz8UYKpZaq9OsOQ25B574P+sfSuys6RFwb0Uq1QN5WSA== From: Ronald Klop To: Andrew Turner , dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <424236367.2001.1621851607455@localhost> In-Reply-To: <202105240944.14O9iZJm047466@gitrepo.freebsd.org> Subject: Re: git: e779604f1d4e - main - Clean up early arm64 pmap code MIME-Version: 1.0 X-Mailer: Realworks (559.17.ba10f65acb0) Importance: Normal X-Priority: 3 (Normal) X-Rspamd-Queue-Id: 4FpYB1618rz4syv 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=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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: Mon, 24 May 2021 10:20:10 -0000 Hi, Out of curiosity. What is the expected gain? (Next to simplicity of the code of course.) Ronald Van: Andrew Turner Datum: 24 mei 2021 11:44 Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Onderwerp: git: e779604f1d4e - main - Clean up early arm64 pmap code > > > The branch main has been updated by andrew: > > URL: https://cgit.FreeBSD.org/src/commit/?id=e779604f1d4e5fd0cdf3a9d1bb756b168f97b39c > > commit e779604f1d4e5fd0cdf3a9d1bb756b168f97b39c > Author: Andrew Turner > AuthorDate: 2021-05-20 06:52:15 +0000 > Commit: Andrew Turner > CommitDate: 2021-05-24 09:22:19 +0000 > > Clean up early arm64 pmap code > > Early in the arm64 pmap code we need to translate between a virtual > address and a physical address. Rather than manually walking the page > table we can ask the hardware to do it for us. > > Reviewed by: kib, markj > Sponsored by: Innovate UK > Differential Revision: https://reviews.freebsd.org/D30357 > --- > sys/arm64/arm64/locore.S | 6 ------ > sys/arm64/arm64/pmap.c | 28 +++------------------------- > sys/arm64/include/vmparam.h | 1 - > 3 files changed, 3 insertions(+), 32 deletions(-) > > diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S > index f5e6bbd604a5..472a052e9903 100644 > --- a/sys/arm64/arm64/locore.S > +++ b/sys/arm64/arm64/locore.S > @@ -735,10 +735,6 @@ ENTRY(abort) > b abort > END(abort) > > - .align 3 > -init_pt_va: > - .quad pagetable /* XXX: Keep page tables VA */ > - > .section .init_pagetable, "aw", %nobits > .align PAGE_SHIFT > /* > @@ -773,8 +769,6 @@ pagetable_end: > el2_pagetable: > .space PAGE_SIZE > > - .globl init_pt_va > - > .align 4 > initstack: > .space (PAGE_SIZE * KSTACK_PAGES) > diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c > index a3be232a56bf..bc5d228af5ad 100644 > --- a/sys/arm64/arm64/pmap.c > +++ b/sys/arm64/arm64/pmap.c > @@ -742,35 +742,13 @@ pmap_resident_count_dec(pmap_t pmap, int count) > pmap->pm_stats.resident_count -= count; > } > > -static pt_entry_t * > -pmap_early_page_idx(vm_offset_t l1pt, vm_offset_t va, u_int *l1_slot, > - u_int *l2_slot) > -{ > - pt_entry_t *l2; > - pd_entry_t *l1; > - > - l1 = (pd_entry_t *)l1pt; > - *l1_slot = (va >> L1_SHIFT) & Ln_ADDR_MASK; > - > - /* Check locore has used a table L1 map */ > - KASSERT((l1[*l1_slot] & ATTR_DESCR_MASK) == L1_TABLE, > - ("Invalid bootstrap L1 table")); > - /* Find the address of the L2 table */ > - l2 = (pt_entry_t *)init_pt_va; > - *l2_slot = pmap_l2_index(va); > - > - return (l2); > -} > - > static vm_paddr_t > pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va) > { > - u_int l1_slot, l2_slot; > - pt_entry_t *l2; > - > - l2 = pmap_early_page_idx(l1pt, va, &l1_slot, &l2_slot); > + vm_paddr_t pa_page; > > - return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET)); > + pa_page = arm64_address_translate_s1e1r(va) & PAR_PA_MASK; > + return (pa_page | (va & PAR_LOW_MASK)); > } > > static vm_offset_t > diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h > index 4a90c7711e01..a42c68d52887 100644 > --- a/sys/arm64/include/vmparam.h > +++ b/sys/arm64/include/vmparam.h > @@ -228,7 +228,6 @@ extern vm_paddr_t dmap_phys_base; > extern vm_paddr_t dmap_phys_max; > extern vm_offset_t dmap_max_addr; > extern vm_offset_t vm_max_kernel_address; > -extern vm_offset_t init_pt_va; > > #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 Mon May 24 10:53: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 EA70A6321E5; Mon, 24 May 2021 10:53: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 4FpYwz4pGGz3PQ9; Mon, 24 May 2021 10:53: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 8CF89CE6; Mon, 24 May 2021 10:53: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 14OArt0c040070; Mon, 24 May 2021 10:53:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14OArtuZ040069; Mon, 24 May 2021 10:53:55 GMT (envelope-from git) Date: Mon, 24 May 2021 10:53:55 GMT Message-Id: <202105241053.14OArtuZ040069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 996afd401c6c - main - arm: RPI-B: Add ext_resources driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 996afd401c6c69d5abaa1aac111ca3cdd0c90a90 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, 24 May 2021 10:53:56 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=996afd401c6c69d5abaa1aac111ca3cdd0c90a90 commit 996afd401c6c69d5abaa1aac111ca3cdd0c90a90 Author: Emmanuel Vadot AuthorDate: 2021-05-24 10:53:00 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-24 10:53:00 +0000 arm: RPI-B: Add ext_resources driver mmc_fdt_helpers needs clock and regulators. Add all the ext_resources driver to RPI-B conf file to fix the build Reported by: mjg --- sys/arm/conf/RPI-B | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/arm/conf/RPI-B b/sys/arm/conf/RPI-B index ebaa0462b155..3d354841beba 100644 --- a/sys/arm/conf/RPI-B +++ b/sys/arm/conf/RPI-B @@ -36,6 +36,15 @@ options PLATFORM #options ROOTDEVNAME=\"ufs:mmcsd0s2\" +# EXT_RESOURCES pseudo devices +options EXT_RESOURCES +device clk +device phy +device hwreset +device nvmem +device regulator +device syscon + device bpf device loop device ether From owner-dev-commits-src-main@freebsd.org Mon May 24 14:49: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 93D9B635F39; Mon, 24 May 2021 14:49: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 4Fpg903WR1z4hJT; Mon, 24 May 2021 14:49: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 5C4D240BF; Mon, 24 May 2021 14:49: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 14OEneLt045907; Mon, 24 May 2021 14:49:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14OEneWe045906; Mon, 24 May 2021 14:49:40 GMT (envelope-from git) Date: Mon, 24 May 2021 14:49:40 GMT Message-Id: <202105241449.14OEneWe045906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: fc3ba3e9fac0 - main - Delete obsolete Solaris compat files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc3ba3e9fac03897d17c318b79b52d91cfb87b9e 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, 24 May 2021 14:49:40 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=fc3ba3e9fac03897d17c318b79b52d91cfb87b9e commit fc3ba3e9fac03897d17c318b79b52d91cfb87b9e Author: Alan Somers AuthorDate: 2021-05-24 14:47:44 +0000 Commit: Alan Somers CommitDate: 2021-05-24 14:48:47 +0000 Delete obsolete Solaris compat files These files have been unused ever since the OpenSolaris import Sponsored by: Axcient MFC after: 2 weeks Reviewed By: freqlabs Differential Revision: https://reviews.freebsd.org/D30371 --- cddl/compat/opensolaris/misc/deviceid.c | 115 ------- cddl/compat/opensolaris/misc/fsshare.c | 262 --------------- cddl/compat/opensolaris/misc/mkdirp.c | 215 ------------ cddl/compat/opensolaris/misc/mnttab.c | 216 ------------ cddl/compat/opensolaris/misc/thread_pool.c | 428 ------------------------ cddl/compat/opensolaris/misc/thread_pool_impl.h | 99 ------ cddl/compat/opensolaris/misc/zmount.c | 106 ------ cddl/compat/opensolaris/misc/zone.c | 46 --- 8 files changed, 1487 deletions(-) diff --git a/cddl/compat/opensolaris/misc/deviceid.c b/cddl/compat/opensolaris/misc/deviceid.c deleted file mode 100644 index 9f3ea8458b3b..000000000000 --- a/cddl/compat/opensolaris/misc/deviceid.c +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * Copyright (c) 2007 Pawel Jakub Dawidek - * 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 AUTHORS 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 AUTHORS 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 - -int -devid_str_decode(char *devidstr, ddi_devid_t *retdevid, char **retminor_name) -{ - - if (strlcpy(retdevid->devid, devidstr, sizeof(retdevid->devid)) >= - sizeof(retdevid->devid)) { - return (EINVAL); - } - *retminor_name = strdup(""); - if (*retminor_name == NULL) - return (ENOMEM); - return (0); -} - -int -devid_deviceid_to_nmlist(char *search_path, ddi_devid_t devid, char *minor_name, - devid_nmlist_t **retlist) -{ - char path[MAXPATHLEN]; - char *dst; - - if (g_get_name(devid.devid, path, sizeof(path)) == -1) - return (errno); - *retlist = malloc(sizeof(**retlist)); - if (*retlist == NULL) - return (ENOMEM); - if (strlcpy((*retlist)[0].devname, path, - sizeof((*retlist)[0].devname)) >= sizeof((*retlist)[0].devname)) { - free(*retlist); - return (ENAMETOOLONG); - } - return (0); -} - -void -devid_str_free(char *str) -{ - - free(str); -} - -void -devid_free(ddi_devid_t devid) -{ - /* Do nothing. */ -} - -void -devid_free_nmlist(devid_nmlist_t *list) -{ - - free(list); -} - -int -devid_get(int fd, ddi_devid_t *retdevid) -{ - - return (ENOENT); -} - -int -devid_get_minor_name(int fd, char **retminor_name) -{ - - *retminor_name = strdup(""); - if (*retminor_name == NULL) - return (ENOMEM); - return (0); -} - -char * -devid_str_encode(ddi_devid_t devid, char *minor_name) -{ - - return (strdup(devid.devid)); -} diff --git a/cddl/compat/opensolaris/misc/fsshare.c b/cddl/compat/opensolaris/misc/fsshare.c deleted file mode 100644 index 97f5e20f42f6..000000000000 --- a/cddl/compat/opensolaris/misc/fsshare.c +++ /dev/null @@ -1,262 +0,0 @@ -/*- - * Copyright (c) 2007 Pawel Jakub Dawidek - * 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 AUTHORS 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 AUTHORS 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 /* _PATH_MOUNTDPID */ -#include -#include -#include -#include - -#define FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n" -#define OPTSSIZE 1024 -#define MAXLINESIZE (PATH_MAX + OPTSSIZE) - -static void -restart_mountd(void) -{ - struct pidfh *pfh; - pid_t mountdpid; - - pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &mountdpid); - if (pfh != NULL) { - /* Mountd is not running. */ - pidfile_remove(pfh); - return; - } - if (errno != EEXIST) { - /* Cannot open pidfile for some reason. */ - return; - } - /* We have mountd(8) PID in mountdpid varible. */ - kill(mountdpid, SIGHUP); -} - -/* - * Read one line from a file. Skip comments, empty lines and a line with a - * mountpoint specified in the 'skip' argument. - */ -static char * -zgetline(FILE *fd, const char *skip) -{ - static char line[MAXLINESIZE]; - size_t len, skiplen; - char *s, last; - - if (skip != NULL) - skiplen = strlen(skip); - for (;;) { - s = fgets(line, sizeof(line), fd); - if (s == NULL) - return (NULL); - /* Skip empty lines and comments. */ - if (line[0] == '\n' || line[0] == '#') - continue; - len = strlen(line); - if (line[len - 1] == '\n') - line[len - 1] = '\0'; - last = line[skiplen]; - /* Skip the given mountpoint. */ - if (skip != NULL && strncmp(skip, line, skiplen) == 0 && - (last == '\t' || last == ' ' || last == '\0')) { - continue; - } - break; - } - return (line); -} - -/* - * Function translate options to a format acceptable by exports(5), eg. - * - * -ro -network=192.168.0.0 -mask=255.255.255.0 -maproot=0 freefall.freebsd.org 69.147.83.54 - * - * Accepted input formats: - * - * ro,network=192.168.0.0,mask=255.255.255.0,maproot=0,freefall.freebsd.org - * ro network=192.168.0.0 mask=255.255.255.0 maproot=0 freefall.freebsd.org - * -ro,-network=192.168.0.0,-mask=255.255.255.0,-maproot=0,freefall.freebsd.org - * -ro -network=192.168.0.0 -mask=255.255.255.0 -maproot=0 freefall.freebsd.org - * - * Recognized keywords: - * - * ro, maproot, mapall, mask, network, sec, alldirs, public, webnfs, index, quiet - * - */ -static const char *known_opts[] = { "ro", "maproot", "mapall", "mask", - "network", "sec", "alldirs", "public", "webnfs", "index", "quiet", NULL }; -static char * -translate_opts(const char *shareopts) -{ - static char newopts[OPTSSIZE]; - char oldopts[OPTSSIZE]; - char *o, *s = NULL; - unsigned int i; - size_t len; - - strlcpy(oldopts, shareopts, sizeof(oldopts)); - newopts[0] = '\0'; - s = oldopts; - while ((o = strsep(&s, "-, ")) != NULL) { - if (o[0] == '\0') - continue; - for (i = 0; known_opts[i] != NULL; i++) { - len = strlen(known_opts[i]); - if (strncmp(known_opts[i], o, len) == 0 && - (o[len] == '\0' || o[len] == '=')) { - strlcat(newopts, "-", sizeof(newopts)); - break; - } - } - strlcat(newopts, o, sizeof(newopts)); - strlcat(newopts, " ", sizeof(newopts)); - } - return (newopts); -} - -static int -fsshare_main(const char *file, const char *mountpoint, const char *shareopts, - int share) -{ - char tmpfile[PATH_MAX]; - char *line; - FILE *newfd, *oldfd; - int fd, error; - - newfd = oldfd = NULL; - error = 0; - - /* - * Create temporary file in the same directory, so we can atomically - * rename it. - */ - if (strlcpy(tmpfile, file, sizeof(tmpfile)) >= sizeof(tmpfile)) - return (ENAMETOOLONG); - if (strlcat(tmpfile, ".XXXXXXXX", sizeof(tmpfile)) >= sizeof(tmpfile)) - return (ENAMETOOLONG); - fd = mkstemp(tmpfile); - if (fd == -1) - return (errno); - /* - * File name is random, so we don't really need file lock now, but it - * will be needed after rename(2). - */ - error = flock(fd, LOCK_EX); - assert(error == 0 || (error == -1 && errno == EOPNOTSUPP)); - newfd = fdopen(fd, "r+"); - assert(newfd != NULL); - /* Open old exports file. */ - oldfd = fopen(file, "r"); - if (oldfd == NULL) { - if (share) { - if (errno != ENOENT) { - error = errno; - goto out; - } - } else { - /* If there is no exports file, ignore the error. */ - if (errno == ENOENT) - errno = 0; - error = errno; - goto out; - } - } else { - error = flock(fileno(oldfd), LOCK_EX); - assert(error == 0 || (error == -1 && errno == EOPNOTSUPP)); - error = 0; - } - - /* Place big, fat warning at the begining of the file. */ - fprintf(newfd, "%s", FILE_HEADER); - while (oldfd != NULL && (line = zgetline(oldfd, mountpoint)) != NULL) - fprintf(newfd, "%s\n", line); - if (oldfd != NULL && ferror(oldfd) != 0) { - error = ferror(oldfd); - goto out; - } - if (ferror(newfd) != 0) { - error = ferror(newfd); - goto out; - } - if (share) { - fprintf(newfd, "%s\t%s\n", mountpoint, - translate_opts(shareopts)); - } - -out: - if (error != 0) - unlink(tmpfile); - else { - if (rename(tmpfile, file) == -1) { - error = errno; - unlink(tmpfile); - } else { - fflush(newfd); - /* - * Send SIGHUP to mountd, but unlock exports file later. - */ - restart_mountd(); - } - } - if (oldfd != NULL) { - flock(fileno(oldfd), LOCK_UN); - fclose(oldfd); - } - if (newfd != NULL) { - flock(fileno(newfd), LOCK_UN); - fclose(newfd); - } - return (error); -} - -/* - * Add the given mountpoint to the given exports file. - */ -int -fsshare(const char *file, const char *mountpoint, const char *shareopts) -{ - - return (fsshare_main(file, mountpoint, shareopts, 1)); -} - -/* - * Remove the given mountpoint from the given exports file. - */ -int -fsunshare(const char *file, const char *mountpoint) -{ - - return (fsshare_main(file, mountpoint, NULL, 0)); -} diff --git a/cddl/compat/opensolaris/misc/mkdirp.c b/cddl/compat/opensolaris/misc/mkdirp.c deleted file mode 100644 index 76a90ad0ec30..000000000000 --- a/cddl/compat/opensolaris/misc/mkdirp.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * $FreeBSD$ - */ - -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "@(#)mkdirp.c 1.15 06/01/04 SMI" - -/* - * Creates directory and it's parents if the parents do not - * exist yet. - * - * Returns -1 if fails for reasons other than non-existing - * parents. - * Does NOT simplify pathnames with . or .. in them. - */ - -#include -#include -#include -#include -#include -#include -#include - -static char *simplify(const char *str); - -int -mkdirp(const char *d, mode_t mode) -{ - char *endptr, *ptr, *slash, *str; - - str = simplify(d); - - /* If space couldn't be allocated for the simplified names, return. */ - - if (str == NULL) - return (-1); - - /* Try to make the directory */ - - if (mkdir(str, mode) == 0) { - free(str); - return (0); - } - if (errno != ENOENT) { - free(str); - return (-1); - } - endptr = strrchr(str, '\0'); - slash = strrchr(str, '/'); - - /* Search upward for the non-existing parent */ - - while (slash != NULL) { - - ptr = slash; - *ptr = '\0'; - - /* If reached an existing parent, break */ - - if (access(str, F_OK) == 0) - break; - - /* If non-existing parent */ - - else { - slash = strrchr(str, '/'); - - /* If under / or current directory, make it. */ - - if (slash == NULL || slash == str) { - if (mkdir(str, mode) != 0 && errno != EEXIST) { - free(str); - return (-1); - } - break; - } - } - } - - /* Create directories starting from upmost non-existing parent */ - - while ((ptr = strchr(str, '\0')) != endptr) { - *ptr = '/'; - if (mkdir(str, mode) != 0 && errno != EEXIST) { - /* - * If the mkdir fails because str already - * exists (EEXIST), then str has the form - * "existing-dir/..", and this is really - * ok. (Remember, this loop is creating the - * portion of the path that didn't exist) - */ - free(str); - return (-1); - } - } - free(str); - return (0); -} - -/* - * simplify - given a pathname, simplify that path by removing - * duplicate contiguous slashes. - * - * A simplified copy of the argument is returned to the - * caller, or NULL is returned on error. - * - * The caller should handle error reporting based upon the - * returned vlaue, and should free the returned value, - * when appropriate. - */ - -static char * -simplify(const char *str) -{ - int i; - size_t mbPathlen; /* length of multi-byte path */ - size_t wcPathlen; /* length of wide-character path */ - wchar_t *wptr; /* scratch pointer */ - wchar_t *wcPath; /* wide-character version of the path */ - char *mbPath; /* The copy fo the path to be returned */ - - /* - * bail out if there is nothing there. - */ - - if (!str) - return (NULL); - - /* - * Get a copy of the argument. - */ - - if ((mbPath = strdup(str)) == NULL) { - return (NULL); - } - - /* - * convert the multi-byte version of the path to a - * wide-character rendering, for doing our figuring. - */ - - mbPathlen = strlen(mbPath); - - if ((wcPath = calloc(sizeof (wchar_t), mbPathlen+1)) == NULL) { - free(mbPath); - return (NULL); - } - - if ((wcPathlen = mbstowcs(wcPath, mbPath, mbPathlen)) == (size_t)-1) { - free(mbPath); - free(wcPath); - return (NULL); - } - - /* - * remove duplicate slashes first ("//../" -> "/") - */ - - for (wptr = wcPath, i = 0; i < wcPathlen; i++) { - *wptr++ = wcPath[i]; - - if (wcPath[i] == '/') { - i++; - - while (wcPath[i] == '/') { - i++; - } - - i--; - } - } - - *wptr = '\0'; - - /* - * now convert back to the multi-byte format. - */ - - if (wcstombs(mbPath, wcPath, mbPathlen) == (size_t)-1) { - free(mbPath); - free(wcPath); - return (NULL); - } - - free(wcPath); - return (mbPath); -} diff --git a/cddl/compat/opensolaris/misc/mnttab.c b/cddl/compat/opensolaris/misc/mnttab.c deleted file mode 100644 index 8f56d90f6232..000000000000 --- a/cddl/compat/opensolaris/misc/mnttab.c +++ /dev/null @@ -1,216 +0,0 @@ -/*- - * Copyright (c) 2006 Pawel Jakub Dawidek - * 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 AUTHORS 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 AUTHORS 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. - */ - -/* - * This file implements Solaris compatible getmntany() and hasmntopt() - * functions. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -static char * -mntopt(char **p) -{ - char *cp = *p; - char *retstr; - - while (*cp && isspace(*cp)) - cp++; - - retstr = cp; - while (*cp && *cp != ',') - cp++; - - if (*cp) { - *cp = '\0'; - cp++; - } - - *p = cp; - return (retstr); -} - -char * -hasmntopt(struct mnttab *mnt, char *opt) -{ - char tmpopts[MNT_LINE_MAX]; - char *f, *opts = tmpopts; - - if (mnt->mnt_mntopts == NULL) - return (NULL); - (void) strcpy(opts, mnt->mnt_mntopts); - f = mntopt(&opts); - for (; *f; f = mntopt(&opts)) { - if (strncmp(opt, f, strlen(opt)) == 0) - return (f - tmpopts + mnt->mnt_mntopts); - } - return (NULL); -} - -static void -optadd(char *mntopts, size_t size, const char *opt) -{ - - if (mntopts[0] != '\0') - strlcat(mntopts, ",", size); - strlcat(mntopts, opt, size); -} - -void -statfs2mnttab(struct statfs *sfs, struct mnttab *mp) -{ - static char mntopts[MNTMAXSTR]; - long flags; - - mntopts[0] = '\0'; - - flags = sfs->f_flags; -#define OPTADD(opt) optadd(mntopts, sizeof(mntopts), (opt)) - if (flags & MNT_RDONLY) - OPTADD(MNTOPT_RO); - else - OPTADD(MNTOPT_RW); - if (flags & MNT_NOSUID) - OPTADD(MNTOPT_NOSUID); - else - OPTADD(MNTOPT_SETUID); - if (flags & MNT_UPDATE) - OPTADD(MNTOPT_REMOUNT); - if (flags & MNT_NOATIME) - OPTADD(MNTOPT_NOATIME); - else - OPTADD(MNTOPT_ATIME); - OPTADD(MNTOPT_NOXATTR); - if (flags & MNT_NOEXEC) - OPTADD(MNTOPT_NOEXEC); - else - OPTADD(MNTOPT_EXEC); -#undef OPTADD - mp->mnt_special = sfs->f_mntfromname; - mp->mnt_mountp = sfs->f_mntonname; - mp->mnt_fstype = sfs->f_fstypename; - mp->mnt_mntopts = mntopts; -} - -static struct statfs *gsfs = NULL; -static int allfs = 0; - -static int -statfs_init(void) -{ - struct statfs *sfs; - int error; - - if (gsfs != NULL) { - free(gsfs); - gsfs = NULL; - } - allfs = getfsstat(NULL, 0, MNT_WAIT); - if (allfs == -1) - goto fail; - gsfs = malloc(sizeof(gsfs[0]) * allfs * 2); - if (gsfs == NULL) - goto fail; - allfs = getfsstat(gsfs, (long)(sizeof(gsfs[0]) * allfs * 2), - MNT_WAIT); - if (allfs == -1) - goto fail; - sfs = realloc(gsfs, allfs * sizeof(gsfs[0])); - if (sfs != NULL) - gsfs = sfs; - return (0); -fail: - error = errno; - if (gsfs != NULL) - free(gsfs); - gsfs = NULL; - allfs = 0; - return (error); -} - -int -getmntany(FILE *fd __unused, struct mnttab *mgetp, struct mnttab *mrefp) -{ - struct statfs *sfs; - int i, error; - - error = statfs_init(); - if (error != 0) - return (error); - - for (i = 0; i < allfs; i++) { - if (mrefp->mnt_special != NULL && - strcmp(mrefp->mnt_special, gsfs[i].f_mntfromname) != 0) { - continue; - } - if (mrefp->mnt_mountp != NULL && - strcmp(mrefp->mnt_mountp, gsfs[i].f_mntonname) != 0) { - continue; - } - if (mrefp->mnt_fstype != NULL && - strcmp(mrefp->mnt_fstype, gsfs[i].f_fstypename) != 0) { - continue; - } - statfs2mnttab(&gsfs[i], mgetp); - return (0); - } - return (-1); -} - -int -getmntent(FILE *fp, struct mnttab *mp) -{ - struct statfs *sfs; - int error, nfs; - - nfs = (int)lseek(fileno(fp), 0, SEEK_CUR); - if (nfs == -1) - return (errno); - /* If nfs is 0, we want to refresh out cache. */ - if (nfs == 0 || gsfs == NULL) { - error = statfs_init(); - if (error != 0) - return (error); - } - if (nfs >= allfs) - return (-1); - statfs2mnttab(&gsfs[nfs], mp); - if (lseek(fileno(fp), 1, SEEK_CUR) == -1) - return (errno); - return (0); -} diff --git a/cddl/compat/opensolaris/misc/thread_pool.c b/cddl/compat/opensolaris/misc/thread_pool.c deleted file mode 100644 index 6ae0055afceb..000000000000 --- a/cddl/compat/opensolaris/misc/thread_pool.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include -__FBSDID("$FreeBSD$"); - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include -#include -#include -#include "thread_pool_impl.h" - -typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */ - -static void -delete_pool(tpool_t *tpool) -{ - tpool_job_t *job; - - /* - * There should be no pending jobs, but just in case... - */ - for (job = tpool->tp_head; job != NULL; job = tpool->tp_head) { - tpool->tp_head = job->tpj_next; - free(job); - } - (void) pthread_attr_destroy(&tpool->tp_attr); - free(tpool); -} - -/* - * Worker thread is terminating. - */ -static void -worker_cleanup(void *arg) -{ - tpool_t *tpool = arg; - - if (--tpool->tp_current == 0 && - (tpool->tp_flags & (TP_DESTROY | TP_ABANDON))) { - if (tpool->tp_flags & TP_ABANDON) { - pthread_mutex_unlock(&tpool->tp_mutex); - delete_pool(tpool); - return; - } - if (tpool->tp_flags & TP_DESTROY) - (void) pthread_cond_broadcast(&tpool->tp_busycv); - } - pthread_mutex_unlock(&tpool->tp_mutex); -} - -static void -notify_waiters(tpool_t *tpool) -{ - if (tpool->tp_head == NULL && tpool->tp_active == NULL) { - tpool->tp_flags &= ~TP_WAIT; - (void) pthread_cond_broadcast(&tpool->tp_waitcv); - } -} - -/* - * Called by a worker thread on return from a tpool_dispatch()d job. - */ -static void -job_cleanup(void *arg) -{ - tpool_t *tpool = arg; - pthread_t my_tid = pthread_self(); - tpool_active_t *activep; - tpool_active_t **activepp; - - pthread_mutex_lock(&tpool->tp_mutex); - /* CSTYLED */ - for (activepp = &tpool->tp_active;; activepp = &activep->tpa_next) { - activep = *activepp; - if (activep->tpa_tid == my_tid) { - *activepp = activep->tpa_next; - break; - } - } - if (tpool->tp_flags & TP_WAIT) - notify_waiters(tpool); -} - -static void * -tpool_worker(void *arg) -{ - tpool_t *tpool = (tpool_t *)arg; - int elapsed; - tpool_job_t *job; - void (*func)(void *); - tpool_active_t active; - sigset_t maskset; - - pthread_mutex_lock(&tpool->tp_mutex); - pthread_cleanup_push(worker_cleanup, tpool); *** 577 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Mon May 24 14:56: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 6D605636903; Mon, 24 May 2021 14:56: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 4FpgKK2fGBz4lbM; Mon, 24 May 2021 14:56: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 3EFEC3E4D; Mon, 24 May 2021 14:56: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 14OEur4Q058638; Mon, 24 May 2021 14:56:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14OEurXY058637; Mon, 24 May 2021 14:56:53 GMT (envelope-from git) Date: Mon, 24 May 2021 14:56:53 GMT Message-Id: <202105241456.14OEurXY058637@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: 3fdd5c1e49cb - main - DRIVER_MODULE(9): Correct the SYNOPSIS of EARLY_DRIVER_MODULE() 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: 3fdd5c1e49cbc0a77935eb34e3561c6021b93650 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, 24 May 2021 14:56:53 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3fdd5c1e49cbc0a77935eb34e3561c6021b93650 commit 3fdd5c1e49cbc0a77935eb34e3561c6021b93650 Author: J.R. Oldroyd AuthorDate: 2021-05-24 14:54:45 +0000 Commit: Gordon Bergling CommitDate: 2021-05-24 14:54:45 +0000 DRIVER_MODULE(9): Correct the SYNOPSIS of EARLY_DRIVER_MODULE() The man page SYNOPSIS for EARLY_DRIVER_MODULE() shows that it has an "enum sysinit_elem_order order" argument. The actual macro in sys/bus.h does not have an order argument. PR: 256103 Reported by: J.R. Oldroyd Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30411 --- share/man/man9/DRIVER_MODULE.9 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man9/DRIVER_MODULE.9 b/share/man/man9/DRIVER_MODULE.9 index 8792e8930424..5d5927fba1e8 100644 --- a/share/man/man9/DRIVER_MODULE.9 +++ b/share/man/man9/DRIVER_MODULE.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 12, 2018 +.Dd May 24, 2021 .Dt DRIVER_MODULE 9 .Os .Sh NAME @@ -44,7 +44,7 @@ .In sys/module.h .Fn DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" .Fn DRIVER_MODULE_ORDERED name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "int order" -.Fn EARLY_DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "enum sysinit_elem_order order" "int pass" +.Fn EARLY_DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "int pass" .Fn EARLY_DRIVER_MODULE_ORDERED name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "enum sysinit_elem_order order" "int pass" .Sh DESCRIPTION The From owner-dev-commits-src-main@freebsd.org Mon May 24 16:45: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 F031B6386D2; Mon, 24 May 2021 16:45: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 4Fpjkm3zMgz4WK6; Mon, 24 May 2021 16:45: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 57AEA5559; Mon, 24 May 2021 16:45: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 14OGjaBH005674; Mon, 24 May 2021 16:45:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14OGjasN005673; Mon, 24 May 2021 16:45:36 GMT (envelope-from git) Date: Mon, 24 May 2021 16:45:36 GMT Message-Id: <202105241645.14OGjasN005673@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: 4483fb47735c - main - pf: fix ioctl() memory leak 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: 4483fb47735c29408c72045469c9c4b3e549668b 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, 24 May 2021 16:45:37 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4483fb47735c29408c72045469c9c4b3e549668b commit 4483fb47735c29408c72045469c9c4b3e549668b Author: Kristof Provost AuthorDate: 2021-05-24 06:32:16 +0000 Commit: Kristof Provost CommitDate: 2021-05-24 13:56:24 +0000 pf: fix ioctl() memory leak When we create an nvlist and insert it into another nvlist we must remember to destroy it. The nvlist_add_nvlist() function makes a copy, just like nvlist_add_string() makes a copy of the string. If we don't we're leaking memory on every (nvlist-based) ioctl() call. While here remove two redundant 'break' statements. PR: 255971 MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 91a175caa74f..5686a93f6e52 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1782,6 +1782,7 @@ pf_pool_to_nvpool(const struct pf_kpool *pool) if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "counter", tmp); + nvlist_destroy(tmp); nvlist_add_number(nvl, "tblidx", pool->tblidx); pf_uint16_array_nv(nvl, "proxy_port", pool->proxy_port, 2); @@ -1791,6 +1792,7 @@ pf_pool_to_nvpool(const struct pf_kpool *pool) if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "mape", tmp); + nvlist_destroy(tmp); return (nvl); @@ -1862,10 +1864,12 @@ pf_addr_wrap_to_nvaddr_wrap(const struct pf_addr_wrap *addr) if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "addr", tmp); + nvlist_destroy(tmp); tmp = pf_addr_to_nvaddr(&addr->v.a.mask); if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "mask", tmp); + nvlist_destroy(tmp); return (nvl); @@ -1930,6 +1934,7 @@ pf_rule_addr_to_nvrule_addr(const struct pf_rule_addr *addr) if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "addr", tmp); + nvlist_destroy(tmp); pf_uint16_array_nv(nvl, "port", addr->port, 2); nvlist_add_number(nvl, "neg", addr->neg); nvlist_add_number(nvl, "port_op", addr->port_op); @@ -2155,6 +2160,7 @@ pf_divert_to_nvdivert(const struct pf_krule *rule) if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "addr", tmp); + nvlist_destroy(tmp); nvlist_add_number(nvl, "port", rule->divert.port); return (nvl); @@ -2178,10 +2184,12 @@ pf_krule_to_nvrule(const struct pf_krule *rule) if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "src", tmp); + nvlist_destroy(tmp); tmp = pf_rule_addr_to_nvrule_addr(&rule->dst); if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "dst", tmp); + nvlist_destroy(tmp); for (int i = 0; i < PF_SKIP_COUNT; i++) { nvlist_append_number_array(nvl, "skip", @@ -2203,6 +2211,7 @@ pf_krule_to_nvrule(const struct pf_krule *rule) if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "rpool", tmp); + nvlist_destroy(tmp); nvlist_add_number(nvl, "evaluations", counter_u64_fetch(rule->evaluations)); @@ -2248,10 +2257,12 @@ pf_krule_to_nvrule(const struct pf_krule *rule) if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "uid", tmp); + nvlist_destroy(tmp); tmp = pf_rule_uid_to_nvrule_uid((const struct pf_rule_uid *)&rule->gid); if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "gid", tmp); + nvlist_destroy(tmp); nvlist_add_number(nvl, "rule_flag", rule->rule_flag); nvlist_add_number(nvl, "action", rule->action); @@ -2288,6 +2299,7 @@ pf_krule_to_nvrule(const struct pf_krule *rule) if (tmp == NULL) goto error; nvlist_add_nvlist(nvl, "divert", tmp); + nvlist_destroy(tmp); return (nvl); @@ -2532,6 +2544,7 @@ pf_state_peer_to_nvstate_peer(const struct pf_state_peer *peer) if (tmp == NULL) goto errout; nvlist_add_nvlist(nvl, "scrub", tmp); + nvlist_destroy(tmp); } nvlist_add_number(nvl, "seqlo", peer->seqlo); @@ -2568,26 +2581,31 @@ pf_state_to_nvstate(const struct pf_state *s) if (tmp == NULL) goto errout; nvlist_add_nvlist(nvl, "stack_key", tmp); + nvlist_destroy(tmp); tmp = pf_state_key_to_nvstate_key(s->key[PF_SK_WIRE]); if (tmp == NULL) goto errout; nvlist_add_nvlist(nvl, "wire_key", tmp); + nvlist_destroy(tmp); tmp = pf_state_peer_to_nvstate_peer(&s->src); if (tmp == NULL) goto errout; nvlist_add_nvlist(nvl, "src", tmp); + nvlist_destroy(tmp); tmp = pf_state_peer_to_nvstate_peer(&s->dst); if (tmp == NULL) goto errout; nvlist_add_nvlist(nvl, "dst", tmp); + nvlist_destroy(tmp); tmp = pf_addr_to_nvaddr(&s->rt_addr); if (tmp == NULL) goto errout; nvlist_add_nvlist(nvl, "rt_addr", tmp); + nvlist_destroy(tmp); nvlist_add_number(nvl, "rule", s->rule.ptr ? s->rule.ptr->nr : -1); nvlist_add_number(nvl, "anchor", @@ -3317,7 +3335,6 @@ DIOCADDRULENV_error: ruleset->rules[rs_num].active.ticket) { PF_RULES_WUNLOCK(); ERROUT(EBUSY); - break; } if ((error = nvlist_error(nvl))) { @@ -3331,7 +3348,6 @@ DIOCADDRULENV_error: if (rule == NULL) { PF_RULES_WUNLOCK(); ERROUT(EBUSY); - break; } nvrule = pf_krule_to_nvrule(rule); @@ -3344,6 +3360,7 @@ DIOCADDRULENV_error: } nvlist_add_number(nvl, "nr", nr); nvlist_add_nvlist(nvl, "rule", nvrule); + nvlist_destroy(nvrule); nvrule = NULL; if (pf_kanchor_nvcopyout(ruleset, rule, nvl)) { PF_RULES_WUNLOCK(); @@ -5912,6 +5929,7 @@ pf_getstate(struct pfioc_nv *nv) ERROUT(ENOMEM); nvlist_add_nvlist(nvl, "state", nvls); + nvlist_destroy(nvls); nvlpacked = nvlist_pack(nvl, &nv->len); if (nvlpacked == NULL) From owner-dev-commits-src-main@freebsd.org Mon May 24 18:44: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 8D9F863A330; Mon, 24 May 2021 18:44: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 4FpmN06fLMz3tRn; Mon, 24 May 2021 18:44: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 C05967522; Mon, 24 May 2021 18:44: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 14OIiWWT064223; Mon, 24 May 2021 18:44:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14OIiWlU064222; Mon, 24 May 2021 18:44:32 GMT (envelope-from git) Date: Mon, 24 May 2021 18:44:32 GMT Message-Id: <202105241844.14OIiWlU064222@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: 631449d5d035 - main - tcp: Fix an issue with the PUSH bit as well as fill in the missing mtu change for fsb's 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: 631449d5d03506295eaa6947c1b0e8a168a2f6b7 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, 24 May 2021 18:44:33 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=631449d5d03506295eaa6947c1b0e8a168a2f6b7 commit 631449d5d03506295eaa6947c1b0e8a168a2f6b7 Author: Randall Stewart AuthorDate: 2021-05-24 18:42:15 +0000 Commit: Randall Stewart CommitDate: 2021-05-24 18:42:15 +0000 tcp: Fix an issue with the PUSH bit as well as fill in the missing mtu change for fsb's The push bit itself was also not actually being properly moved to the right edge. The FIN bit was incorrectly on the left edge. We fix these two issues as well as plumb in the mtu_change for alternate stacks. Reviewed by: mtuexen Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30413 --- sys/netinet/tcp_stacks/rack.c | 8 ++++++-- sys/netinet/tcp_subr.c | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 2713554626e9..84e330efa74a 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6058,8 +6058,12 @@ rack_clone_rsm(struct tcp_rack *rack, struct rack_sendmap *nrsm, if (nrsm->r_flags & RACK_HAS_SYN) nrsm->r_flags &= ~RACK_HAS_SYN; /* Now if we have a FIN flag we keep it on the right edge */ - if (nrsm->r_flags & RACK_HAS_FIN) - nrsm->r_flags &= ~RACK_HAS_FIN; + if (rsm->r_flags & RACK_HAS_FIN) + rsm->r_flags &= ~RACK_HAS_FIN; + /* Push bit must go to the right edge as well */ + if (rsm->r_flags & RACK_HAD_PUSH) + rsm->r_flags &= ~RACK_HAD_PUSH; + /* * Now we need to find nrsm's new location in the mbuf chain * we basically calculate a new offset, which is soff + diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index c44f26f78a2f..de22310d241a 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -3407,6 +3407,15 @@ tcp_mtudisc(struct inpcb *inp, int mtuoffer) tp->snd_recover = tp->snd_max; if (tp->t_flags & TF_SACK_PERMIT) EXIT_FASTRECOVERY(tp->t_flags); + if (tp->t_fb->tfb_tcp_mtu_chg != NULL) { + /* + * Conceptually the snd_nxt setting + * and freeing sack holes should + * be done by the default stacks + * own tfb_tcp_mtu_chg(). + */ + tp->t_fb->tfb_tcp_mtu_chg(tp); + } tp->t_fb->tfb_tcp_output(tp); } From owner-dev-commits-src-main@freebsd.org Mon May 24 19:08: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 3FFF563A9D6; Mon, 24 May 2021 19:08:11 +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 4FpmvH0xJJz4WTq; Mon, 24 May 2021 19:08:11 +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 0585C7A19; Mon, 24 May 2021 19:08:11 +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 14OJ8AJw091750; Mon, 24 May 2021 19:08:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14OJ8AHT091749; Mon, 24 May 2021 19:08:10 GMT (envelope-from git) Date: Mon, 24 May 2021 19:08:10 GMT Message-Id: <202105241908.14OJ8AHT091749@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: 9bbd1a8fcb13 - main - tcp: fix a RACK socket buffer lock issue 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: 9bbd1a8fcb13928cd4b6cfddf0a8359d5dc97451 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, 24 May 2021 19:08:11 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=9bbd1a8fcb13928cd4b6cfddf0a8359d5dc97451 commit 9bbd1a8fcb13928cd4b6cfddf0a8359d5dc97451 Author: Michael Tuexen AuthorDate: 2021-05-24 18:31:23 +0000 Commit: Michael Tuexen CommitDate: 2021-05-24 18:31:23 +0000 tcp: fix a RACK socket buffer lock issue Fix a missing socket buffer unlocking of the socket receive buffer. Reviewed by: gallatin, rrs MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D30402 --- sys/netinet/tcp_stacks/rack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 84e330efa74a..71970e180808 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6063,7 +6063,7 @@ rack_clone_rsm(struct tcp_rack *rack, struct rack_sendmap *nrsm, /* Push bit must go to the right edge as well */ if (rsm->r_flags & RACK_HAD_PUSH) rsm->r_flags &= ~RACK_HAD_PUSH; - + /* * Now we need to find nrsm's new location in the mbuf chain * we basically calculate a new offset, which is soff + @@ -10482,6 +10482,7 @@ rack_do_fastnewdata(struct mbuf *m, struct tcphdr *th, struct socket *so, rack_handle_delayed_ack(tp, rack, tlen, 0); if (tp->snd_una == tp->snd_max) sack_filter_clear(&rack->r_ctl.rack_sf, tp->snd_una); + tcp_handle_wakeup(tp, so); return (1); } From owner-dev-commits-src-main@freebsd.org Mon May 24 19:58: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 D848263BAB3; Mon, 24 May 2021 19:58: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 4Fpp135SgLz4nkl; Mon, 24 May 2021 19:58: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 9F91B1082D; Mon, 24 May 2021 19:58: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 14OJwFrD057370; Mon, 24 May 2021 19:58:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14OJwFuI057369; Mon, 24 May 2021 19:58:15 GMT (envelope-from git) Date: Mon, 24 May 2021 19:58:15 GMT Message-Id: <202105241958.14OJwFuI057369@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 7b8696bf1287 - main - tests/libalias: Add missing copyright statements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b8696bf128754712a24ba98ce2d88eed2ee68dc 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, 24 May 2021 19:58:15 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=7b8696bf128754712a24ba98ce2d88eed2ee68dc commit 7b8696bf128754712a24ba98ce2d88eed2ee68dc Author: Lutz Donnerhacke AuthorDate: 2021-05-24 19:56:05 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-24 19:56:05 +0000 tests/libalias: Add missing copyright statements --- tests/sys/netinet/libalias/1_instance.c | 33 +++++++++++++++++++++++++++++++++ tests/sys/netinet/libalias/2_natout.c | 33 +++++++++++++++++++++++++++++++++ tests/sys/netinet/libalias/perf.c | 33 +++++++++++++++++++++++++++++++++ tests/sys/netinet/libalias/util.c | 33 +++++++++++++++++++++++++++++++++ tests/sys/netinet/libalias/util.h | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 165 insertions(+) diff --git a/tests/sys/netinet/libalias/1_instance.c b/tests/sys/netinet/libalias/1_instance.c index d2f20011c520..842acb41bb90 100644 --- a/tests/sys/netinet/libalias/1_instance.c +++ b/tests/sys/netinet/libalias/1_instance.c @@ -1,3 +1,36 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2021 Lutz Donnerhacke + * + * 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. + * 3. Neither the name of the copyright holder 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. + */ #include #include #include diff --git a/tests/sys/netinet/libalias/2_natout.c b/tests/sys/netinet/libalias/2_natout.c index 513ff359b1d9..5b3e9a906bf5 100644 --- a/tests/sys/netinet/libalias/2_natout.c +++ b/tests/sys/netinet/libalias/2_natout.c @@ -1,3 +1,36 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2021 Lutz Donnerhacke + * + * 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. + * 3. Neither the name of the copyright holder 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. + */ #include #include #include diff --git a/tests/sys/netinet/libalias/perf.c b/tests/sys/netinet/libalias/perf.c index fadbb439774a..365b8f2e9fcc 100644 --- a/tests/sys/netinet/libalias/perf.c +++ b/tests/sys/netinet/libalias/perf.c @@ -1,3 +1,36 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2021 Lutz Donnerhacke + * + * 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. + * 3. Neither the name of the copyright holder 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. + */ #include #include #include diff --git a/tests/sys/netinet/libalias/util.c b/tests/sys/netinet/libalias/util.c index 5e880752d261..df2e320a4eba 100644 --- a/tests/sys/netinet/libalias/util.c +++ b/tests/sys/netinet/libalias/util.c @@ -1,3 +1,36 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2021 Lutz Donnerhacke + * + * 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. + * 3. Neither the name of the copyright holder 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. + */ #include #include diff --git a/tests/sys/netinet/libalias/util.h b/tests/sys/netinet/libalias/util.h index 5edbadb2f64a..f441aea49cfb 100644 --- a/tests/sys/netinet/libalias/util.h +++ b/tests/sys/netinet/libalias/util.h @@ -1,3 +1,36 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2021 Lutz Donnerhacke + * + * 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. + * 3. Neither the name of the copyright holder 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. + */ #include #include From owner-dev-commits-src-main@freebsd.org Mon May 24 22:12: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 9D70163E6B0; Mon, 24 May 2021 22:12: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 4Fps0H3sM9z4bWL; Mon, 24 May 2021 22:12: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 6D5DE12346; Mon, 24 May 2021 22:12: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 14OMCloW042753; Mon, 24 May 2021 22:12:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14OMClRr042752; Mon, 24 May 2021 22:12:47 GMT (envelope-from git) Date: Mon, 24 May 2021 22:12:47 GMT Message-Id: <202105242212.14OMClRr042752@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: fbf75b113edc - main - arm64: log vm_fault error for data_abort 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: fbf75b113edca08c78af8db4730f9fa84e54ad24 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, 24 May 2021 22:12:47 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fbf75b113edca08c78af8db4730f9fa84e54ad24 commit fbf75b113edca08c78af8db4730f9fa84e54ad24 Author: Bjoern A. Zeeb AuthorDate: 2021-05-20 16:43:30 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-24 21:58:11 +0000 arm64: log vm_fault error for data_abort Summary: Log the vm_fault() error in the data_abort panic so it is easier to find the reason vm_fault() failed (e.g., invalid address). Reviewed by: andrew MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30362 --- sys/arm64/arm64/trap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index d793e34a6894..8688f8679267 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -334,7 +334,8 @@ data_abort(struct thread *td, struct trapframe *frame, uint64_t esr, return; } #endif - panic("vm_fault failed: %lx", frame->tf_elr); + panic("vm_fault failed: %lx error %d", + frame->tf_elr, error); } } From owner-dev-commits-src-main@freebsd.org Tue May 25 03:40: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 3A0A864315E; Tue, 25 May 2021 03:40: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 4Fq0Ft0yXJz3rTC; Tue, 25 May 2021 03:40: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 07CAB165B8; Tue, 25 May 2021 03:40: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 14P3e1Yb068418; Tue, 25 May 2021 03:40:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14P3e12A068415; Tue, 25 May 2021 03:40:01 GMT (envelope-from git) Date: Tue, 25 May 2021 03:40:01 GMT Message-Id: <202105250340.14P3e12A068415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 27f09959d5f5 - main - taskqueue: Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27f09959d5f507465cc7f202c1b34987f0cdee55 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, 25 May 2021 03:40:02 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=27f09959d5f507465cc7f202c1b34987f0cdee55 commit 27f09959d5f507465cc7f202c1b34987f0cdee55 Author: Colin Percival AuthorDate: 2021-05-25 03:37:55 +0000 Commit: Colin Percival CommitDate: 2021-05-25 03:37:55 +0000 taskqueue: Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD arguments to prevent compilation errors. Submitted by: ashafer_badland.io MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30449 --- sys/sys/taskqueue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/taskqueue.h b/sys/sys/taskqueue.h index f0cc00af986e..7e59187e0114 100644 --- a/sys/sys/taskqueue.h +++ b/sys/sys/taskqueue.h @@ -191,7 +191,7 @@ SYSINIT(taskqueue_##name, SI_SUB_TASKQ, SI_ORDER_SECOND, \ struct __hack #define TASKQUEUE_FAST_DEFINE_THREAD(name) \ TASKQUEUE_FAST_DEFINE(name, taskqueue_thread_enqueue, \ - &taskqueue_##name, taskqueue_start_threads(&taskqueue_##name \ + &taskqueue_##name, taskqueue_start_threads(&taskqueue_##name, \ 1, PWAIT, "%s taskq", #name)) /* From owner-dev-commits-src-main@freebsd.org Tue May 25 12:40: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 3F2A464C206 for ; Tue, 25 May 2021 12:40:42 +0000 (UTC) (envelope-from dgr@semihalf.com) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (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 4FqDFj48p9z3rCt for ; Tue, 25 May 2021 12:40:41 +0000 (UTC) (envelope-from dgr@semihalf.com) Received: by mail-ed1-x530.google.com with SMTP id j10so18457972edw.8 for ; Tue, 25 May 2021 05:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=CAR7PmYlqvgRsz/aJ78FQ3BI0g4vNeADhk04qZJn3CU=; b=rXe2KHWPE0Ga472HnVDx5lu0elsDe/Jt9z48kvXIrxZ92UUTmdxs0HQFkJhaU6pAoe TUBj0iQgQ2SxgFMLFV8b9eqADl6N1nqx36DtiXhQY409aQStZGc2SUgOhAT8s/pvBLw+ IBC8As7R4Jntmc/2Utn1NRVsi60T39LoJgrNc4AL7ZayOuS8j5nhxpB1i07Ts87vqPkT eEi8ndvupdPUPgcwZNSYuL56cVB9eclISacle1oRVax0x2Ms2fQpLzEkOSdPMZiM5WDJ 6eh4+9USxuGMovZq+5AULv+WSvo48Jr1TyBUdPEgigXXZE7MAY1Osb22j7eTgbStpuMF Whrg== 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:content-transfer-encoding; bh=CAR7PmYlqvgRsz/aJ78FQ3BI0g4vNeADhk04qZJn3CU=; b=URZDo7FYk0PTCksV34tFv0VGYE3OZfOG4di6xuf8JEW1VmeUfL6GWPTifMrkq03jrm JdCCQzQIvE4v4sfIAIV6EzjFIJ5CXeY1m/rsMIN3m1PBfKGnO+y8Cz1hFccNCFkhn/kG ryDA1zKSp16o3UDEhrbgDFNy32bRuElV6fSBUisQQKsZgHCW2esU8R6vuSZSaAP6ioQH KmIS4e6RpmoJJPlXMVYWQUoun3hWQ2lqkSnj7OBLV81xyDT4kKAY14K9UYC1WWW2iIlA idPGNn80DTMlfEjbwXCOJFYdtYTfen69o73NIv65g6xajNaNzS/riQF59JYenTALlf8w tYLg== X-Gm-Message-State: AOAM533PTlzBwTI5Trie98ZtoJZBTdSkBwOCNA0t/16mOsQ5WlXBBwG6 gmdgGrkJSrcbVYMFBDrJf/6zhIogHIe4sIOjMQzV9w== X-Google-Smtp-Source: ABdhPJz2Wt19OK+WTRLAoIJt4WlOJrndLrdn19+2V4dvuc0blGAZxSM0LErMtlBRe8R6woj9jIs745+2vIHQbVpH/aQ= X-Received: by 2002:a05:6402:17d9:: with SMTP id s25mr31376743edy.337.1621946439575; Tue, 25 May 2021 05:40:39 -0700 (PDT) MIME-Version: 1.0 References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> <04F25FD0-7863-4AC1-A257-EF0F1EB90659@freebsd.org> <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org> <202105211446.14LEk8kZ009266@slippy.cwsent.com> <202105211753.14LHrpAN004663@slippy.cwsent.com> In-Reply-To: <202105211753.14LHrpAN004663@slippy.cwsent.com> From: =?UTF-8?Q?Dawid_G=C3=B3recki?= Date: Tue, 25 May 2021 14:34:10 +0200 Message-ID: Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. To: Cy Schubert Cc: Marcin Wojtas , Jessica Clarke , shawn.webb@hardenedbsd.org, Marcin Wojtas , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4FqDFj48p9z3rCt X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=rXe2KHWP; dmarc=none; spf=none (mx1.freebsd.org: domain of dgr@semihalf.com has no SPF policy when checking 2a00:1450:4864:20::530) smtp.mailfrom=dgr@semihalf.com X-Spamd-Result: default: False [0.70 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[semihalf-com.20150623.gappssmtp.com:s=20150623]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(1.00)[0.995]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; DMARC_NA(0.00)[semihalf.com]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::530:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[semihalf-com.20150623.gappssmtp.com:+]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::530:from]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::530:from]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main] 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, 25 May 2021 12:40:42 -0000 Hi Cy, On Fri, May 21, 2021 at 10:53:51AM -0700, Cy Schubert wrote: > In message om> > , Marcin Wojtas writes: > > Hi Cy, > > > > pt., 21 maj 2021 o 16:46 Cy Schubert napisa= =C5=82(a): > > > > > > In message <02078965-24BE-4F23-92D5-5E8E54A0C3E7@freebsd.org>, Jessic= a > > > Clarke w > > > rites: > > > > > On 21 May 2021, at 15:11, Marcin Wojtas wrote: > > > > > > > > > > Hi Jess > > > > > > > > > > pt., 21 maj 2021 o 15:39 Jessica Clarke napi= sa=C5=82(a > > ): > > > > >> > > > > >> On 21 May 2021, at 14:34, Marcin Wojtas wrote: > > > > >>> > > > > >>> The branch main has been updated by mw: > > > > >>> > > > > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3Daf949c590bd8a00a= 5973b587 > > 5d7e > > > > 0fa6832ea64a > > > > >>> > > > > >>> commit af949c590bd8a00a5973b5875d7e0fa6832ea64a > > > > >>> Author: Marcin Wojtas > > > > >>> AuthorDate: 2021-05-21 09:29:22 +0000 > > > > >>> Commit: Marcin Wojtas > > > > >>> CommitDate: 2021-05-21 13:33:06 +0000 > > > > >>> > > > > >>> Disable stack gap for ntpd during build. > > > > >>> > > > > >>> When starting, ntpd calls setrlimit(2) to limit maximum size = of its > > > > >>> stack. The stack limit chosen by ntpd is 200K, so when stack = gap > > > > >>> is enabled, the stack gap is larger than this limit, which re= sults > > > > >>> in ntpd crashing. > > > > >> > > > > >> Isn=E2=80=99t the bug that the unusable gap counts as usage? > > > > >> > > > > >> Jess > > > > >> > > > > > > > > > > An alternative solution was submitted > > > > > (https://reviews.freebsd.org/D29832), so that to extend the limit= for > > > > > ntpd, but eventually it was recommended to simple disable the sta= ck > > > > > gap for it until it's fixed upstream (see the last comment in the > > > > > linked revision). > > > > > > > > That=E2=80=99s my point, there is nothing to =E2=80=9Cfix=E2=80=9D = upstream. NTPD uses less > > tha > > > > n 200K > > > > of stack, thus it is perfectly reasonable for it to set its limit t= o that > > . Th > > > > e > > > > fact that FreeBSD decides to count an arbitrary, non-deterministic = amount > > of > > > > additional unusable virtual address space towards that limit is not= its f > > ault > > > > , > > > > but a bug in FreeBSD that needs to be fixed as it=E2=80=99s entirel= y unreasonab > > le f > > > > or > > > > applications to have to account for that. > > > > > > This latest problem is not stack gap. It is PIE. > > > > > > > I have to disagree. > > We are talking cross purposes. Your examples later on in your email prove > my point. > > > ntpd does not start because of stack gap, not PIE, even though it may > > seem like PIE causes this. This is due to the fact that stack gap is > > disabled if PIE is disabled. Because of that value of sysctl > > kern.elf64.aslr.stack_gap does not matter when kern.elf64.aslr.pie_enab= le > > is set to 0. When pie_enabled is set to 1 and stack gap is enabled, the= n > > ntpd fails to start, but when pie_enabled is set to 1 and stack_gap > > is set to 0, then ntpd starts without any issue. We verified this on > > FreeBSD-CURRENT snapshot from 2021-05-20. > > I verified the PIE problem on a -CURRENT as of my comments in the review. > Enabling stack gap and disabling PIE resolved the issue. The reason for > stack gap is not a problem is that ntpd disables stack gap at line 441 of > ntpd.c. > > Furthermore enabling stack gap and disabling PIE circumvents the problem.= I > tested this myself and left that note in the review. > > Enable stack gap and disable PIE: It works. But look at line 441 of ntpd.= c > to see stack gap disabled before ntpd forks itself. The issue is caused by stack gap, not by PIE. However, it may seem like pie_enabled sysctl causes it. ASLR stack gap is only created if kern.elf.aslr.pie_enable is set to 1 when the binary has ET_DYN type. For ET_EXEC type, sysctl kern.elf.aslr.enable has to be set to 1 instead. Otherwise, the value of kern.elf.aslr.stack_gap will be ignored and it will work as if set to 0. The code governing this behavior can be found in sys/kern/imgact_elf.c lines 1175-1196, 1228-1232 and in sys/kern/kern_exec.c lines 1547-1557. About procctl - in FreeBSD there are in fact two different stack gaps. One is the stack gap located at the bottom of the stack, the second one has a random size and is located at the top of the stack. The second stack gap is related to ASLR, while the first exists to prevent stack overflow overwriting nearby mappings. Procctl only affects the first stack gap, the second one - which is causing the segfault - is not affected by procctl. > > > > > The fact that this is a stack gap issue can be verified using following > > procedure: > > 1. Install FreeBSD-CURRENT snapshot from 2021-05-20 using default > > configuration. > > 2. On a newly installed system start ntpd. With default configuration > > it should start successfully. > > 3. Set sysctl kern.elf64.aslr.pie_enable=3D1 and start ntpd. This time = ntpd > > should fail. An entry indicating that ntpd was killed because of signal > > 11 should be visible in /var/log/messages. > > 4. Set sysctl kern.elf64.aslr.stack_gap=3D0 and start ntpd once again. = This > > time ntpd should start even though pie_enable is set to 1. > > > > Exact log from the boot it was tested: > > root@freebsd-ntpd-test:~ # sysctl -a | grep aslr > > kern.elf32.aslr.stack_gap: 3 > > kern.elf32.aslr.honor_sbrk: 1 > > kern.elf32.aslr.pie_enable: 0 > > kern.elf32.aslr.enable: 0 > > kern.elf64.aslr.stack_gap: 3 > > kern.elf64.aslr.honor_sbrk: 1 > > kern.elf64.aslr.pie_enable: 0 > > kern.elf64.aslr.enable: 0 > > vm.aslr_restarts: 0 > > root@freebsd-ntpd-test:~ # ntpd > > root@freebsd-ntpd-test:~ # ps aux | grep ntpd > > root 826 0.0 0.2 22060 6960 - Ss 17:38 0:00.01 ntpd > > root 828 0.0 0.1 12976 2416 0 S+ 17:38 0:00.00 grep ntpd > > root@freebsd-ntpd-test:~ # killall ntpd > > root@freebsd-ntpd-test:~ # ps aux | grep ntpd > > root 831 0.0 0.1 12976 2416 0 S+ 17:38 0:00.00 grep ntpd > > root@freebsd-ntpd-test:~ # sysctl kern.elf64.aslr.pie_enable=3D1 > > kern.elf64.aslr.pie_enable: 0 -> 1 > > This causes the problem. Yes, this seems to cause the problem. However, what really happens is that along with pie_enable, the stack gap is enabled. When pie_enable was set to 0, stack_gap was ignored. > > > root@freebsd-ntpd-test:~ # ntpd > > root@freebsd-ntpd-test:~ # ps aux | grep ntpd > > root 836 0.0 0.1 14128 2452 0 S+ 17:39 0:00.00 grep ntpd > > root@freebsd-ntpd-test:~ # cat /var/log/messages | tail > > May 21 17:38:25 freebsd-ntpd-test ntpd[826]: ntpd exiting on signal 15 > > (Terminated) > > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: ntpd 4.2.8p15-a (1): Start= ing > > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: Command line: ntpd > > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: > > ---------------------------------------------------- > > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: ntp-4 is maintained by > > Network Time Foundation, > > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: Inc. (NTF), a non-profit > > 501(c)(3) public-benefit > > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: corporation. Support and > > training for ntp-4 are > > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: available at > > https://www.nwtime.org/support > > May 21 17:39:14 freebsd-ntpd-test ntpd[833]: > > ---------------------------------------------------- > > May 21 17:39:14 freebsd-ntpd-test kernel: pid 834 (ntpd), jid 0, uid > > 0: exited on signal 11 (core dumped) This happened when kern.elf64.aslr.pie_enable=3D1 and kern.elf64.aslr.stack_gap=3D3. > > root@freebsd-ntpd-test:~ # sysctl kern.elf64.aslr.stack_gap=3D0 > > kern.elf64.aslr.stack_gap: 3 -> 0 > > root@freebsd-ntpd-test:~ # sysctl -a | grep aslr > > kern.elf32.aslr.stack_gap: 3 > > kern.elf32.aslr.honor_sbrk: 1 > > kern.elf32.aslr.pie_enable: 0 > > kern.elf32.aslr.enable: 0 > > kern.elf64.aslr.stack_gap: 0 > > kern.elf64.aslr.honor_sbrk: 1 > > kern.elf64.aslr.pie_enable: 1 > > This is the problem. At this point the stack gap was disabled while still leaving pie_enable set to 1. > > > kern.elf64.aslr.enable: 0 > > vm.aslr_restarts: 1 > > root@freebsd-ntpd-test:~ # ntpd > > root@freebsd-ntpd-test:~ # ps aux | grep ntpd > > root 845 0.0 0.2 22060 6924 - Ss 17:40 0:00.01 ntpd > > root 847 0.0 0.1 12976 2440 0 S+ 17:40 0:00.00 grep ntpd Here the ntpd daemon started with pie_enable set to 1. stack_gap was set to 0. No segfault. > > root@freebsd-ntpd-test:~ # cat /var/log/messages | tail > > May 21 17:39:14 freebsd-ntpd-test kernel: pid 834 (ntpd), jid 0, uid > > 0: exited on signal 11 (core dumped) > > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: ntpd 4.2.8p15-a (1): Start= ing > > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: Command line: ntpd > > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: > > ---------------------------------------------------- > > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: ntp-4 is maintained by > > Network Time Foundation, > > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: Inc. (NTF), a non-profit > > 501(c)(3) public-benefit > > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: corporation. Support and > > training for ntp-4 are > > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: available at > > https://www.nwtime.org/support > > May 21 17:40:52 freebsd-ntpd-test ntpd[844]: > > ---------------------------------------------------- > > May 21 17:40:52 freebsd-ntpd-test ntpd[845]: leapsecond file > > ('/var/db/ntpd.leap-seconds.list'): stat failed: No such file or > > directory > > root@freebsd-ntpd-test:~ # killall ntpd > > > > Best regards, > > Marcin > > Running on my firewall, which has had this same ASLR configuration for > about a year. > > cwfw# sysctl kern.elf64.aslr > kern.elf64.aslr.stack_gap: 3 > kern.elf64.aslr.honor_sbrk: 1 > kern.elf64.aslr.pie_enable: 0 > kern.elf64.aslr.enable: 1 > cwfw# ps auxww | grep ntpd > ntpd 1499 0.0 0.1 22044 5776 - Ss 09:30 0:00.28 > /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f > /var/db/ntp/ntpd.drift -g > root 3032 0.0 0.0 13044 2384 0 S+ 10:49 0:00.00 grep ntpd > cwfw# uptime > 10:49AM up 1:20, 1 user, load averages: 1.06, 1.02, 0.97 > cwfw# uname -a > FreeBSD cwfw 14.0-CURRENT FreeBSD 14.0-CURRENT #151 > komquats-n246804-af949c590bd8-dirty: Fri May 21 07:09:32 PDT 2021 > root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/PROD2 amd64 > cwfw# > > My laptop: > > slippy# sysctl kern.elf64.aslr > kern.elf64.aslr.stack_gap: 3 > kern.elf64.aslr.honor_sbrk: 1 > kern.elf64.aslr.pie_enable: 0 > kern.elf64.aslr.enable: 1 > slippy# ps auxww | grep ntpd > ntpd 2100 0.0 0.1 22036 8600 - Ss 09:35 0:00.27 > /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f > /var/db/ntp/ntpd.drift -g > root 4632 0.0 0.0 13040 2724 1 S+ 10:51 0:00.00 grep ntpd > slippy# uptime > 10:51AM up 1:17, 0 users, load averages: 0.11, 0.16, 0.16 > slippy# uname -a > FreeBSD slippy 14.0-CURRENT FreeBSD 14.0-CURRENT #155 > komquats-n246804-af949c590bd8-dirty: Fri May 21 07:07:22 PDT 2021 > root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64 > slippy# > > One of my poudriere machines: > > cwsys# sysctl kern.elf64.aslr > kern.elf64.aslr.stack_gap: 3 > kern.elf64.aslr.honor_sbrk: 1 > kern.elf64.aslr.pie_enable: 0 > kern.elf64.aslr.enable: 1 > cwsys# ps auxww | grep ntpd > ntpd 4039 0.0 0.1 22040 7340 - Ss 09:34 0:00.46 > /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f > /var/db/ntp/ntpd.drift -g > root 6385 0.0 0.0 13044 2712 2 S+ 10:52 0:00.01 grep ntpd > cwsys# uptime > 10:52AM up 1:19, 2 users, load averages: 0.26, 0.25, 0.24 > cwsys# uname -a > FreeBSD cwsys 14.0-CURRENT FreeBSD 14.0-CURRENT #155 > komquats-n246804-af949c590bd8-dirty: Fri May 21 07:07:22 PDT 2021 > root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64 > cwsys# > > Three examples of stack gap enabled and PIE disabled. When I enable PIE, > ntpd fails. If the binaries are ET_DYN type, the stack gap is actually disabled. Since this is 14 this is most likely the case, unless explicitly disabled by using WITHOUT_PIE build option. > > > -- > 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. > > You can also see that on 13.0-RELEASE ntpd will also segfault, but instead of kern.elf64.aslr.pie_enabled set to 1, kern.elf64.aslr.enabled should be set to 1. This is due to the fact that 13 is built with WITHOUT_PIE option and the executables are of ET_EXEC type. Again, you can set stack_gap to 0 there and the problem will disappear. Setting kern.elf64.aslr.stack_gap to value > 0 does not necessarily mean that stack gap is actually enabled, so the whole situation can be confusing. Best regards, Dawid From owner-dev-commits-src-main@freebsd.org Tue May 25 14:17: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 BB14864DB0C; Tue, 25 May 2021 14:17:48 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (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 4FqGPl4kGLz4vBH; Tue, 25 May 2021 14:17:47 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f174.google.com with SMTP id l15so16678054ilh.1; Tue, 25 May 2021 07:17:47 -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=cbMq2Spy3K2W/CreNS4TRXRoKaKGxG77laS/bUqdWuA=; b=E8dP1j3uU339b45+9kIQdyEjqpE7/NYpz9+UGIgjZLwZnLGDj77OOTaJcargdRIqlp Hh2X7iCMpHwiUL2YgwVl3KIMJOz770n+aLuXusSom1weoW0/8zEcVdnccQEDW8/BsVRx URN09RRngpgHbzVfTCGWdnlHLZ0HwHO5AKg4Z1hZirJICcrFQjRP75LCQbCxBkTccj+b d9xWnh2TiVRroSkeBR3Gz0fkP6BJrOPkeA22Ef1A7hbFrBg9AWwuXIaADqd4GQbyfOW1 w1luBnCq7iCW/QCCWrhBoji2kfca1pc4GMLkaD2DuPLvWtmH6V5llL3B2e63WadXNWSg gxeg== X-Gm-Message-State: AOAM531ASwPlvsBYMcUCNOkSKZKkeIhcjIedZjYNfJ3M9h/vpZ1tWO1V Xo8KtAITb1DR9mwP5tVQjhHtOeRopCiMNl2If+KY+TsA X-Google-Smtp-Source: ABdhPJyjT230L8X4oqJLo7sk7CNpgxVuJyrIUfbo8AH8BJ8rh7YpmFri52mKX3mAqZPOQfGmiSKViv+kQccyX25HtyY= X-Received: by 2002:a92:cf45:: with SMTP id c5mr23214230ilr.182.1621952261227; Tue, 25 May 2021 07:17:41 -0700 (PDT) MIME-Version: 1.0 References: <202105211334.14LDYqoa004343@gitrepo.freebsd.org> <20210521172824.GI60173@spindle.one-eyed-alien.net> In-Reply-To: <20210521172824.GI60173@spindle.one-eyed-alien.net> From: Ed Maste Date: Tue, 25 May 2021 10:17:13 -0400 Message-ID: Subject: Re: git: af949c590bd8 - main - Disable stack gap for ntpd during build. To: Brooks Davis Cc: Marcin Wojtas , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4FqGPl4kGLz4vBH X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.174 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [0.99 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.166.174:from]; RCVD_COUNT_TWO(0.00)[2]; FREEFALL_USER(0.00)[carpeddiem]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[209.85.166.174:from:127.0.2.255]; NEURAL_SPAM_SHORT(0.99)[0.991]; RCVD_TLS_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.174:from]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.174:from]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] 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, 25 May 2021 14:17:48 -0000 On Fri, 21 May 2021 at 13:28, Brooks Davis wrote: > > elfctl should also > probably be taught not to write to the file if nothing changes. Yes, we should definitely do this, I'll take a look. From owner-dev-commits-src-main@freebsd.org Tue May 25 15:19: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 346CF64E87E; Tue, 25 May 2021 15:19: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 4FqHmR0nlxz3HgC; Tue, 25 May 2021 15:19: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 F3CDA1FAD1; Tue, 25 May 2021 15:19: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 14PFJ2f7000172; Tue, 25 May 2021 15:19:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFJ2i4000171; Tue, 25 May 2021 15:19:02 GMT (envelope-from git) Date: Tue, 25 May 2021 15:19:02 GMT Message-Id: <202105251519.14PFJ2i4000171@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 28027f28e607 - main - cam: remove sim callout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28027f28e607012b83ee9062eed3b8ed82e819c1 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, 25 May 2021 15:19:03 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=28027f28e607012b83ee9062eed3b8ed82e819c1 commit 28027f28e607012b83ee9062eed3b8ed82e819c1 Author: Warner Losh AuthorDate: 2021-05-25 15:14:32 +0000 Commit: Warner Losh CommitDate: 2021-05-25 15:18:08 +0000 cam: remove sim callout Nothing is using the sim callout to unfreeze the queue. Remove it to simplify the SIM. This was introduced in the original CAM commit in 1998 but setting the CAM_SIM_REL_TIMEOUT_PENDING flag was removed in 1999 in commit 87cfaf0e1fbd which reworked how bus reset worked. That work was merged just after 3.2R was released. Remove the unused residuals. Sponsored by: Netflix Reviewed by: scottl@, mav@ Differential Revision: https://reviews.freebsd.org/D30383 --- sys/cam/cam_sim.c | 1 - sys/cam/cam_sim.h | 2 -- sys/cam/cam_xpt.c | 9 --------- 3 files changed, 12 deletions(-) diff --git a/sys/cam/cam_sim.c b/sys/cam/cam_sim.c index 64427795426e..42fe14b5e991 100644 --- a/sys/cam/cam_sim.c +++ b/sys/cam/cam_sim.c @@ -126,7 +126,6 @@ cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll, sim->refcount = 1; sim->devq = queue; sim->mtx = mtx; - callout_init(&sim->callout, 1); return (sim); } diff --git a/sys/cam/cam_sim.h b/sys/cam/cam_sim.h index a1595a51fadb..956084c41da5 100644 --- a/sys/cam/cam_sim.h +++ b/sys/cam/cam_sim.h @@ -102,8 +102,6 @@ struct cam_sim { int max_tagged_dev_openings; int max_dev_openings; u_int32_t flags; -#define CAM_SIM_REL_TIMEOUT_PENDING 0x01 - struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ int refcount; /* References to the SIM. */ device_t sim_dev; /* For attached peripherals. */ diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 91bac149c061..4bd71f1cd93b 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4607,15 +4607,6 @@ xpt_release_simq(struct cam_sim *sim, int run_queue) } else devq->send_queue.qfrozen_cnt--; if (devq->send_queue.qfrozen_cnt == 0) { - /* - * If there is a timeout scheduled to release this - * sim queue, remove it. The queue frozen count is - * already at 0. - */ - if ((sim->flags & CAM_SIM_REL_TIMEOUT_PENDING) != 0){ - callout_stop(&sim->callout); - sim->flags &= ~CAM_SIM_REL_TIMEOUT_PENDING; - } if (run_queue) { /* * Now that we are unfrozen run the send queue. From owner-dev-commits-src-main@freebsd.org Tue May 25 15:19: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 5053264E464; Tue, 25 May 2021 15:19: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 4FqHmS1dkDz3Ht9; Tue, 25 May 2021 15:19: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 1F26C1F86F; Tue, 25 May 2021 15:19: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 14PFJ4kr000193; Tue, 25 May 2021 15:19:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFJ4DH000192; Tue, 25 May 2021 15:19:04 GMT (envelope-from git) Date: Tue, 25 May 2021 15:19:04 GMT Message-Id: <202105251519.14PFJ4DH000192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 6c4813427505 - main - cam: Remove CAM_SIM_LOCK/UNLOCK macros, they are unused. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c48134275059c55f7ffbc07e3fb61516e670d65 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, 25 May 2021 15:19:04 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6c48134275059c55f7ffbc07e3fb61516e670d65 commit 6c48134275059c55f7ffbc07e3fb61516e670d65 Author: Warner Losh AuthorDate: 2021-05-25 15:16:29 +0000 Commit: Warner Losh CommitDate: 2021-05-25 15:18:08 +0000 cam: Remove CAM_SIM_LOCK/UNLOCK macros, they are unused. Sponsored by: Netflix Reviewed by: mav@ Differential Revision: https://reviews.freebsd.org/D30384 --- sys/cam/cam_sim.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/cam/cam_sim.h b/sys/cam/cam_sim.h index 956084c41da5..4becc715f13e 100644 --- a/sys/cam/cam_sim.h +++ b/sys/cam/cam_sim.h @@ -107,9 +107,6 @@ struct cam_sim { device_t sim_dev; /* For attached peripherals. */ }; -#define CAM_SIM_LOCK(sim) mtx_lock((sim)->mtx) -#define CAM_SIM_UNLOCK(sim) mtx_unlock((sim)->mtx) - static __inline u_int32_t cam_sim_path(const struct cam_sim *sim) { From owner-dev-commits-src-main@freebsd.org Tue May 25 15:19: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 B41BC64E8A9; Tue, 25 May 2021 15:19: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 4FqHmT3l9Lz3Hwm; Tue, 25 May 2021 15:19: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 4176A1FAD2; Tue, 25 May 2021 15:19: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 14PFJ5ne000220; Tue, 25 May 2021 15:19:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFJ5i4000219; Tue, 25 May 2021 15:19:05 GMT (envelope-from git) Date: Tue, 25 May 2021 15:19:05 GMT Message-Id: <202105251519.14PFJ5i4000219@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1f348be6f243 - main - cam: remove xpt_polled_action MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f348be6f243da1a474c5cf119aa874308f2146f 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, 25 May 2021 15:19:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1f348be6f243da1a474c5cf119aa874308f2146f commit 1f348be6f243da1a474c5cf119aa874308f2146f Author: Warner Losh AuthorDate: 2021-05-25 15:16:49 +0000 Commit: Warner Losh CommitDate: 2021-05-25 15:18:08 +0000 cam: remove xpt_polled_action Since periph_runccb now handles all the polling stuff, and xpt_polled_action is now unused and can be removed. Sponsored by: Netflix Reviewed by: mav@ Differential Revision: https://reviews.freebsd.org/D30394 --- sys/cam/cam_xpt.c | 22 ---------------------- sys/cam/cam_xpt_periph.h | 1 - 2 files changed, 23 deletions(-) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 4bd71f1cd93b..762feaf5dd49 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -3273,28 +3273,6 @@ xpt_pollwait(union ccb *start_ccb, uint32_t timeout) } } -void -xpt_polled_action(union ccb *start_ccb) -{ - uint32_t timeout; - struct cam_ed *dev; - - timeout = start_ccb->ccb_h.timeout * 10; - dev = start_ccb->ccb_h.path->device; - - mtx_unlock(&dev->device_mtx); - - timeout = xpt_poll_setup(start_ccb); - if (timeout > 0) { - xpt_action(start_ccb); - xpt_pollwait(start_ccb, timeout); - } else { - start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; - } - - mtx_lock(&dev->device_mtx); -} - /* * Schedule a peripheral driver to receive a ccb when its * target device has space for more transactions. diff --git a/sys/cam/cam_xpt_periph.h b/sys/cam/cam_xpt_periph.h index 15d98cc81d1f..f998d3bfa3b8 100644 --- a/sys/cam/cam_xpt_periph.h +++ b/sys/cam/cam_xpt_periph.h @@ -40,7 +40,6 @@ /* Functions accessed by the peripheral drivers */ #ifdef _KERNEL -void xpt_polled_action(union ccb *ccb); void xpt_release_ccb(union ccb *released_ccb); void xpt_schedule(struct cam_periph *perph, u_int32_t new_priority); int32_t xpt_add_periph(struct cam_periph *periph); From owner-dev-commits-src-main@freebsd.org Tue May 25 15:20: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 ED90064EB31; Tue, 25 May 2021 15:20: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 4FqHpW6RgTz3JBN; Tue, 25 May 2021 15:20: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 BB1B41F6EA; Tue, 25 May 2021 15:20: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 14PFKpYp009554; Tue, 25 May 2021 15:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFKpiA009553; Tue, 25 May 2021 15:20:51 GMT (envelope-from git) Date: Tue, 25 May 2021 15:20:51 GMT Message-Id: <202105251520.14PFKpiA009553@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: 91aae953cb80 - main - amd64: clear PSL.AC in the right frame 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: 91aae953cb807d6fb7a70782b323bf9beb60d7c9 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, 25 May 2021 15:20:52 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=91aae953cb807d6fb7a70782b323bf9beb60d7c9 commit 91aae953cb807d6fb7a70782b323bf9beb60d7c9 Author: Konstantin Belousov AuthorDate: 2021-05-22 19:48:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-25 15:20:46 +0000 amd64: clear PSL.AC in the right frame If copyin family of routines fault, kernel does clear PSL.AC on the fault entry, but the AC flag of the faulted frame is kept intact. Since onfault handler is effectively jump, AC survives until syscall exit. Reported by: m00nbsd, via Sony Reviewed by: markj Sponsored by: The FreeBSD Foundation admbugs: 975 --- sys/amd64/amd64/support.S | 18 ++++++++++++------ sys/amd64/linux/linux_support.s | 5 ++++- sys/amd64/linux32/linux32_support.s | 5 ++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 0db6f2f04099..d511fe265996 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -919,9 +919,11 @@ ENTRY(copyin_smap_erms) END(copyin_smap_erms) ALIGN_TEXT - /* Trap entry clears PSL.AC */ copy_fault: - movq $0,PCB_ONFAULT(%r11) + testl $CPUID_STDEXT_SMAP,cpu_stdext_feature(%rip) + je 1f + clac +1: movq $0,PCB_ONFAULT(%r11) movl $EFAULT,%eax POP_FRAME_POINTER ret @@ -1358,9 +1360,11 @@ ENTRY(subyte_smap) END(subyte_smap) ALIGN_TEXT - /* Fault entry clears PSL.AC */ fusufault: - movq PCPU(CURPCB),%rcx + testl $CPUID_STDEXT_SMAP,cpu_stdext_feature(%rip) + je 1f + clac +1: movq PCPU(CURPCB),%rcx xorl %eax,%eax movq %rax,PCB_ONFAULT(%rcx) decq %rax @@ -1443,8 +1447,10 @@ ENTRY(copyinstr_smap) END(copyinstr_smap) cpystrflt: - /* Fault entry clears PSL.AC */ - movl $EFAULT,%eax + testl $CPUID_STDEXT_SMAP,cpu_stdext_feature(%rip) + je 1f + clac +1: movl $EFAULT,%eax cpystrflt_x: /* set *lencopied and return %eax */ movq $0,PCB_ONFAULT(%r9) diff --git a/sys/amd64/linux/linux_support.s b/sys/amd64/linux/linux_support.s index 45eb565f667d..bb1c218bdf89 100644 --- a/sys/amd64/linux/linux_support.s +++ b/sys/amd64/linux/linux_support.s @@ -34,7 +34,10 @@ #include "assym.inc" futex_fault: - movq $0,PCB_ONFAULT(%r8) + testl $CPUID_STDEXT_SMAP,cpu_stdext_feature(%rip) + je 1f + clac +1: movq $0,PCB_ONFAULT(%r8) movl $-EFAULT,%eax ret diff --git a/sys/amd64/linux32/linux32_support.s b/sys/amd64/linux32/linux32_support.s index da076010c13c..86f3d11b552b 100644 --- a/sys/amd64/linux32/linux32_support.s +++ b/sys/amd64/linux32/linux32_support.s @@ -34,7 +34,10 @@ #include "assym.inc" futex_fault: - movq $0,PCB_ONFAULT(%r8) + testl $CPUID_STDEXT_SMAP,cpu_stdext_feature(%rip) + je 1f + clac +1: movq $0,PCB_ONFAULT(%r8) movl $-EFAULT,%eax ret From owner-dev-commits-src-main@freebsd.org Tue May 25 15:22: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 D31BF64ECA0; Tue, 25 May 2021 15:22: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 4FqHrx5bHFz3JPJ; Tue, 25 May 2021 15:22: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 960391FE7C; Tue, 25 May 2021 15:22: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 14PFMveM013083; Tue, 25 May 2021 15:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFMvZa013082; Tue, 25 May 2021 15:22:57 GMT (envelope-from git) Date: Tue, 25 May 2021 15:22:57 GMT Message-Id: <202105251522.14PFMvZa013082@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: fd3ac06f452f - main - ptrace: add an option to not kill debuggees on debugger exit 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: fd3ac06f452f47332e2f6fec8347579265c96104 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, 25 May 2021 15:22:57 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fd3ac06f452f47332e2f6fec8347579265c96104 commit fd3ac06f452f47332e2f6fec8347579265c96104 Author: Konstantin Belousov AuthorDate: 2021-05-18 16:26:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-25 15:22:34 +0000 ptrace: add an option to not kill debuggees on debugger exit Requested by: markj Reviewed by: jhb (previous version) Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differrential revision: https://reviews.freebsd.org/D30351 --- lib/libc/sys/ptrace.2 | 27 ++++++++++++++++++++++++++- sys/kern/kern_exit.c | 24 ++++++++++++++++++++---- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2 index 0135db98dc97..504891597dab 100644 --- a/lib/libc/sys/ptrace.2 +++ b/lib/libc/sys/ptrace.2 @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd May 4, 2021 +.Dd May 20, 2021 .Dt PTRACE 2 .Os .Sh NAME @@ -99,6 +99,30 @@ will report a signal. All other additional signal stops use .Dv SIGTRAP . +.Sh DETACH AND TERMINATION +.Pp +Normally, exiting tracing process should wait for all pending +debugging events and then detach from all alive traced processes +before exiting using +.Dv PT_DETACH +request. +If tracing process exits without detaching, for instance due to abnormal +termination, the destiny of the traced children processes is determined +by the +.Dv kern.kill_on_debugger_exit +sysctl control. +.Pp +If the control is set to the default value 1, such traced processes +are terminated. +If set to zero, kernel implicitly detaches traced processes. +Traced processes are un-stopped if needed, and then continue the execution +without tracing. +Kernel drops any +.Dv SIGTRAP +signals queued to the traced children, which could be either generated by +not yet consumed debug events, or sent by other means, the later should +not be done anyway. +.Sh TRACING EVENTS .Pp Each traced process has a tracing event mask. An event in the traced process only reports a @@ -216,6 +240,7 @@ includes only .Dv PTRACE_EXEC events. All other event flags are disabled. +.Sh PTRACE REQUESTS .Pp The .Fa request diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index e1b40a171345..cb5996982a3a 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include /* for acct_process() function prototype */ @@ -99,6 +100,11 @@ dtrace_execexit_func_t dtrace_fasttrap_exit; SDT_PROVIDER_DECLARE(proc); SDT_PROBE_DEFINE1(proc, , , exit, "int"); +static int kern_kill_on_dbg_exit = 1; +SYSCTL_INT(_kern, OID_AUTO, kill_on_debugger_exit, CTLFLAG_RWTUN, + &kern_kill_on_dbg_exit, 0, + "Kill ptraced processes when debugger exits"); + struct proc * proc_realparent(struct proc *child) { @@ -504,8 +510,9 @@ exit1(struct thread *td, int rval, int signo) } } else { /* - * Traced processes are killed since their existence - * means someone is screwing up. + * Traced processes are killed by default + * since their existence means someone is + * screwing up. */ t = proc_realparent(q); if (t == p) { @@ -522,14 +529,23 @@ exit1(struct thread *td, int rval, int signo) * orphan link for q now while q is locked. */ proc_clear_orphan(q); - q->p_flag &= ~(P_TRACED | P_STOPPED_TRACE); + q->p_flag &= ~P_TRACED; q->p_flag2 &= ~P2_PTRACE_FSTP; q->p_ptevents = 0; + p->p_xthread = NULL; FOREACH_THREAD_IN_PROC(q, tdt) { tdt->td_dbgflags &= ~(TDB_SUSPEND | TDB_XSIG | TDB_FSTP); + tdt->td_xsig = 0; + } + if (kern_kill_on_dbg_exit) { + q->p_flag &= ~P_STOPPED_TRACE; + kern_psignal(q, SIGKILL); + } else if ((q->p_flag & (P_STOPPED_TRACE | + P_STOPPED_SIG)) != 0) { + sigqueue_delete_proc(q, SIGTRAP); + ptrace_unsuspend(q); } - kern_psignal(q, SIGKILL); } PROC_UNLOCK(q); if (ksi != NULL) From owner-dev-commits-src-main@freebsd.org Tue May 25 15:22: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 9BA5864EBC7; Tue, 25 May 2021 15:22: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 4FqHrw416Xz3Jd4; Tue, 25 May 2021 15:22: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 720071FCCF; Tue, 25 May 2021 15:22: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 14PFMuOf013056; Tue, 25 May 2021 15:22:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFMud6013055; Tue, 25 May 2021 15:22:56 GMT (envelope-from git) Date: Tue, 25 May 2021 15:22:56 GMT Message-Id: <202105251522.14PFMud6013055@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: d7a7ea5be607 - main - sys_process.c: extract ptrace_unsuspend() 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: d7a7ea5be60753c140a39ec6fa30e5ca4014dbb5 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, 25 May 2021 15:22:56 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d7a7ea5be60753c140a39ec6fa30e5ca4014dbb5 commit d7a7ea5be60753c140a39ec6fa30e5ca4014dbb5 Author: Konstantin Belousov AuthorDate: 2021-05-18 16:25:50 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-25 15:22:27 +0000 sys_process.c: extract ptrace_unsuspend() Reviewed by: jhb Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differrential revision: https://reviews.freebsd.org/D30351 --- sys/kern/sys_process.c | 20 ++++++++++++++------ sys/sys/ptrace.h | 3 +++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 50157106a35e..b56c33203906 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -610,6 +610,19 @@ proc_set_traced(struct proc *p, bool stop) p->p_ptevents = PTRACE_DEFAULT; } +void +ptrace_unsuspend(struct proc *p) +{ + PROC_LOCK_ASSERT(p, MA_OWNED); + + PROC_SLOCK(p); + p->p_flag &= ~(P_STOPPED_TRACE | P_STOPPED_SIG | P_WAITED); + thread_unsuspend(p); + PROC_SUNLOCK(p); + itimer_proc_continue(p); + kqtimer_proc_continue(p); +} + static int proc_can_ptrace(struct thread *td, struct proc *p) { @@ -1164,12 +1177,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) * suspended, use PT_SUSPEND to suspend it before * continuing the process. */ - PROC_SLOCK(p); - p->p_flag &= ~(P_STOPPED_TRACE | P_STOPPED_SIG | P_WAITED); - thread_unsuspend(p); - PROC_SUNLOCK(p); - itimer_proc_continue(p); - kqtimer_proc_continue(p); + ptrace_unsuspend(p); break; case PT_WRITE_I: diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h index 06f01a04fd9d..1e7c1c71056b 100644 --- a/sys/sys/ptrace.h +++ b/sys/sys/ptrace.h @@ -240,6 +240,9 @@ int proc_write_fpregs32(struct thread *_td, struct fpreg32 *_fpreg32); int proc_read_dbregs32(struct thread *_td, struct dbreg32 *_dbreg32); int proc_write_dbregs32(struct thread *_td, struct dbreg32 *_dbreg32); #endif + +void ptrace_unsuspend(struct proc *p); + #else /* !_KERNEL */ #include From owner-dev-commits-src-main@freebsd.org Tue May 25 15:23: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 A936264ECBC; Tue, 25 May 2021 15:23: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 4FqHsT4R8Lz3JD1; Tue, 25 May 2021 15:23: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 808E11FF8F; Tue, 25 May 2021 15:23: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 14PFNPcg013289; Tue, 25 May 2021 15:23:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFNPbf013288; Tue, 25 May 2021 15:23:25 GMT (envelope-from git) Date: Tue, 25 May 2021 15:23:25 GMT Message-Id: <202105251523.14PFNPbf013288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ceri Davies Subject: git: 17054abf5bef - main - usr.bin/chpass: Correct manpage regarding path to temp files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ceri X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17054abf5bef1ff4f21b7ce358ca93065827ee8c 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, 25 May 2021 15:23:25 -0000 The branch main has been updated by ceri (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=17054abf5bef1ff4f21b7ce358ca93065827ee8c commit 17054abf5bef1ff4f21b7ce358ca93065827ee8c Author: Ceri Davies AuthorDate: 2021-05-25 15:11:45 +0000 Commit: Ceri Davies CommitDate: 2021-05-25 15:23:20 +0000 usr.bin/chpass: Correct manpage regarding path to temp files Approved by: blackend (mentor) --- usr.bin/chpass/chpass.1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/chpass/chpass.1 b/usr.bin/chpass/chpass.1 index 7de92dbeb234..607f2c89b349 100644 --- a/usr.bin/chpass/chpass.1 +++ b/usr.bin/chpass/chpass.1 @@ -28,7 +28,7 @@ .\" @(#)chpass.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd November 17, 2020 +.Dd May 25, 2021 .Dt CHPASS 1 .Os .Sh NAME @@ -456,8 +456,8 @@ operates on NIS entries by default if NIS is enabled. the user database .It Pa /etc/passwd a Version 7 format password file -.It Pa /etc/chpass.XXXXXX -temporary copy of the password file +.It Pa /etc/pw.XXXXXX +temporary file .It Pa /etc/shells the list of approved shells .El From owner-dev-commits-src-main@freebsd.org Tue May 25 15:23: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 EA89264EE6E; Tue, 25 May 2021 15:23: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 4FqHsV5PHYz3Jfx; Tue, 25 May 2021 15:23: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 A110E1FD56; Tue, 25 May 2021 15:23: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 14PFNQ1o013317; Tue, 25 May 2021 15:23:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFNQK3013316; Tue, 25 May 2021 15:23:26 GMT (envelope-from git) Date: Tue, 25 May 2021 15:23:26 GMT Message-Id: <202105251523.14PFNQK3013316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ceri Davies Subject: git: 2770978d053b - main - man4/inet6.4: use "effect" rather than "affect" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ceri X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2770978d053b58c3ae90efc0daf32e4b98df052a 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, 25 May 2021 15:23:27 -0000 The branch main has been updated by ceri (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2770978d053b58c3ae90efc0daf32e4b98df052a commit 2770978d053b58c3ae90efc0daf32e4b98df052a Author: Ceri Davies AuthorDate: 2021-05-25 15:14:19 +0000 Commit: Ceri Davies CommitDate: 2021-05-25 15:23:20 +0000 man4/inet6.4: use "effect" rather than "affect" Approved by: blackend (mentor) --- share/man/man4/inet6.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/inet6.4 b/share/man/man4/inet6.4 index 29e26bfd2646..300f98abb196 100644 --- a/share/man/man4/inet6.4 +++ b/share/man/man4/inet6.4 @@ -91,7 +91,7 @@ Sockets may be created with the local address .Dq Dv :: (which is equal to IPv6 address .Dv 0:0:0:0:0:0:0:0 ) -to affect +to effect .Dq wildcard matching on incoming messages. .Pp From owner-dev-commits-src-main@freebsd.org Tue May 25 15:23: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 3685964EB6F; Tue, 25 May 2021 15:23: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 4FqHsX0D1Yz3JjQ; Tue, 25 May 2021 15:23: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 CA04C1F8F2; Tue, 25 May 2021 15:23: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 14PFNRfb013338; Tue, 25 May 2021 15:23:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFNRlb013337; Tue, 25 May 2021 15:23:27 GMT (envelope-from git) Date: Tue, 25 May 2021 15:23:27 GMT Message-Id: <202105251523.14PFNRlb013337@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ceri Davies Subject: git: a23b08cf98d9 - main - man5/{hosts, resolver}.5: note that IPv6 addresses are allowed. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ceri X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a23b08cf98d92ff82adeebc84673e9bd3cd0a6da 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, 25 May 2021 15:23:28 -0000 The branch main has been updated by ceri (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a23b08cf98d92ff82adeebc84673e9bd3cd0a6da commit a23b08cf98d92ff82adeebc84673e9bd3cd0a6da Author: Ceri Davies AuthorDate: 2021-05-25 15:16:24 +0000 Commit: Ceri Davies CommitDate: 2021-05-25 15:23:20 +0000 man5/{hosts,resolver}.5: note that IPv6 addresses are allowed. The patch in the PR largely no longer applied due to age, but thanks to Evgeniy Khramtsov for the patches in the PR. PR: 120024 Reported by: bcran Approved by: blackend (mentor) Obtained from: Evgeniy Khramtsov (partly) --- share/man/man5/hosts.5 | 10 ++++++---- share/man/man5/resolver.5 | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/share/man/man5/hosts.5 b/share/man/man5/hosts.5 index d80c544b3644..ca7586f039b7 100644 --- a/share/man/man5/hosts.5 +++ b/share/man/man5/hosts.5 @@ -28,7 +28,7 @@ .\" @(#)hosts.5 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd December 25, 2013 +.Dd May 25, 2021 .Dt HOSTS 5 .Os .Sh NAME @@ -64,9 +64,10 @@ These include addresses for the local interfaces that .Xr ifconfig 8 needs at boot time and a few machines on the local network. .Pp -Network addresses are specified in the conventional -``.'' (dot) notation using the -.Xr inet_addr 3 +Network addresses are specified in either the conventional +``.'' (dot) notation for IPv4 or colon hexadecimal notation for IPv6, +as understood by the +.Xr inet_pton 3 routine from the Internet address manipulation library, .Xr inet 3 . @@ -83,6 +84,7 @@ file resides in .El .Sh SEE ALSO .Xr gethostbyname 3 , +.Xr inet 3 , .Xr nsswitch.conf 5 , .Xr ifconfig 8 .Rs diff --git a/share/man/man5/resolver.5 b/share/man/man5/resolver.5 index cc439f123442..d5c02599bafb 100644 --- a/share/man/man5/resolver.5 +++ b/share/man/man5/resolver.5 @@ -28,7 +28,7 @@ .\" @(#)resolver.5 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd August 16, 2018 +.Dd May 25, 2021 .Dt RESOLVER 5 .Os .Sh NAME @@ -54,7 +54,7 @@ and the domain search path is constructed from the domain name. The different configuration options are: .Bl -tag -width nameserver .It Sy nameserver -Internet address (in dot notation) of a name server +IPv4 or IPv6 address of a name server that the resolver should query. Up to .Dv MAXNS From owner-dev-commits-src-main@freebsd.org Tue May 25 15:26: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 3F32A64EFB0; Tue, 25 May 2021 15:26: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 4FqHx71Mfsz3KV5; Tue, 25 May 2021 15:26: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 12E501F8F3; Tue, 25 May 2021 15:26: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 14PFQYQc013687; Tue, 25 May 2021 15:26:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFQYRs013686; Tue, 25 May 2021 15:26:34 GMT (envelope-from git) Date: Tue, 25 May 2021 15:26:34 GMT Message-Id: <202105251526.14PFQYRs013686@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: d39d5ee2d67f - main - pf tests: Test cases for fragment reassembly 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: d39d5ee2d67f61abc890b51973b5c4a0c81d6647 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, 25 May 2021 15:26:35 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d39d5ee2d67f61abc890b51973b5c4a0c81d6647 commit d39d5ee2d67f61abc890b51973b5c4a0c81d6647 Author: Kristof Provost AuthorDate: 2021-02-25 08:50:57 +0000 Commit: Kristof Provost CommitDate: 2021-05-25 13:26:27 +0000 pf tests: Test cases for fragment reassembly Obtained from: Alexander Bluhm, OpenBSD --- tests/sys/netpfil/pf/Makefile | 8 +++ tests/sys/netpfil/pf/frag-overindex.py | 82 ++++++++++++++++++++++++++++++ tests/sys/netpfil/pf/frag-overlimit.py | 87 ++++++++++++++++++++++++++++++++ tests/sys/netpfil/pf/frag-overreplace.py | 84 ++++++++++++++++++++++++++++++ tests/sys/netpfil/pf/fragcommon.py | 52 +++++++++++++++++++ tests/sys/netpfil/pf/fragmentation.sh | 83 ++++++++++++++++++++++++++++++ 6 files changed, 396 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 2478cefbc4a6..b43a0a5a77b3 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -31,9 +31,17 @@ ATF_TESTS_SH+= altq \ ${PACKAGE}FILES+= CVE-2019-5597.py \ CVE-2019-5598.py \ echo_inetd.conf \ + fragcommon.py \ + frag-overindex.py \ + frag-overlimit.py \ + frag-overreplace.py \ utils.subr ${PACKAGE}FILESMODE_CVE-2019-5597.py= 0555 ${PACKAGE}FILESMODE_CVE-2019-5598.py= 0555 +${PACKAGE}FILESMODE_fragcommon.py= 0555 +${PACKAGE}FILESMODE_frag-overindex.py= 0555 +${PACKAGE}FILESMODE_frag-overlimit.py= 0555 +${PACKAGE}FILESMODE_frag-overreplace.py= 0555 .include diff --git a/tests/sys/netpfil/pf/frag-overindex.py b/tests/sys/netpfil/pf/frag-overindex.py new file mode 100644 index 000000000000..594eb9efe39d --- /dev/null +++ b/tests/sys/netpfil/pf/frag-overindex.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: ISC +# +# Copyright (c) 2012-2021 Alexander Bluhm +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +from fragcommon import * + +# index boundary 4096 | +# |--------------| +# .... +# |--------------| +# |XXXX-----| +# |--------------| +# +# this should trigger "frag index %d, new %d" log in kernel + +def send(src, dst, send_if, recv_if): + pid = os.getpid() + eid = pid & 0xffff + payload = b"ABCDEFGHIJKLMNOP" + dummy = b"01234567" + fragsize = 64 + boundary = 4096 + fragnum = int(boundary / fragsize) + packet = sp.IP(src=src, dst=dst)/ \ + sp.ICMP(type='echo-request', id=eid)/ \ + (int((boundary + 8) / len(payload)) * payload) + frag = [] + fid = pid & 0xffff + for i in range(fragnum - 1): + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(i * fragsize) >> 3, flags='MF') / + bytes(packet)[20 + i * fragsize:20 + (i + 1) * fragsize]) + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(boundary - 8) >> 3) / + (dummy + bytes(packet)[20 + boundary:20 + boundary + 8])) + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(boundary - fragsize) >> 3, flags='MF') / + bytes(packet)[20 + boundary - fragsize:20 + boundary]) + eth = [] + for f in frag: + eth.append(sp.Ether() / f) + + if os.fork() == 0: + time.sleep(1) + for e in eth: + sp.sendp(e, iface=send_if) + time.sleep(0.001) + os._exit(0) + + ans = sp.sniff(iface=recv_if, timeout=5) + print(ans) + for a in ans: + a.show() + if a and a.type == sp.ETH_P_IP and \ + a.payload.proto == 1 and \ + a.payload.frag == 0 and \ + sp.icmptypes[a.payload.payload.type] == 'echo-reply': + id = a.payload.payload.id + print("id=%#x" % (id)) + if id != eid: + print("WRONG ECHO REPLY ID") + sys.exit(2) + sys.exit(0) + print("NO ECHO REPLY") + exit(1) + +if __name__ == '__main__': + main(send) diff --git a/tests/sys/netpfil/pf/frag-overlimit.py b/tests/sys/netpfil/pf/frag-overlimit.py new file mode 100644 index 000000000000..e25ebf5b0dcd --- /dev/null +++ b/tests/sys/netpfil/pf/frag-overlimit.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: ISC +# +# Copyright (c) 2012-2021 Alexander Bluhm +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +from fragcommon import * +from itertools import chain + +# index boundary 4096 | +# |--------------| +# .... +# |--------------| +# |--------------| +# ....----| +# |XXXX-----| +# |--------------| + +# this should trigger "fragment requeue limit exceeded" log in kernel + +def send(src, dst, send_if, recv_if): + pid = os.getpid() + eid = pid & 0xffff + payload = b"ABCDEFGHIJKLMNOP" + dummy = b"01234567" + fragsize = 64 + boundary = 4096 + fragnum= int(boundary / fragsize) + packet = sp.IP(src=src, dst=dst)/ \ + sp.ICMP(type='echo-request', id=eid)/ \ + (int((boundary + boundary) / len(payload)) * payload) + frag = [] + fid = pid & 0xffff + for i in chain(range(fragnum - 1), range(fragnum, fragnum + fragnum - 1)): + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(i * fragsize) >> 3, flags='MF') / + bytes(packet)[20 + i * fragsize:20 + (i + 1) * fragsize]) + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(boundary + boundary - fragsize) >> 3) / + bytes(packet)[20 + boundary + boundary - fragsize:]) + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(boundary - 8) >> 3, flags='MF')/ + (dummy + bytes(packet)[20 + boundary:20 + boundary + 8])) + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(boundary - fragsize) >> 3, flags='MF') / + bytes(packet)[20 + boundary - fragsize:20 + boundary]) + eth = [] + for f in frag: + eth.append(sp.Ether() / f) + + if os.fork() == 0: + time.sleep(1) + for e in eth: + sp.sendp(e, iface=send_if) + time.sleep(0.001) + os._exit(0) + + ans = sp.sniff(iface=recv_if, timeout=10, filter= + "ip and src " + dst + " and dst " + src + " and icmp") + for a in ans: + if a and a.type == ETH_P_IP and \ + a.payload.proto == 1 and \ + a.payload.frag == 0 and \ + sp.icmptypes[a.payload.payload.type] == 'echo-reply': + id = a.payload.payload.id + print("id=%#x" % (id)) + if id != eid: + print("WRONG ECHO REPLY ID") + sys.exit(2) + print("ECHO REPLY") + sys.exit(1) + sys.exit(0) + +if __name__ == '__main__': + main(send) diff --git a/tests/sys/netpfil/pf/frag-overreplace.py b/tests/sys/netpfil/pf/frag-overreplace.py new file mode 100644 index 000000000000..ff9184243a1d --- /dev/null +++ b/tests/sys/netpfil/pf/frag-overreplace.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: ISC +# +# Copyright (c) 2012-2021 Alexander Bluhm +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +from fragcommon import * + +# index boundary 4096 | +# |--------------| +# .... +# |--------------| +# |XXXX-----| +# |--------------| +# |--------------| + +# this should trigger "frag tail overlap %d" and "frag head overlap %d" + +def send(src, dst, send_if, recv_if): + pid = os.getpid() + eid = pid & 0xffff + payload = b"ABCDEFGHIJKLMNOP" + dummy = b"01234567" + fragsize = 1024 + boundary = 4096 + fragnum = int(boundary / fragsize) + packet = sp.IP(src=src, dst=dst)/ \ + sp.ICMP(type='echo-request', id=eid)/ \ + (int((boundary + fragsize) / len(payload)) * payload) + frag = [] + fid = pid & 0xffff + + for i in range(fragnum - 1): + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(i * fragsize) >> 3, flags='MF') / + bytes(packet)[20 + i * fragsize:20 + (i + 1) * fragsize]) + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(boundary - 8) >> 3, flags='MF') / + (dummy + bytes(packet)[20 + boundary:20 + boundary + 8])) + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(boundary - fragsize) >> 3, flags='MF') / + bytes(packet)[20 + boundary - fragsize:20 + boundary]) + frag.append(sp.IP(src=src, dst=dst, proto=1, id=fid, + frag=(boundary) >> 3)/bytes(packet)[20 + boundary:]) + + eth=[] + for f in frag: + eth.append(sp.Ether() / f) + + if os.fork() == 0: + time.sleep(1) + for e in eth: + sp.sendp(e, iface=send_if) + time.sleep(0.001) + os._exit(0) + + ans = sp.sniff(iface=recv_if, timeout=3, filter="") + for a in ans: + if a and a.type == sp.ETH_P_IP and \ + a.payload.proto == 1 and \ + a.payload.frag == 0 and \ + sp.icmptypes[a.payload.payload.type] == 'echo-reply': + id=a.payload.payload.id + if id != eid: + print("WRONG ECHO REPLY ID") + sys.exit(2) + sys.exit(0) + print("NO ECHO REPLY") + sys.exit(1) + +if __name__ == '__main__': + main(send) diff --git a/tests/sys/netpfil/pf/fragcommon.py b/tests/sys/netpfil/pf/fragcommon.py new file mode 100644 index 000000000000..2bcd3989b420 --- /dev/null +++ b/tests/sys/netpfil/pf/fragcommon.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate). All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +import argparse +import os +import scapy.all as sp +import sys +import time + +def main(send): + parser = argparse.ArgumentParser("frag-overindex.py", + description="Fragmentation test tool") + parser.add_argument('--to', nargs=1, + required=True, + help='The address to send the fragmented packets to') + parser.add_argument('--fromaddr', nargs=1, + required=True, + help='The source address for the generated packets') + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface to expect the reply on') + + args = parser.parse_args() + + send(args.fromaddr[0], args.to[0], args.sendif[0], args.recvif[0]) diff --git a/tests/sys/netpfil/pf/fragmentation.sh b/tests/sys/netpfil/pf/fragmentation.sh index 8b57bcf11487..8b16c9655d08 100644 --- a/tests/sys/netpfil/pf/fragmentation.sh +++ b/tests/sys/netpfil/pf/fragmentation.sh @@ -189,9 +189,92 @@ mtu_diff_cleanup() pft_cleanup } +frag_common() +{ + name=$1 + + pft_init + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}a + + ifconfig ${epair}b inet 192.0.2.1/24 up + jexec alcatraz ifconfig ${epair}a 192.0.2.2/24 up + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "scrub all fragment reassemble" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + atf_check -s exit:0 -o ignore $(atf_get_srcdir)/frag-${1}.py \ + --to 192.0.2.2 \ + --fromaddr 192.0.2.1 \ + --sendif ${epair}b \ + --recvif ${epair}b +} + +atf_test_case "overreplace" "cleanup" +overreplace_head() +{ + atf_set descr 'ping fragment that overlaps fragment at index boundary and replace it' + atf_set require.user root + atf_set require.progs scapy +} + +overreplace_body() +{ + frag_common overreplace +} + +overreplace_cleanup() +{ + pft_cleanup +} + +atf_test_case "overindex" "cleanup" +overindex_head() +{ + atf_set descr 'ping fragment that overlaps the first fragment at index boundary' + atf_set require.user root + atf_set require.progs scapy +} + +overindex_body() +{ + frag_common overindex +} + +overindex_cleanup() +{ + pft_cleanup +} + +atf_test_case "overlimit" "cleanup" +overlimit_head() +{ + atf_set descr 'ping fragment at index boundary that cannot be requeued' + atf_set require.user root + atf_set require.progs scapy +} + +overlimit_body() +{ + frag_common overlimit +} + +overlimit_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "too_many_fragments" atf_add_test_case "v6" atf_add_test_case "mtu_diff" + atf_add_test_case "overreplace" + atf_add_test_case "overindex" + atf_add_test_case "overlimit" } From owner-dev-commits-src-main@freebsd.org Tue May 25 15:27: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 4A0E464EFBB; Tue, 25 May 2021 15:27: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 4FqHyQ1d05z3KZ4; Tue, 25 May 2021 15:27: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 1FD1D20081; Tue, 25 May 2021 15:27: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 14PFRgoX013878; Tue, 25 May 2021 15:27:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFRg8Y013877; Tue, 25 May 2021 15:27:42 GMT (envelope-from git) Date: Tue, 25 May 2021 15:27:42 GMT Message-Id: <202105251527.14PFRg8Y013877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 6f4bb8ecc2ba - main - arm64, riscv: remove reference to fsu_intr_fault MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f4bb8ecc2ba2383c9c160eeb826724a2644f810 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, 25 May 2021 15:27:42 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6f4bb8ecc2ba2383c9c160eeb826724a2644f810 commit 6f4bb8ecc2ba2383c9c160eeb826724a2644f810 Author: Mitchell Horne AuthorDate: 2021-05-25 15:22:49 +0000 Commit: Mitchell Horne CommitDate: 2021-05-25 15:26:52 +0000 arm64, riscv: remove reference to fsu_intr_fault This variable no longer exists. MFC after: 3 days --- sys/arm64/arm64/trap.c | 2 -- sys/riscv/riscv/trap.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 8688f8679267..744b646b31c8 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -71,8 +71,6 @@ __FBSDID("$FreeBSD$"); #include #endif -extern register_t fsu_intr_fault; - /* Called from exception.S */ void do_el1h_sync(struct thread *, struct trapframe *); void do_el0_sync(struct thread *, struct trapframe *); diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 0aaaf46eb629..8297d4072a5c 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -73,8 +73,6 @@ __FBSDID("$FreeBSD$"); int (*dtrace_invop_jump_addr)(struct trapframe *); -extern register_t fsu_intr_fault; - /* Called from exception.S */ void do_trap_supervisor(struct trapframe *); void do_trap_user(struct trapframe *); From owner-dev-commits-src-main@freebsd.org Tue May 25 15:30: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 1032964EFCB; Tue, 25 May 2021 15:30: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 4FqJ1y74xlz3KmY; Tue, 25 May 2021 15:30:46 +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 DB1E220012; Tue, 25 May 2021 15:30:46 +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 14PFUkQc022387; Tue, 25 May 2021 15:30:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFUknu022386; Tue, 25 May 2021 15:30:46 GMT (envelope-from git) Date: Tue, 25 May 2021 15:30:46 GMT Message-Id: <202105251530.14PFUknu022386@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 3b9971c8da75 - main - Clean up some of the core dumping code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b9971c8da7532462048062d589ef85cbb904f7e 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, 25 May 2021 15:30:47 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=3b9971c8da7532462048062d589ef85cbb904f7e commit 3b9971c8da7532462048062d589ef85cbb904f7e Author: Edward Tomasz Napierala AuthorDate: 2021-05-25 10:48:15 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-25 15:30:32 +0000 Clean up some of the core dumping code. No functional changes. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30397 --- sys/kern/kern_exec.c | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 709c1b0ff28a..50451c1242eb 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1869,7 +1869,7 @@ exec_unregister(const struct execsw *execsw_arg) * Write out a core segment to the compression stream. */ static int -compress_chunk(struct coredump_params *p, char *base, char *buf, u_int len) +compress_chunk(struct coredump_params *cp, char *base, char *buf, u_int len) { u_int chunk_len; int error; @@ -1884,7 +1884,7 @@ compress_chunk(struct coredump_params *p, char *base, char *buf, u_int len) error = copyin(base, buf, chunk_len); if (error != 0) bzero(buf, chunk_len); - error = compressor_write(p->comp, buf, chunk_len); + error = compressor_write(cp->comp, buf, chunk_len); if (error != 0) break; base += chunk_len; @@ -1894,17 +1894,17 @@ compress_chunk(struct coredump_params *p, char *base, char *buf, u_int len) } int -core_write(struct coredump_params *p, const void *base, size_t len, +core_write(struct coredump_params *cp, const void *base, size_t len, off_t offset, enum uio_seg seg, size_t *resid) { - return (vn_rdwr_inchunks(UIO_WRITE, p->vp, __DECONST(void *, base), + return (vn_rdwr_inchunks(UIO_WRITE, cp->vp, __DECONST(void *, base), len, offset, seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED, - p->active_cred, p->file_cred, resid, p->td)); + cp->active_cred, cp->file_cred, resid, cp->td)); } int -core_output(char *base, size_t len, off_t offset, struct coredump_params *p, +core_output(char *base, size_t len, off_t offset, struct coredump_params *cp, void *tmpbuf) { vm_map_t map; @@ -1916,10 +1916,10 @@ core_output(char *base, size_t len, off_t offset, struct coredump_params *p, KASSERT((uintptr_t)base % PAGE_SIZE == 0, ("%s: user address %p is not page-aligned", __func__, base)); - if (p->comp != NULL) - return (compress_chunk(p, base, tmpbuf, len)); + if (cp->comp != NULL) + return (compress_chunk(cp, base, tmpbuf, len)); - map = &p->td->td_proc->p_vmspace->vm_map; + map = &cp->td->td_proc->p_vmspace->vm_map; for (; len > 0; base += runlen, offset += runlen, len -= runlen) { /* * Attempt to page in all virtual pages in the range. If a @@ -1937,7 +1937,7 @@ core_output(char *base, size_t len, off_t offset, struct coredump_params *p, } if (success) { - error = core_write(p, base, runlen, offset, + error = core_write(cp, base, runlen, offset, UIO_USERSPACE, &resid); if (error != 0) { if (error != EFAULT) @@ -1960,13 +1960,13 @@ core_output(char *base, size_t len, off_t offset, struct coredump_params *p, } } if (!success) { - error = vn_start_write(p->vp, &mp, V_WAIT); + error = vn_start_write(cp->vp, &mp, V_WAIT); if (error != 0) break; - vn_lock(p->vp, LK_EXCLUSIVE | LK_RETRY); - error = vn_truncate_locked(p->vp, offset + runlen, - false, p->td->td_ucred); - VOP_UNLOCK(p->vp); + vn_lock(cp->vp, LK_EXCLUSIVE | LK_RETRY); + error = vn_truncate_locked(cp->vp, offset + runlen, + false, cp->td->td_ucred); + VOP_UNLOCK(cp->vp); vn_finished_write(mp); if (error != 0) break; @@ -1981,10 +1981,12 @@ core_output(char *base, size_t len, off_t offset, struct coredump_params *p, int sbuf_drain_core_output(void *arg, const char *data, int len) { - struct coredump_params *p; + struct coredump_params *cp; + struct proc *p; int error, locked; - p = (struct coredump_params *)arg; + cp = arg; + p = cp->td->td_proc; /* * Some kern_proc out routines that print to this sbuf may @@ -1994,19 +1996,18 @@ sbuf_drain_core_output(void *arg, const char *data, int len) * can safely release the lock before draining and acquire * again after. */ - locked = PROC_LOCKED(p->td->td_proc); + locked = PROC_LOCKED(p); if (locked) - PROC_UNLOCK(p->td->td_proc); - if (p->comp != NULL) - error = compressor_write(p->comp, __DECONST(char *, data), len); + PROC_UNLOCK(p); + if (cp->comp != NULL) + error = compressor_write(cp->comp, __DECONST(char *, data), len); else - error = core_write(p, __DECONST(void *, data), len, p->offset, + error = core_write(cp, __DECONST(void *, data), len, cp->offset, UIO_SYSSPACE, NULL); if (locked) - PROC_LOCK(p->td->td_proc); + PROC_LOCK(p); if (error != 0) return (-error); - p->offset += len; + cp->offset += len; return (len); } - From owner-dev-commits-src-main@freebsd.org Tue May 25 15:57: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 861C564FBAF; Tue, 25 May 2021 15:57: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 4FqJcj3LLZz3PDC; Tue, 25 May 2021 15:57: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 5C6B420802; Tue, 25 May 2021 15:57: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 14PFvPww054668; Tue, 25 May 2021 15:57:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PFvPL8054667; Tue, 25 May 2021 15:57:25 GMT (envelope-from git) Date: Tue, 25 May 2021 15:57:25 GMT Message-Id: <202105251557.14PFvPL8054667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 00e7a553675d - main - cam_sim: style: sort includes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00e7a553675daead4c0d803449eb69e7612d5bf4 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, 25 May 2021 15:57:25 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=00e7a553675daead4c0d803449eb69e7612d5bf4 commit 00e7a553675daead4c0d803449eb69e7612d5bf4 Author: Warner Losh AuthorDate: 2021-05-22 00:52:55 +0000 Commit: Warner Losh CommitDate: 2021-05-25 15:56:56 +0000 cam_sim: style: sort includes Sort and remove sys/systm.h, it's not needed. Sponsored by: Netflix --- sys/cam/cam_sim.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/cam/cam_sim.c b/sys/cam/cam_sim.c index 42fe14b5e991..20bed83fac86 100644 --- a/sys/cam/cam_sim.c +++ b/sys/cam/cam_sim.c @@ -32,17 +32,16 @@ __FBSDID("$FreeBSD$"); #include -#include -#include +#include #include #include +#include #include -#include #include #include -#include #include +#include #include #define CAM_PATH_ANY (u_int32_t)-1 From owner-dev-commits-src-main@freebsd.org Tue May 25 16:44: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 1462C6500C1; Tue, 25 May 2021 16:44: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 4FqKfv71yBz3kDV; Tue, 25 May 2021 16:44: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 D58AE2110C; Tue, 25 May 2021 16:44: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 14PGiN61021477; Tue, 25 May 2021 16:44:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PGiNXP021476; Tue, 25 May 2021 16:44:23 GMT (envelope-from git) Date: Tue, 25 May 2021 16:44:23 GMT Message-Id: <202105251644.14PGiNXP021476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Silvers Subject: git: 84768d114951 - main - fsdb: add missing bufinit() call MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84768d114951e88288024f09d4beae0956c3cf21 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, 25 May 2021 16:44:24 -0000 The branch main has been updated by chs: URL: https://cgit.FreeBSD.org/src/commit/?id=84768d114951e88288024f09d4beae0956c3cf21 commit 84768d114951e88288024f09d4beae0956c3cf21 Author: Chuck Silvers AuthorDate: 2021-05-25 16:42:10 +0000 Commit: Chuck Silvers CommitDate: 2021-05-25 16:42:10 +0000 fsdb: add missing bufinit() call The bufinit() call in fsck_ffs was moved in commit f190f9193bc10 from a function that is shared with fsdb to one that is private to fsck_ffs, so add a bufinit() call in fsdb to compensate for that. Reviewed by: mckusick Sponsored by: Netflix --- sbin/fsdb/fsdb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index 785aeb2b5a75..b8f0dd9f9772 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -111,6 +111,7 @@ main(int argc, char *argv[]) fsys = argv[0]; sblock_init(); + bufinit(); if (!setup(fsys)) errx(1, "cannot set up file system `%s'", fsys); if (fswritefd < 0) From owner-dev-commits-src-main@freebsd.org Tue May 25 17:25: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 5FADA650FDC; Tue, 25 May 2021 17:25: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 4FqLZg2K2nz3qkq; Tue, 25 May 2021 17:25: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 37BA6219DC; Tue, 25 May 2021 17:25: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 14PHPlB5075949; Tue, 25 May 2021 17:25:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PHPlku075948; Tue, 25 May 2021 17:25:47 GMT (envelope-from git) Date: Tue, 25 May 2021 17:25:47 GMT Message-Id: <202105251725.14PHPlku075948@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: 13c0e198ca27 - main - tcp: Fix bugs related to the PUSH bit and rack and an ack war 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: 13c0e198ca275447f9a60a03f730c38c98f19009 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, 25 May 2021 17:25:47 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=13c0e198ca275447f9a60a03f730c38c98f19009 commit 13c0e198ca275447f9a60a03f730c38c98f19009 Author: Randall Stewart AuthorDate: 2021-05-25 17:23:31 +0000 Commit: Randall Stewart CommitDate: 2021-05-25 17:23:31 +0000 tcp: Fix bugs related to the PUSH bit and rack and an ack war Michaels testing with UDP tunneling found an issue with the push bit, which was only partly fixed in the last commit. The problem is the left edge gets transmitted before the adjustments are done to the send_map, this means that right edge bits must be considered to be added only if the entire RSM is being retransmitted. Now syzkaller also continued to find a crash, which Michael sent me the reproducer for. Turns out that the reproducer on default (freebsd) stack made the stack get into an ack-war with itself. After fixing the reference issues in rack the same ack-war was found in rack (and bbr). Basically what happens is we go into the reassembly code and lose the FIN bit. The trick here is we should not be going into the reassembly code if tlen == 0 i.e. the peer never sent you anything. That then gets the proper action on the FIN bit but then you end up in LAST_ACK with no timers running. This is because the usrclosed function gets called and the FIN's and such have already been exchanged. So when we should be entering FIN_WAIT2 (or even FIN_WAIT1) we get stuck in LAST_ACK. Fixing this means tweaking the usrclosed function so that we properly recognize the condition and drop into FIN_WAIT2 where a timer will allow at least TP_MAXIDLE before closing (to allow time for the peer to retransmit its FIN if the ack is lost). Setting the fast_finwait2 timer can speed this up in testing. Reviewed by: mtuexen,rscheff Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30451 --- sys/netinet/tcp_input.c | 6 +++-- sys/netinet/tcp_stacks/bbr.c | 6 +++-- sys/netinet/tcp_stacks/rack.c | 58 +++++++++++++++++++++++++++++-------------- sys/netinet/tcp_usrreq.c | 16 ++++++++++++ 4 files changed, 64 insertions(+), 22 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 18ef52959c15..b9836a137608 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -3191,8 +3191,10 @@ dodata: /* XXX */ * when trimming from the head. */ tcp_seq temp = save_start; - thflags = tcp_reass(tp, th, &temp, &tlen, m); - tp->t_flags |= TF_ACKNOW; + if (tlen) { + thflags = tcp_reass(tp, th, &temp, &tlen, m); + tp->t_flags |= TF_ACKNOW; + } } if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0) && diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 56691def6e1d..b2fc5c1f928e 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -8320,8 +8320,10 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, * trimming from the head. */ tcp_seq temp = save_start; - thflags = tcp_reass(tp, th, &temp, &tlen, m); - tp->t_flags |= TF_ACKNOW; + if (tlen) { + thflags = tcp_reass(tp, th, &temp, &tlen, m); + tp->t_flags |= TF_ACKNOW; + } } if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0) && diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 71970e180808..ad2c7d31d110 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6017,7 +6017,7 @@ rack_setup_offset_for_rsm(struct rack_sendmap *src_rsm, struct rack_sendmap *rsm struct mbuf *m; uint32_t soff; - if (src_rsm->orig_m_len != src_rsm->m->m_len) { + if (src_rsm->m && (src_rsm->orig_m_len != src_rsm->m->m_len)) { /* Fix up the orig_m_len and possibly the mbuf offset */ rack_adjust_orig_mlen(src_rsm); } @@ -8818,21 +8818,23 @@ more: rack->r_ctl.rc_gp_cumack_ts = rsm->r_tim_lastsent[(rsm->r_rtr_cnt-1)]; rack_log_map_chg(tp, rack, NULL, rsm, NULL, MAP_TRIM_HEAD, th_ack, __LINE__); /* Now we need to move our offset forward too */ - if (rsm->orig_m_len != rsm->m->m_len) { + if (rsm->m && (rsm->orig_m_len != rsm->m->m_len)) { /* Fix up the orig_m_len and possibly the mbuf offset */ rack_adjust_orig_mlen(rsm); } rsm->soff += (th_ack - rsm->r_start); rsm->r_start = th_ack; /* Now do we need to move the mbuf fwd too? */ - while (rsm->soff >= rsm->m->m_len) { - rsm->soff -= rsm->m->m_len; - rsm->m = rsm->m->m_next; - KASSERT((rsm->m != NULL), - (" nrsm:%p hit at soff:%u null m", - rsm, rsm->soff)); - } - rsm->orig_m_len = rsm->m->m_len; + if (rsm->m) { + while (rsm->soff >= rsm->m->m_len) { + rsm->soff -= rsm->m->m_len; + rsm->m = rsm->m->m_next; + KASSERT((rsm->m != NULL), + (" nrsm:%p hit at soff:%u null m", + rsm, rsm->soff)); + } + rsm->orig_m_len = rsm->m->m_len; + } if (rack->app_limited_needs_set) rack_need_set_test(tp, rack, rsm, tp->snd_una, __LINE__, RACK_USE_BEG); } @@ -9655,7 +9657,7 @@ rack_adjust_sendmap(struct tcp_rack *rack, struct sockbuf *sb, tcp_seq snd_una) /* Nothing outstanding */ return; } - while (rsm->m == m) { + while (rsm->m && (rsm->m == m)) { /* one to adjust */ #ifdef INVARIANTS struct mbuf *tm; @@ -9676,10 +9678,16 @@ rack_adjust_sendmap(struct tcp_rack *rack, struct sockbuf *sb, tcp_seq snd_una) } rsm->m = tm; rsm->soff = soff; - rsm->orig_m_len = rsm->m->m_len; + if (tm) + rsm->orig_m_len = rsm->m->m_len; + else + rsm->orig_m_len = 0; #else rsm->m = sbsndmbuf(sb, (rsm->r_start - snd_una), &rsm->soff); - rsm->orig_m_len = rsm->m->m_len; + if (rsm->m) + rsm->orig_m_len = rsm->m->m_len; + else + rsm->orig_m_len = 0; #endif rsm = RB_NEXT(rack_rb_tree_head, &rack->r_ctl.rc_mtree, rsm); @@ -10058,6 +10066,7 @@ rack_validate_fo_sendwin_up(struct tcpcb *tp, struct tcp_rack *rack) } } + /* * Return value of 1, the TCB is unlocked and most * likely gone, return value of 0, the TCP is still @@ -10226,9 +10235,10 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, * trimming from the head. */ tcp_seq temp = save_start; - - thflags = tcp_reass(tp, th, &temp, &tlen, m); - tp->t_flags |= TF_ACKNOW; + if (tlen) { + thflags = tcp_reass(tp, th, &temp, &tlen, m); + tp->t_flags |= TF_ACKNOW; + } } if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0) && @@ -12190,7 +12200,10 @@ rack_init(struct tcpcb *tp) rsm->r_dupack = 0; if (rack->rc_inp->inp_socket->so_snd.sb_mb != NULL) { rsm->m = sbsndmbuf(&rack->rc_inp->inp_socket->so_snd, 0, &rsm->soff); - rsm->orig_m_len = rsm->m->m_len; + if (rsm->m) + rsm->orig_m_len = rsm->m->m_len; + else + rsm->orig_m_len = 0; } else { /* * This can happen if we have a stand-alone FIN or @@ -15074,6 +15087,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma uint32_t us_cts; uint32_t if_hw_tsomaxsegcount = 0, startseq; uint32_t if_hw_tsomaxsegsize; + #ifdef INET6 struct ip6_hdr *ip6 = NULL; @@ -15183,7 +15197,15 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma } th->th_seq = htonl(rsm->r_start); th->th_ack = htonl(tp->rcv_nxt); - if(rsm->r_flags & RACK_HAD_PUSH) + /* + * The PUSH bit should only be applied + * if the full retransmission is made. If + * we are sending less than this is the + * left hand edge and should not have + * the PUSH bit. + */ + if ((rsm->r_flags & RACK_HAD_PUSH) && + (len == (rsm->r_end - rsm->r_start))) flags |= TH_PUSH; th->th_flags = flags; th->th_win = htons((u_short)(rack->r_ctl.fsb.recwin >> tp->rcv_scale)); diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 37bedc0125c9..4f418f8809a7 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -2637,6 +2637,22 @@ tcp_usrclosed(struct tcpcb *tp) tcp_state_change(tp, TCPS_LAST_ACK); break; } + if ((tp->t_state == TCPS_LAST_ACK) && + (tp->t_flags & TF_SENTFIN)) { + /* + * If we have reached LAST_ACK, and + * we sent a FIN (e.g. via MSG_EOR), then + * we really should move to either FIN_WAIT_1 + * or FIN_WAIT_2 depending on snd_max/snd_una. + */ + if (tp->snd_una == tp->snd_max) { + /* The FIN is acked */ + tcp_state_change(tp, TCPS_FIN_WAIT_2); + } else { + /* The FIN is still outstanding */ + tcp_state_change(tp, TCPS_FIN_WAIT_1); + } + } if (tp->t_state >= TCPS_FIN_WAIT_2) { soisdisconnected(tp->t_inpcb->inp_socket); /* Prevent the connection hanging in FIN_WAIT_2 forever. */ From owner-dev-commits-src-main@freebsd.org Tue May 25 17:51: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 46BBD6511B8; Tue, 25 May 2021 17:51: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 4FqM8k1SDTz3sxP; Tue, 25 May 2021 17:51: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 19D0921D6A; Tue, 25 May 2021 17:51: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 14PHpoQ8012739; Tue, 25 May 2021 17:51:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PHpnxk012722; Tue, 25 May 2021 17:51:49 GMT (envelope-from git) Date: Tue, 25 May 2021 17:51:49 GMT Message-Id: <202105251751.14PHpnxk012722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 086a35562f47 - main - tcp: enter network epoch when calling tfb_tcp_fb_fini MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 086a35562f47917a516d30acc8b78a4884e31a4f 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, 25 May 2021 17:51:50 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=086a35562f47917a516d30acc8b78a4884e31a4f commit 086a35562f47917a516d30acc8b78a4884e31a4f Author: Andrew Gallatin AuthorDate: 2021-05-25 17:45:37 +0000 Commit: Andrew Gallatin CommitDate: 2021-05-25 17:45:37 +0000 tcp: enter network epoch when calling tfb_tcp_fb_fini We need to enter the network epoch when calling into tfb_tcp_fb_fini. I noticed this when I hit an assert running the latest rack Differential Revision: https://reviews.freebsd.org/D30407 Reviewed by: rrs, tuexen Sponsored by: Netflix --- sys/netinet/tcp_usrreq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 4f418f8809a7..caef798772ea 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1818,11 +1818,14 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) * new one already. */ if (tp->t_fb->tfb_tcp_fb_fini) { + struct epoch_tracker et; /* * Tell the stack to cleanup with 0 i.e. * the tcb is not going away. */ + NET_EPOCH_ENTER(et); (*tp->t_fb->tfb_tcp_fb_fini)(tp, 0); + NET_EPOCH_EXIT(et); } #ifdef TCPHPTS /* Assure that we are not on any hpts */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:14: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 4904265192A; Tue, 25 May 2021 18:14: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 4FqMgK1bwZz3txK; Tue, 25 May 2021 18:14: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 1359622239; Tue, 25 May 2021 18:14: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 14PIEqh1043678; Tue, 25 May 2021 18:14:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIEqpo043677; Tue, 25 May 2021 18:14:52 GMT (envelope-from git) Date: Tue, 25 May 2021 18:14:52 GMT Message-Id: <202105251814.14PIEqpo043677@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: cae1683120e2 - main - LinuxKPI: add guid_t for ACPI consumers. 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: cae1683120e2bf8e39901d29a17c473401653985 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, 25 May 2021 18:14:53 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=cae1683120e2bf8e39901d29a17c473401653985 commit cae1683120e2bf8e39901d29a17c473401653985 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:50:10 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:46 +0000 LinuxKPI: add guid_t for ACPI consumers. Add a placeholder struct for guid_t which is needed by ACPI consumers in at least one wireless driver. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30439 --- sys/compat/linuxkpi/common/include/linux/acpi.h | 1 + sys/compat/linuxkpi/common/include/linux/uuid.h | 40 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/acpi.h b/sys/compat/linuxkpi/common/include/linux/acpi.h index 068e0fe6fb06..b1e65b9afad9 100644 --- a/sys/compat/linuxkpi/common/include/linux/acpi.h +++ b/sys/compat/linuxkpi/common/include/linux/acpi.h @@ -32,6 +32,7 @@ #define _LINUX_ACPI_H_ #include +#include #if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) diff --git a/sys/compat/linuxkpi/common/include/linux/uuid.h b/sys/compat/linuxkpi/common/include/linux/uuid.h new file mode 100644 index 000000000000..f2ff450ee907 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/uuid.h @@ -0,0 +1,40 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_UUID_H +#define __LKPI_LINUX_UUID_H + +typedef struct { + char x[16]; +} guid_t; + +#endif /* __LKPI_LINUX_UUID_H */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:14: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 C5B4765192B; Tue, 25 May 2021 18:14: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 4FqMgM4v0fz3ts4; Tue, 25 May 2021 18:14: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 64294224E6; Tue, 25 May 2021 18:14: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 14PIEtYV043722; Tue, 25 May 2021 18:14:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIEtGk043721; Tue, 25 May 2021 18:14:55 GMT (envelope-from git) Date: Tue, 25 May 2021 18:14:55 GMT Message-Id: <202105251814.14PIEtGk043721@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: 43b4c00643ba - main - LinuxKPI: extract stringify() in their own header file 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: 43b4c00643bacb9d1ba3aa1022648104bc7ff4a2 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, 25 May 2021 18:14:55 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=43b4c00643bacb9d1ba3aa1022648104bc7ff4a2 commit 43b4c00643bacb9d1ba3aa1022648104bc7ff4a2 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:53:28 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:46 +0000 LinuxKPI: extract stringify() in their own header file Add linux/stringify.h as directly included by drivers. Remove the definitions from compiler.h and include the new header in places where the stringify macros are already used without linuxkpi. I have adjusted the Copyright of the new file according to the commit originaly adding the macros (99e690772adbcb78c9e8441bedcf1913d72ea72f). Sposnored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30440 --- .../linuxkpi/common/include/linux/compiler.h | 2 -- sys/compat/linuxkpi/common/include/linux/kernel.h | 1 + sys/compat/linuxkpi/common/include/linux/module.h | 1 + .../linuxkpi/common/include/linux/stringify.h | 37 ++++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/sysfs.h | 1 + 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h index d8aef4fa7988..470e1f151413 100644 --- a/sys/compat/linuxkpi/common/include/linux/compiler.h +++ b/sys/compat/linuxkpi/common/include/linux/compiler.h @@ -60,8 +60,6 @@ #define __percpu #define __weak __weak_symbol #define __malloc -#define ___stringify(...) #__VA_ARGS__ -#define __stringify(...) ___stringify(__VA_ARGS__) #define __attribute_const__ __attribute__((__const__)) #undef __always_inline #define __always_inline inline diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index daef6216a151..b30fa8ba5729 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -45,6 +45,7 @@ #include #include +#include #include #include #include diff --git a/sys/compat/linuxkpi/common/include/linux/module.h b/sys/compat/linuxkpi/common/include/linux/module.h index a5a8dd540dd6..cd5366bc52d0 100644 --- a/sys/compat/linuxkpi/common/include/linux/module.h +++ b/sys/compat/linuxkpi/common/include/linux/module.h @@ -37,6 +37,7 @@ #include #include +#include #include #include #include diff --git a/sys/compat/linuxkpi/common/include/linux/stringify.h b/sys/compat/linuxkpi/common/include/linux/stringify.h new file mode 100644 index 000000000000..08fd0d909fae --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/stringify.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies, Ltd. + * 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 unmodified, 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$ + */ + +#ifndef __LKPI_LINUX_STRINGIFY_H_ +#define __LKPI_LINUX_STRINGIFY_H_ + +#include + +#define ___stringify(...) #__VA_ARGS__ +#define __stringify(...) ___stringify(__VA_ARGS__) + +#endif /* __LKPI_LINUX_STRINGIFY_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h index c645d9fdf45a..f84790f1b910 100644 --- a/sys/compat/linuxkpi/common/include/linux/sysfs.h +++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h @@ -36,6 +36,7 @@ #include #include +#include struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); From owner-dev-commits-src-main@freebsd.org Tue May 25 18:14: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 54F80651C04; Tue, 25 May 2021 18:14: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 4FqMgL1kwKz3txL; Tue, 25 May 2021 18:14: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 24CCB22507; Tue, 25 May 2021 18:14: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 14PIEsAB043699; Tue, 25 May 2021 18:14:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIEsTr043698; Tue, 25 May 2021 18:14:54 GMT (envelope-from git) Date: Tue, 25 May 2021 18:14:54 GMT Message-Id: <202105251814.14PIEsTr043698@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: 5878c7c7b090 - main - LinuxKPI: add kernel_ulong_t typedef in linux/kernel.h. 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: 5878c7c7b090c8579316ae4479e962684d49a499 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, 25 May 2021 18:14:54 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=5878c7c7b090c8579316ae4479e962684d49a499 commit 5878c7c7b090c8579316ae4479e962684d49a499 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:47:49 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:46 +0000 LinuxKPI: add kernel_ulong_t typedef in linux/kernel.h. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30438 --- sys/compat/linuxkpi/common/include/linux/types.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/types.h b/sys/compat/linuxkpi/common/include/linux/types.h index aa3580c81a27..db362c388573 100644 --- a/sys/compat/linuxkpi/common/include/linux/types.h +++ b/sys/compat/linuxkpi/common/include/linux/types.h @@ -72,6 +72,7 @@ typedef unsigned __poll_t; typedef uint64_t phys_addr_t; typedef size_t __kernel_size_t; +typedef unsigned long kernel_ulong_t; #define DECLARE_BITMAP(n, bits) \ unsigned long n[howmany(bits, sizeof(long) * 8)] From owner-dev-commits-src-main@freebsd.org Tue May 25 18:14: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 D299D65192D; Tue, 25 May 2021 18:14: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 4FqMgN3vNsz3tsB; Tue, 25 May 2021 18:14: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 67E43223A4; Tue, 25 May 2021 18:14: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 14PIEuRq043745; Tue, 25 May 2021 18:14:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIEuum043744; Tue, 25 May 2021 18:14:56 GMT (envelope-from git) Date: Tue, 25 May 2021 18:14:56 GMT Message-Id: <202105251814.14PIEuum043744@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: abcac97f8202 - main - LinuxKPI: add kfree_sensitive() using zfree(). 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: abcac97f8202d91b61ae4846794ba60166a56cfe 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, 25 May 2021 18:14:57 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=abcac97f8202d91b61ae4846794ba60166a56cfe commit abcac97f8202d91b61ae4846794ba60166a56cfe Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:43:33 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:46 +0000 LinuxKPI: add kfree_sensitive() using zfree(). Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30437 --- sys/compat/linuxkpi/common/include/linux/slab.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index 9494d458e87c..8d5eb3e85e96 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -198,6 +198,12 @@ kfree(const void *ptr) free(__DECONST(void *, ptr), M_KMALLOC); } +static __inline void +kfree_sensitive(const void *ptr) +{ + zfree(__DECONST(void *, ptr), M_KMALLOC); +} + static inline size_t ksize(const void *ptr) { From owner-dev-commits-src-main@freebsd.org Tue May 25 18:14: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 15726651A9B; Tue, 25 May 2021 18:14: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 4FqMgQ6C4zz3vF5; Tue, 25 May 2021 18:14: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 B8CBE2223A; Tue, 25 May 2021 18:14: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 14PIEwQc043793; Tue, 25 May 2021 18:14:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIEw26043792; Tue, 25 May 2021 18:14:58 GMT (envelope-from git) Date: Tue, 25 May 2021 18:14:58 GMT Message-Id: <202105251814.14PIEw26043792@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: 10096cb60619 - main - LinuxKPI: add prandom_u32() as used by wireless drivers. 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: 10096cb60619984eefc628471f219d4723867bb1 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, 25 May 2021 18:14:59 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=10096cb60619984eefc628471f219d4723867bb1 commit 10096cb60619984eefc628471f219d4723867bb1 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:38:58 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:46 +0000 LinuxKPI: add prandom_u32() as used by wireless drivers. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30435 --- sys/compat/linuxkpi/common/include/linux/random.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/random.h b/sys/compat/linuxkpi/common/include/linux/random.h index 31d8b996aa0b..12de0e12bc5a 100644 --- a/sys/compat/linuxkpi/common/include/linux/random.h +++ b/sys/compat/linuxkpi/common/include/linux/random.h @@ -63,6 +63,15 @@ get_random_long(void) return (val); } +static __inline uint32_t +prandom_u32(void) +{ + uint32_t val; + + get_random_bytes(&val, sizeof(val)); + return (val); +} + static inline u32 prandom_u32_max(u32 max) { From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 6FEB7651C97; Tue, 25 May 2021 18:15: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 4FqMgV29Q2z3txc; Tue, 25 May 2021 18:15: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 1A6CE22508; Tue, 25 May 2021 18:15: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 14PIF2Yh043867; Tue, 25 May 2021 18:15:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIF2hI043866; Tue, 25 May 2021 18:15:02 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:02 GMT Message-Id: <202105251815.14PIF2hI043866@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: 18d303b05f28 - main - LinuxKPI: add ktime_get_boottime_ns() implementation to ktime.h 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: 18d303b05f28acf005dad3f2ffbbec4895181dde 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, 25 May 2021 18:15:02 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=18d303b05f28acf005dad3f2ffbbec4895181dde commit 18d303b05f28acf005dad3f2ffbbec4895181dde Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:30:33 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:47 +0000 LinuxKPI: add ktime_get_boottime_ns() implementation to ktime.h Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30432 --- sys/compat/linuxkpi/common/include/linux/ktime.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/ktime.h b/sys/compat/linuxkpi/common/include/linux/ktime.h index e480de3181a9..1475674a12e6 100644 --- a/sys/compat/linuxkpi/common/include/linux/ktime.h +++ b/sys/compat/linuxkpi/common/include/linux/ktime.h @@ -220,6 +220,13 @@ ktime_get_boottime(void) return (timespec_to_ktime(ts)); } +static inline uint64_t +ktime_get_boottime_ns(void) +{ + + return (ktime_to_ns(ktime_get_boottime())); +} + static inline ktime_t ktime_get_real(void) { From owner-dev-commits-src-main@freebsd.org Tue May 25 18:14: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 1E12E6517FC; Tue, 25 May 2021 18:14: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 4FqMgP4gHQz3v12; Tue, 25 May 2021 18:14: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 87B82224E7; Tue, 25 May 2021 18:14: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 14PIEvvw043766; Tue, 25 May 2021 18:14:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIEvPN043765; Tue, 25 May 2021 18:14:57 GMT (envelope-from git) Date: Tue, 25 May 2021 18:14:57 GMT Message-Id: <202105251814.14PIEvPN043765@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: fa58da02f708 - main - LinuxKPI: add rcu_dereference_check() 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: fa58da02f708a22200a89032b8eaf35e1c8ef4a6 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, 25 May 2021 18:14:58 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fa58da02f708a22200a89032b8eaf35e1c8ef4a6 commit fa58da02f708a22200a89032b8eaf35e1c8ef4a6 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:40:42 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:46 +0000 LinuxKPI: add rcu_dereference_check() Add a define for rcu_dereference_check() to rcu_dereference_protected() which ignores the check argument. Our lockdep compat implementation for use cases found in iwlwifi would return 1 anyway. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30436 --- sys/compat/linuxkpi/common/include/linux/rcupdate.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/rcupdate.h b/sys/compat/linuxkpi/common/include/linux/rcupdate.h index ea97fecee53b..bd8335216d1d 100644 --- a/sys/compat/linuxkpi/common/include/linux/rcupdate.h +++ b/sys/compat/linuxkpi/common/include/linux/rcupdate.h @@ -87,6 +87,9 @@ #define rcu_dereference(p) \ rcu_dereference_protected(p, 0) +#define rcu_dereference_check(p, c) \ + rcu_dereference_protected(p, c) + #define rcu_dereference_raw(p) \ ((__typeof(*p) *)READ_ONCE(p)) From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 4258B651936; Tue, 25 May 2021 18:15: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 4FqMgS23SQz3tsV; Tue, 25 May 2021 18:15: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 D6507224E8; Tue, 25 May 2021 18:14: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 14PIExcw043817; Tue, 25 May 2021 18:14:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIExcU043816; Tue, 25 May 2021 18:14:59 GMT (envelope-from git) Date: Tue, 25 May 2021 18:14:59 GMT Message-Id: <202105251814.14PIExcU043816@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: fc1d840901b1 - main - LinuxKPI: add more #defines to pci.h 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: fc1d840901b1aefe22924d772781e2c835edb096 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, 25 May 2021 18:15:01 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fc1d840901b1aefe22924d772781e2c835edb096 commit fc1d840901b1aefe22924d772781e2c835edb096 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:36:18 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:46 +0000 LinuxKPI: add more #defines to pci.h Add more definitions for various PCI uses to linux/pci.h. Almost all are defined to their FreeBSD counterparts which are described there. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30434 --- sys/compat/linuxkpi/common/include/linux/pci.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index c718c674ea1f..f1b928b792fa 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -86,8 +86,12 @@ struct pci_device_id { #define PCI_VENDOR_ID PCIR_DEVVENDOR #define PCI_COMMAND PCIR_COMMAND +#define PCI_COMMAND_INTX_DISABLE PCIM_CMD_INTxDIS #define PCI_EXP_DEVCTL PCIER_DEVICE_CTL /* Device Control */ #define PCI_EXP_LNKCTL PCIER_LINK_CTL /* Link Control */ +#define PCI_EXP_LNKCTL_ASPM_L0S PCIEM_LINK_CTL_ASPMC_L0S +#define PCI_EXP_LNKCTL_ASPM_L1 PCIEM_LINK_CTL_ASPMC_L1 +#define PCI_EXP_LNKCTL_CLKREQ_EN PCIEM_LINK_CTL_ECPM /* Enable clock PM */ #define PCI_EXP_FLAGS_TYPE PCIEM_FLAGS_TYPE /* Device/Port type */ #define PCI_EXP_DEVCAP PCIER_DEVICE_CAP /* Device capabilities */ #define PCI_EXP_DEVSTA PCIER_DEVICE_STA /* Device Status */ @@ -101,6 +105,7 @@ struct pci_device_id { #define PCI_EXP_RTSTA PCIER_ROOT_STA /* Root Status */ #define PCI_EXP_DEVCAP2 PCIER_DEVICE_CAP2 /* Device Capabilities 2 */ #define PCI_EXP_DEVCTL2 PCIER_DEVICE_CTL2 /* Device Control 2 */ +#define PCI_EXP_DEVCTL2_LTR_EN PCIEM_CTL2_LTR_ENABLE #define PCI_EXP_LNKCAP2 PCIER_LINK_CAP2 /* Link Capabilities 2 */ #define PCI_EXP_LNKCTL2 PCIER_LINK_CTL2 /* Link Control 2 */ #define PCI_EXP_LNKSTA2 PCIER_LINK_STA2 /* Link Status 2 */ @@ -150,6 +155,10 @@ enum pcie_link_width { PCIE_LNK_WIDTH_UNKNOWN = 0xff, }; +#define PCIE_LINK_STATE_L0S 0x00000001 +#define PCIE_LINK_STATE_L1 0x00000002 +#define PCIE_LINK_STATE_CLKPM 0x00000004 + typedef int pci_power_t; #define PCI_D0 PCI_POWERSTATE_D0 @@ -160,6 +169,11 @@ typedef int pci_power_t; #define PCI_POWER_ERROR PCI_POWERSTATE_UNKNOWN +#define PCI_ERR_ROOT_COMMAND PCIR_AER_ROOTERR_CMD +#define PCI_ERR_ROOT_ERR_SRC PCIR_AER_COR_SOURCE_ID + +#define PCI_EXT_CAP_ID_ERR PCIZ_AER + struct pci_dev; struct pci_driver { From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 14701651945; Tue, 25 May 2021 18:15: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 4FqMgW3hWhz3vFR; Tue, 25 May 2021 18:15: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 454CB224E9; Tue, 25 May 2021 18:15: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 14PIF3HW043888; Tue, 25 May 2021 18:15:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIF3ck043887; Tue, 25 May 2021 18:15:03 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:03 GMT Message-Id: <202105251815.14PIF3ck043887@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: 1082490cd867 - main - LinuxKPI: change BUILD_BUG_ON() 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: 1082490cd867a4d443862523c37ce947735342d0 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, 25 May 2021 18:15:04 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1082490cd867a4d443862523c37ce947735342d0 commit 1082490cd867a4d443862523c37ce947735342d0 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:26:41 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:47 +0000 LinuxKPI: change BUILD_BUG_ON() BUILD_BUG_ON() can be used inside functions where the definition to CTASSERT() (_Static_assert()) seems to not work. Go back to an old-style CTASSERT() implementation but also add a variable dclaration to avoid "unsued typedef" errors and dummy-use the variable to avoid "unusued variable" errors. Given it is all self-contained in a block and not used outside this should be optimised away. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30431 --- sys/compat/linuxkpi/common/include/linux/kernel.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index b30fa8ba5729..807138334fdd 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -89,8 +89,23 @@ #define S64_C(x) x ## LL #define U64_C(x) x ## ULL +/* + * BUILD_BUG_ON() can happen inside functions where _Static_assert() does not + * seem to work. Use old-schoold-ish CTASSERT from before commit + * a3085588a88fa58eb5b1eaae471999e1995a29cf but also make sure we do not + * end up with an unused typedef or variable. The compiler should optimise + * it away entirely. + */ +#define _O_CTASSERT(x) _O__CTASSERT(x, __LINE__) +#define _O__CTASSERT(x, y) _O___CTASSERT(x, y) +#define _O___CTASSERT(x, y) while (0) { \ + typedef char __assert_line_ ## y[(x) ? 1 : -1]; \ + __assert_line_ ## y _x; \ + _x[0] = '\0'; \ +} + #define BUILD_BUG() do { CTASSERT(0); } while (0) -#define BUILD_BUG_ON(x) CTASSERT(!(x)) +#define BUILD_BUG_ON(x) _O_CTASSERT(!(x)) #define BUILD_BUG_ON_MSG(x, msg) BUILD_BUG_ON(x) #define BUILD_BUG_ON_NOT_POWER_OF_2(x) BUILD_BUG_ON(!powerof2(x)) #define BUILD_BUG_ON_INVALID(expr) while (0) { (void)(expr); } From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15:09 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 66C87651CAC; Tue, 25 May 2021 18:15:09 +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 4FqMgd1Kpvz3ty9; Tue, 25 May 2021 18:15: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 02B49221EF; Tue, 25 May 2021 18:15: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 14PIF87I044009; Tue, 25 May 2021 18:15:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIF8Iu044008; Tue, 25 May 2021 18:15:08 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:08 GMT Message-Id: <202105251815.14PIF8Iu044008@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: ff09f9133f2f - main - LinuxKPI: net/if_inet6.h add struct inet6_dev { } 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: ff09f9133f2fb80f705c2c742fc34291b05140af 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, 25 May 2021 18:15:12 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ff09f9133f2fb80f705c2c742fc34291b05140af commit ff09f9133f2fb80f705c2c742fc34291b05140af Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:11:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:47 +0000 LinuxKPI: net/if_inet6.h add struct inet6_dev { } Add a dummy struct inet6_dev {}; to net/if_inet6.h. This is currently not used for anything but in a declaration. Just needs to be there. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30426 --- sys/compat/linuxkpi/common/include/net/if_inet6.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/net/if_inet6.h b/sys/compat/linuxkpi/common/include/net/if_inet6.h index bb4df2615186..16f3a9965675 100644 --- a/sys/compat/linuxkpi/common/include/net/if_inet6.h +++ b/sys/compat/linuxkpi/common/include/net/if_inet6.h @@ -36,6 +36,10 @@ #include +struct inet6_dev { + /* XXX currently unused but in a declaration. */ +}; + static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf) { /* From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 D5312651D29; Tue, 25 May 2021 18:15: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 4FqMgn2Zkhz3vJQ; Tue, 25 May 2021 18:15: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 03E26221F2; Tue, 25 May 2021 18:15: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 14PIFGA9044176; Tue, 25 May 2021 18:15:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFGeO044175; Tue, 25 May 2021 18:15:16 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:16 GMT Message-Id: <202105251815.14PIFGeO044175@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: 5aeeab54b0e1 - main - LinuxKPI: byteorder.h 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: 5aeeab54b0e1042b09dcea43540994c1ce43eebd 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, 25 May 2021 18:15:18 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=5aeeab54b0e1042b09dcea43540994c1ce43eebd commit 5aeeab54b0e1042b09dcea43540994c1ce43eebd Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:54:16 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:48 +0000 LinuxKPI: byteorder.h Add a few more le_{tp,add}_cpu*() #defines/functions found in wireless drivers. While here fill most of the combinatorics gaps and also add the remaining combinations [1]. Suggested by: emaste [1] (for one part) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30418 --- sys/compat/linuxkpi/common/include/asm/byteorder.h | 138 +++++++++++++++------ 1 file changed, 102 insertions(+), 36 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/asm/byteorder.h b/sys/compat/linuxkpi/common/include/asm/byteorder.h index 0a6c2b039c66..05e39bb52149 100644 --- a/sys/compat/linuxkpi/common/include/asm/byteorder.h +++ b/sys/compat/linuxkpi/common/include/asm/byteorder.h @@ -41,54 +41,120 @@ #define __BIG_ENDIAN #endif -#define cpu_to_le64(x) htole64(x) -#define le64_to_cpu(x) le64toh(x) -#define cpu_to_le32(x) htole32(x) -#define le32_to_cpu(x) le32toh(x) -#define cpu_to_le16(x) htole16(x) -#define le16_to_cpu(x) le16toh(x) -#define cpu_to_be64(x) htobe64(x) -#define be64_to_cpu(x) be64toh(x) -#define cpu_to_be32(x) htobe32(x) -#define be32_to_cpu(x) be32toh(x) -#define cpu_to_be16(x) htobe16(x) -#define be16_to_cpu(x) be16toh(x) +#define __cpu_to_le64(x) htole64(x) +#define cpu_to_le64(x) __cpu_to_le64(x) +#define __le64_to_cpu(x) le64toh(x) +#define le64_to_cpu(x) __le64_to_cpu(x) +#define __cpu_to_le32(x) htole32(x) +#define cpu_to_le32(x) __cpu_to_le32(x) +#define __le32_to_cpu(x) le32toh(x) +#define le32_to_cpu(x) __le32_to_cpu(x) +#define __cpu_to_le16(x) htole16(x) +#define cpu_to_le16(x) __cpu_to_le16(x) +#define __le16_to_cpu(x) le16toh(x) +#define le16_to_cpu(x) __le16_to_cpu(x) +#define __cpu_to_be64(x) htobe64(x) +#define cpu_to_be64(x) __cpu_to_be64(x) +#define __be64_to_cpu(x) be64toh(x) +#define be64_to_cpu(x) __be64_to_cpu(x) +#define __cpu_to_be32(x) htobe32(x) +#define cpu_to_be32(x) __cpu_to_be32(x) +#define __be32_to_cpu(x) be32toh(x) +#define be32_to_cpu(x) __be32_to_cpu(x) +#define __cpu_to_be16(x) htobe16(x) +#define cpu_to_be16(x) __cpu_to_be16(x) #define __be16_to_cpu(x) be16toh(x) +#define be16_to_cpu(x) __be16_to_cpu(x) -#define cpu_to_le64p(x) htole64(*((const uint64_t *)(x))) -#define le64_to_cpup(x) le64toh(*((const uint64_t *)(x))) -#define cpu_to_le32p(x) htole32(*((const uint32_t *)(x))) -#define le32_to_cpup(x) le32toh(*((const uint32_t *)(x))) -#define cpu_to_le16p(x) htole16(*((const uint16_t *)(x))) -#define le16_to_cpup(x) le16toh(*((const uint16_t *)(x))) -#define cpu_to_be64p(x) htobe64(*((const uint64_t *)(x))) -#define be64_to_cpup(x) be64toh(*((const uint64_t *)(x))) -#define cpu_to_be32p(x) htobe32(*((const uint32_t *)(x))) -#define be32_to_cpup(x) be32toh(*((const uint32_t *)(x))) -#define cpu_to_be16p(x) htobe16(*((const uint16_t *)(x))) -#define be16_to_cpup(x) be16toh(*((const uint16_t *)(x))) +#define __cpu_to_le64p(x) htole64(*((const uint64_t *)(x))) +#define cpu_to_le64p(x) __cpu_to_le64p(x) +#define __le64_to_cpup(x) le64toh(*((const uint64_t *)(x))) +#define le64_to_cpup(x) __le64_to_cpup(x) +#define __cpu_to_le32p(x) htole32(*((const uint32_t *)(x))) +#define cpu_to_le32p(x) __cpu_to_le32p(x) +#define __le32_to_cpup(x) le32toh(*((const uint32_t *)(x))) +#define le32_to_cpup(x) __le32_to_cpup(x) +#define __cpu_to_le16p(x) htole16(*((const uint16_t *)(x))) +#define cpu_to_le16p(x) __cpu_to_le16p(x) +#define __le16_to_cpup(x) le16toh(*((const uint16_t *)(x))) +#define le16_to_cpup(x) __le16_to_cpup(x) +#define __cpu_to_be64p(x) htobe64(*((const uint64_t *)(x))) +#define cpu_to_be64p(x) __cpu_to_be64p(x) +#define __be64_to_cpup(x) be64toh(*((const uint64_t *)(x))) +#define be64_to_cpup(x) __be64_to_cpup(x) +#define __cpu_to_be32p(x) htobe32(*((const uint32_t *)(x))) +#define cpu_to_be32p(x) __cpu_to_be32p(x) +#define __be32_to_cpup(x) be32toh(*((const uint32_t *)(x))) +#define be32_to_cpup(x) __be32_to_cpup(x) +#define __cpu_to_be16p(x) htobe16(*((const uint16_t *)(x))) +#define cpu_to_be16p(x) __cpu_to_be16p(x) +#define __be16_to_cpup(x) be16toh(*((const uint16_t *)(x))) +#define be16_to_cpup(x) __be16_to_cpup(x) -#define cpu_to_le64s(x) do { *((uint64_t *)(x)) = cpu_to_le64p((x)); } while (0) -#define le64_to_cpus(x) do { *((uint64_t *)(x)) = le64_to_cpup((x)); } while (0) -#define cpu_to_le32s(x) do { *((uint32_t *)(x)) = cpu_to_le32p((x)); } while (0) -#define le32_to_cpus(x) do { *((uint32_t *)(x)) = le32_to_cpup((x)); } while (0) -#define cpu_to_le16s(x) do { *((uint16_t *)(x)) = cpu_to_le16p((x)); } while (0) -#define le16_to_cpus(x) do { *((uint16_t *)(x)) = le16_to_cpup((x)); } while (0) -#define cpu_to_be64s(x) do { *((uint64_t *)(x)) = cpu_to_be64p((x)); } while (0) -#define be64_to_cpus(x) do { *((uint64_t *)(x)) = be64_to_cpup((x)); } while (0) -#define cpu_to_be32s(x) do { *((uint32_t *)(x)) = cpu_to_be32p((x)); } while (0) -#define be32_to_cpus(x) do { *((uint32_t *)(x)) = be32_to_cpup((x)); } while (0) -#define cpu_to_be16s(x) do { *((uint16_t *)(x)) = cpu_to_be16p((x)); } while (0) -#define be16_to_cpus(x) do { *((uint16_t *)(x)) = be16_to_cpup((x)); } while (0) + +#define __cpu_to_le64s(x) do { *((uint64_t *)(x)) = cpu_to_le64p((x)); } while (0) +#define cpu_to_le64s(x) __cpu_to_le64s(x) +#define __le64_to_cpus(x) do { *((uint64_t *)(x)) = le64_to_cpup((x)); } while (0) +#define le64_to_cpus(x) __le64_to_cpus(x) +#define __cpu_to_le32s(x) do { *((uint32_t *)(x)) = cpu_to_le32p((x)); } while (0) +#define cpu_to_le32s(x) __cpu_to_le32s(x) +#define __le32_to_cpus(x) do { *((uint32_t *)(x)) = le32_to_cpup((x)); } while (0) +#define le32_to_cpus(x) __le32_to_cpus(x) +#define __cpu_to_le16s(x) do { *((uint16_t *)(x)) = cpu_to_le16p((x)); } while (0) +#define cpu_to_le16s(x) __cpu_to_le16s(x) +#define __le16_to_cpus(x) do { *((uint16_t *)(x)) = le16_to_cpup((x)); } while (0) +#define le16_to_cpus(x) __le16_to_cpus(x) +#define __cpu_to_be64s(x) do { *((uint64_t *)(x)) = cpu_to_be64p((x)); } while (0) +#define cpu_to_be64s(x) __cpu_to_be64s(x) +#define __be64_to_cpus(x) do { *((uint64_t *)(x)) = be64_to_cpup((x)); } while (0) +#define be64_to_cpus(x) __be64_to_cpus(x) +#define __cpu_to_be32s(x) do { *((uint32_t *)(x)) = cpu_to_be32p((x)); } while (0) +#define cpu_to_be32s(x) __cpu_to_be32s(x) +#define __be32_to_cpus(x) do { *((uint32_t *)(x)) = be32_to_cpup((x)); } while (0) +#define be32_to_cpus(x) __be32_to_cpus(x) +#define __cpu_to_be16s(x) do { *((uint16_t *)(x)) = cpu_to_be16p((x)); } while (0) +#define cpu_to_be16s(x) __cpu_to_be16s(x) +#define __be16_to_cpus(x) do { *((uint16_t *)(x)) = be16_to_cpup((x)); } while (0) +#define be16_to_cpus(x) __be16_to_cpus(x) #define swab16(x) bswap16(x) #define swab32(x) bswap32(x) #define swab64(x) bswap64(x) +static inline void +be64_add_cpu(uint64_t *var, uint64_t val) +{ + *var = cpu_to_be64(be64_to_cpu(*var) + val); +} + +static inline void +be32_add_cpu(uint32_t *var, uint32_t val) +{ + *var = cpu_to_be32(be32_to_cpu(*var) + val); +} + static inline void be16_add_cpu(uint16_t *var, uint16_t val) { *var = cpu_to_be16(be16_to_cpu(*var) + val); } +static __inline void +le64_add_cpu(uint64_t *var, uint64_t val) +{ + *var = cpu_to_le64(le64_to_cpu(*var) + val); +} + +static __inline void +le32_add_cpu(uint32_t *var, uint32_t val) +{ + *var = cpu_to_le32(le32_to_cpu(*var) + val); +} + +static inline void +le16_add_cpu(uint16_t *var, uint16_t val) +{ + *var = cpu_to_le16(le16_to_cpu(*var) + val); +} + #endif /* _ASM_BYTEORDER_H_ */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 23148651947; Tue, 25 May 2021 18:15: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 4FqMgX66WDz3v1N; Tue, 25 May 2021 18:15: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 647E121AFF; Tue, 25 May 2021 18:15: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 14PIF4A2043917; Tue, 25 May 2021 18:15:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIF4qH043916; Tue, 25 May 2021 18:15:04 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:04 GMT Message-Id: <202105251815.14PIF4qH043916@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: 8620fe4c1092 - main - LinuxKPI: add time_is_after_jiffies() definition 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: 8620fe4c10922b12492155d97b913deb6c5d82c6 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, 25 May 2021 18:15:05 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=8620fe4c10922b12492155d97b913deb6c5d82c6 commit 8620fe4c10922b12492155d97b913deb6c5d82c6 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:24:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:47 +0000 LinuxKPI: add time_is_after_jiffies() definition This is used by wireless drivers. Use the time_after() macro as done for the "after_eq" version. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30430 --- sys/compat/linuxkpi/common/include/linux/jiffies.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/jiffies.h b/sys/compat/linuxkpi/common/include/linux/jiffies.h index ed2c5f774d23..7d547e6d66cd 100644 --- a/sys/compat/linuxkpi/common/include/linux/jiffies.h +++ b/sys/compat/linuxkpi/common/include/linux/jiffies.h @@ -53,6 +53,7 @@ #define time_in_range(a,b,c) \ (time_after_eq(a,b) && time_before_eq(a,c)) #define time_is_after_eq_jiffies(a) time_after_eq(a, jiffies) +#define time_is_after_jiffies(a) time_after(a, jiffies) #define HZ hz From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 C5967651950; Tue, 25 May 2021 18:15: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 4FqMgb6SYtz3vMw; Tue, 25 May 2021 18:15: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 BFEB121FF6; Tue, 25 May 2021 18:15: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 14PIF7MF043986; Tue, 25 May 2021 18:15:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIF7Kv043985; Tue, 25 May 2021 18:15:07 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:07 GMT Message-Id: <202105251815.14PIF7Kv043985@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: 602e4e433d3e - main - LinuxKPI: add irq_set_affinity_hint() 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: 602e4e433d3e7dbb03d4fd30a4720a02cdeca6aa 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, 25 May 2021 18:15:09 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=602e4e433d3e7dbb03d4fd30a4720a02cdeca6aa commit 602e4e433d3e7dbb03d4fd30a4720a02cdeca6aa Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:14:37 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:47 +0000 LinuxKPI: add irq_set_affinity_hint() Add an implementation for irq_set_affinity_hint() to linux/interrupt.h and include linux/hardirq.h for synchronize_irq() as needed by wireless drivers. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30427 --- sys/compat/linuxkpi/common/include/linux/interrupt.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h index fc1241240b39..90994a2f2315 100644 --- a/sys/compat/linuxkpi/common/include/linux/interrupt.h +++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h @@ -31,12 +31,15 @@ #ifndef _LINUX_INTERRUPT_H_ #define _LINUX_INTERRUPT_H_ +#include #include #include #include +#include #include #include +#include typedef irqreturn_t (*irq_handler_t)(int, void *); @@ -183,6 +186,19 @@ free_irq(unsigned int irq, void *device) kfree(irqe); } +static inline int +irq_set_affinity_hint(int vector, cpumask_t *mask) +{ + int error; + + if (mask != NULL) + error = intr_setaffinity(vector, CPU_WHICH_IRQ, mask); + else + error = intr_setaffinity(vector, CPU_WHICH_IRQ, cpuset_root); + + return (-error); +} + /* * LinuxKPI tasklet support */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 7C60C651AC1; Tue, 25 May 2021 18:15: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 4FqMgk6vvbz3v4M; Tue, 25 May 2021 18:15: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 AFB5321FFB; Tue, 25 May 2021 18:15: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 14PIFEGw044124; Tue, 25 May 2021 18:15:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFELi044123; Tue, 25 May 2021 18:15:14 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:14 GMT Message-Id: <202105251815.14PIFELi044123@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: da717031c9fd - main - LinuxKPI: compiler.h add three more defines 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: da717031c9fd914343e19ba87f19c7a9a7006721 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, 25 May 2021 18:15:15 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=da717031c9fd914343e19ba87f19c7a9a7006721 commit da717031c9fd914343e19ba87f19c7a9a7006721 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:59:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:48 +0000 LinuxKPI: compiler.h add three more defines Add fallthrough, ____cacheline_aligned_in_smp, and smp_mb() to linux/compiler.h. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30420 --- sys/compat/linuxkpi/common/include/linux/compiler.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h index 470e1f151413..e641b1b096c3 100644 --- a/sys/compat/linuxkpi/common/include/linux/compiler.h +++ b/sys/compat/linuxkpi/common/include/linux/compiler.h @@ -65,6 +65,8 @@ #define __always_inline inline #define noinline __noinline #define ____cacheline_aligned __aligned(CACHE_LINE_SIZE) +#define ____cacheline_aligned_in_smp __aligned(CACHE_LINE_SIZE) +#define fallthrough /* FALLTHROUGH */ do { } while(0) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) @@ -78,6 +80,7 @@ #define __printf(a,b) __printflike(a,b) #define barrier() __asm__ __volatile__("": : :"memory") +#define smp_mb() mb() #define lower_32_bits(n) ((u32)(n)) #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 1EC40651DA7; Tue, 25 May 2021 18:15: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 4FqMgs1cGBz3vQR; Tue, 25 May 2021 18:15:21 +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 70038221F8; Tue, 25 May 2021 18:15: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 14PIFKwn044241; Tue, 25 May 2021 18:15:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFKmF044240; Tue, 25 May 2021 18:15:20 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:20 GMT Message-Id: <202105251815.14PIFKmF044240@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: 095f018e4915 - main - LinuxKPI: add addrconf_addr_solict_mult() 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: 095f018e4915bf63447ecd6be3beae0dd1a5ff52 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, 25 May 2021 18:15:22 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=095f018e4915bf63447ecd6be3beae0dd1a5ff52 commit 095f018e4915bf63447ecd6be3beae0dd1a5ff52 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:49:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:49 +0000 LinuxKPI: add addrconf_addr_solict_mult() Introduce net/addrconf.h with an implementation to addrconf_addr_solict_mult() used by WiFi drivers. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30416 --- sys/compat/linuxkpi/common/include/net/addrconf.h | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/net/addrconf.h b/sys/compat/linuxkpi/common/include/net/addrconf.h new file mode 100644 index 000000000000..32bbaf176336 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/net/addrconf.h @@ -0,0 +1,51 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_NET_ADDRCONF_H +#define __LKPI_NET_ADDRCONF_H + +#include +#include + +static __inline void +addrconf_addr_solict_mult(struct in6_addr *ia6, struct in6_addr *sol) +{ + + sol->s6_addr16[0] = IPV6_ADDR_INT16_MLL; + sol->s6_addr16[1] = 0; + sol->s6_addr32[1] = 0; + sol->s6_addr32[2] = IPV6_ADDR_INT32_ONE; + sol->s6_addr32[3] = ia6->s6_addr32[3]; + sol->s6_addr8[12] = 0xff; +} + +#endif /* __LKPI_NET_ADDRCONF_H */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 795646518FC; Tue, 25 May 2021 18:15: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 4FqMgr08rmz3v76; Tue, 25 May 2021 18:15: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 51B0B221F6; Tue, 25 May 2021 18:15: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 14PIFJQS044218; Tue, 25 May 2021 18:15:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFJkn044217; Tue, 25 May 2021 18:15:19 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:19 GMT Message-Id: <202105251815.14PIFJkn044217@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: 32f753f27032 - main - LinuxKPI: add Exponentially Weighted Moving Average implementation 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: 32f753f27032849de685c15c471034cbc945a544 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, 25 May 2021 18:15:20 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=32f753f27032849de685c15c471034cbc945a544 commit 32f753f27032849de685c15c471034cbc945a544 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:42:25 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:48 +0000 LinuxKPI: add Exponentially Weighted Moving Average implementation Add DECLARE_EWMA() which expands to a per-name EWMA implementation as used by multiple wireless drivers. Sposnored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky, cperciva, dwmalone Differential Revision: https://reviews.freebsd.org/D30415 --- sys/compat/linuxkpi/common/include/linux/average.h | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/average.h b/sys/compat/linuxkpi/common/include/linux/average.h new file mode 100644 index 000000000000..4291bf2d85be --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/average.h @@ -0,0 +1,92 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_AVERAGE_H +#define __LKPI_LINUX_AVERAGE_H + +#include +#include +#include +#include + +/* EWMA stands for Exponentially Weighted Moving Average. */ +/* + * Z_t = d X_t + (1 - d) * Z_(t-1); 0 < d <= 1, t >= 1; Roberts (1959). + * t : observation number in time. + * d : weight for current observation. + * Xt : observations over time. + * Zt : EWMA value after observation t. + * + * wmba_*_read seems to return up-to [u]long values; have to deal with 32/64bit. + * According to the ath5k.h change log this seems to be a fix-(_p)recision impl. + * assert 2/4 bits for frac. + * Also all (_d) values seem to be pow2 which simplifies maths (shift by + * d = ilog2(_d) instead of doing division (d = 1/_d)). Keep it this way until + * we hit the CTASSERT. + */ + +#define DECLARE_EWMA(_name, _p, _d) \ + \ + CTASSERT((sizeof(unsigned long) <= 4) ? (_p < 30) : (_p < 60)); \ + CTASSERT(_d > 0 && powerof2(_d)); \ + \ + struct ewma_ ## _name { \ + unsigned long zt; \ + }; \ + \ + static __inline void \ + ewma_ ## _name ## _init(struct ewma_ ## _name *ewma) \ + { \ + /* No target (no historical data). */ \ + ewma->zt = 0; \ + } \ + \ + static __inline void \ + ewma_ ## _name ## _add(struct ewma_ ## _name *ewma, unsigned long x) \ + { \ + unsigned long ztm1 = ewma->zt; /* Z_(t-1). */ \ + int d = ilog2(_d); \ + \ + if (ewma->zt == 0) \ + ewma->zt = x << (_p); \ + else \ + ewma->zt = ((x << (_p)) >> d) + \ + (((ztm1 << d) - ztm1) >> d); \ + } \ + \ + static __inline unsigned long \ + ewma_ ## _name ## _read(struct ewma_ ## _name *ewma) \ + { \ + return (ewma->zt >> (_p)); \ + } \ + +#endif /* __LKPI_LINUX_AVERAGE_H */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 600B66517FE; Tue, 25 May 2021 18:15: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 4FqMgT0xTrz3v1C; Tue, 25 May 2021 18:15: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 ECE0021FF4; Tue, 25 May 2021 18:15: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 14PIF0AK043846; Tue, 25 May 2021 18:15:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIF0GZ043845; Tue, 25 May 2021 18:15:00 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:00 GMT Message-Id: <202105251815.14PIF0GZ043845@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: c1661d59e68e - main - LinuxKPI: add LINUXKPI_PARAM_charp() 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: c1661d59e68e29a817c870f421a6871563039dbb 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, 25 May 2021 18:15:01 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c1661d59e68e29a817c870f421a6871563039dbb commit c1661d59e68e29a817c870f421a6871563039dbb Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:32:11 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:46 +0000 LinuxKPI: add LINUXKPI_PARAM_charp() Add yet another version of the various module_param_named() use cases. This one deals with "charp". Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30433 --- sys/compat/linuxkpi/common/include/linux/moduleparam.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/moduleparam.h b/sys/compat/linuxkpi/common/include/linux/moduleparam.h index 3a16c20fd92e..2b48ec1809b7 100644 --- a/sys/compat/linuxkpi/common/include/linux/moduleparam.h +++ b/sys/compat/linuxkpi/common/include/linux/moduleparam.h @@ -102,6 +102,12 @@ LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) +#define LINUXKPI_PARAM_charp(name, var, perm) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_STRING(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + #define module_param_string(name, str, len, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_STRING(LINUXKPI_PARAM_PARENT, OID_AUTO, \ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 50F8F651D94; Tue, 25 May 2021 18:15: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 4FqMgh2KZyz3vL8; Tue, 25 May 2021 18:15:11 +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 4458F21F3C; Tue, 25 May 2021 18:15:11 +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 14PIFBDO044057; Tue, 25 May 2021 18:15:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFBbl044056; Tue, 25 May 2021 18:15:11 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:11 GMT Message-Id: <202105251815.14PIFBbl044056@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: e7a0b685405f - main - LinuxKPI: add dev_crit() to linux/device.h 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: e7a0b685405f8d51597079e3531f313d9e44b4a4 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, 25 May 2021 18:15:13 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=e7a0b685405f8d51597079e3531f313d9e44b4a4 commit e7a0b685405f8d51597079e3531f313d9e44b4a4 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:07:31 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:48 +0000 LinuxKPI: add dev_crit() to linux/device.h Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: emaste, hselasky Differential Revision: https://reviews.freebsd.org/D30424 --- sys/compat/linuxkpi/common/include/linux/device.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 5acaa4142d62..4ef35e6abcd3 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -181,6 +181,7 @@ show_class_attr_string(struct class *class, _CLASS_ATTR_STRING(_name, _mode, _str) #define dev_err(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) +#define dev_crit(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) #define dev_warn(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) #define dev_info(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) #define dev_notice(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 CB92C651794; Tue, 25 May 2021 18:15: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 4FqMgj6lYnz3vNL; Tue, 25 May 2021 18:15: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 87A942250E; Tue, 25 May 2021 18:15: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 14PIFDcX044103; Tue, 25 May 2021 18:15:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFDwv044102; Tue, 25 May 2021 18:15:13 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:13 GMT Message-Id: <202105251815.14PIFDwv044102@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: 5fce802722cd - main - LinuxKPI: add cpu.h for cpumask_*() 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: 5fce802722cd4435a748d89043615324db4efe5e 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, 25 May 2021 18:15:14 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=5fce802722cd4435a748d89043615324db4efe5e commit 5fce802722cd4435a748d89043615324db4efe5e Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:01:59 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:48 +0000 LinuxKPI: add cpu.h for cpumask_*() Add linux/cpu.h for cpumask_*() functions found in wireless drivers and make sure cpu_online_mask is always initialised. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30421 --- sys/compat/linuxkpi/common/include/linux/cpu.h | 76 ++++++++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_compat.c | 4 ++ 2 files changed, 80 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/cpu.h b/sys/compat/linuxkpi/common/include/linux/cpu.h new file mode 100644 index 000000000000..5be8f3d5a0d5 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/cpu.h @@ -0,0 +1,76 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_CPU_H +#define __LKPI_LINUX_CPU_H + +#include +#include +#include +#include +#include +#include + +typedef cpuset_t cpumask_t; + +extern cpumask_t cpu_online_mask; + +static __inline int +cpumask_next(int cpuid, cpumask_t mask) +{ + + /* + * -1 can be an input to cpuid according to logic in drivers + * but is never a valid cpuid in a set! + */ + KASSERT((cpuid >= -1 && cpuid <= MAXCPU), ("%s: invalid cpuid %d\n", + __func__, cpuid)); + KASSERT(!CPU_EMPTY(&mask), ("%s: empty CPU mask", __func__)); + + do { + cpuid++; +#ifdef SMP + if (cpuid > mp_maxid) +#endif + cpuid = 0; + } while (!CPU_ISSET(cpuid, &mask)); + return (cpuid); +} + +static __inline void +cpumask_set_cpu(int cpu, cpumask_t *mask) +{ + + CPU_SET(cpu, mask); +} + +#endif /* __LKPI_LINUX_CPU_H */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index a8f090ed0bd5..ef570dda542c 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #endif #include +#include #include #include #include @@ -119,6 +120,7 @@ static void linux_destroy_dev(struct linux_cdev *); static void linux_cdev_deref(struct linux_cdev *ldev); static struct vm_area_struct *linux_cdev_handle_find(void *handle); +cpumask_t cpu_online_mask; struct kobject linux_class_root; struct device linux_root_device; struct class linux_class_misc; @@ -2627,6 +2629,8 @@ linux_compat_init(void *arg) LIST_INIT(&vmmaphead[i]); init_waitqueue_head(&linux_bit_waitq); init_waitqueue_head(&linux_var_waitq); + + CPU_COPY(&all_cpus, &cpu_online_mask); } SYSINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_init, NULL); From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 A3A1965177D; Tue, 25 May 2021 18:15: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 4FqMgY70G5z3tsg; Tue, 25 May 2021 18:15: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 7A62E22580; Tue, 25 May 2021 18:15: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 14PIF5fA043942; Tue, 25 May 2021 18:15:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIF5TV043941; Tue, 25 May 2021 18:15:05 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:05 GMT Message-Id: <202105251815.14PIF5TV043941@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: 762efb2d6dd6 - main - LinuxKPI: ipv6.h add missing #include 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: 762efb2d6dd67f7b999d40b10d58828efb473236 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, 25 May 2021 18:15:06 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=762efb2d6dd67f7b999d40b10d58828efb473236 commit 762efb2d6dd67f7b999d40b10d58828efb473236 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:21:55 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:47 +0000 LinuxKPI: ipv6.h add missing #include Include linux/bitops.h for a definition of BITS_PER_LONG so that this file can be used independently. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30429 --- sys/compat/linuxkpi/common/include/net/ipv6.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/net/ipv6.h b/sys/compat/linuxkpi/common/include/net/ipv6.h index 3eb6051035af..37c30ed6e793 100644 --- a/sys/compat/linuxkpi/common/include/net/ipv6.h +++ b/sys/compat/linuxkpi/common/include/net/ipv6.h @@ -34,6 +34,7 @@ #include #include #include +#include #define IPV6_DEFAULT_HOPLIMIT 64 From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 6C12E6517A6; Tue, 25 May 2021 18:15: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 4FqMgt0pD8z3vJg; Tue, 25 May 2021 18:15: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 A3754221F9; Tue, 25 May 2021 18:15:21 +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 14PIFL9U044264; Tue, 25 May 2021 18:15:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFLEG044263; Tue, 25 May 2021 18:15:21 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:21 GMT Message-Id: <202105251815.14PIFLEG044263@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: d72cd275187c - main - Bump __FreeBSD_version to 1400015 for LinuxKPI changes. 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: d72cd275187c6399caf0ca4125292dc7e55fa478 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, 25 May 2021 18:15:22 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d72cd275187c6399caf0ca4125292dc7e55fa478 commit d72cd275187c6399caf0ca4125292dc7e55fa478 Author: Bjoern A. Zeeb AuthorDate: 2021-05-25 17:37:15 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:49 +0000 Bump __FreeBSD_version to 1400015 for LinuxKPI changes. Commits 17accc08ae15 and de102f870501 add new files to LinuxKPI which break drm-kmod. In addition various other additions where comitted. Bump __FreeBSD_version to 1400015 to be able to detect this. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks --- UPDATING | 5 +++++ sys/sys/param.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 45f85647980b..f1ff8a8b64b1 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,11 @@ 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".) +20210525: + Commits 17accc08ae15 and de102f870501 add new files to LinuxKPI + which break drm-kmod. In addition various other additions where + comitted. Bump __FreeBSD_version to 1400015 to be able to detect this. + 20210513: Commit ca179c4d74f2 changed the package in which the OpenSSL libraries and utilities are packaged. diff --git a/sys/sys/param.h b/sys/sys/param.h index 81971777e87b..279164f2115b 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400014 +#define __FreeBSD_version 1400015 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 1B350651CAD; Tue, 25 May 2021 18:15:11 +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 4FqMgf5RSxz3vL5; Tue, 25 May 2021 18:15: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 2869B22581; Tue, 25 May 2021 18:15: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 14PIF9Vw044030; Tue, 25 May 2021 18:15:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIF9oM044029; Tue, 25 May 2021 18:15:09 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:09 GMT Message-Id: <202105251815.14PIF9oM044029@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: 834227ba6e80 - main - LinuxKPI: add ether_addr_equal_unaligned() 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: 834227ba6e80dc0899d2372ae8986241f5658c4e 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, 25 May 2021 18:15:11 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=834227ba6e80dc0899d2372ae8986241f5658c4e commit 834227ba6e80dc0899d2372ae8986241f5658c4e Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:09:37 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:47 +0000 LinuxKPI: add ether_addr_equal_unaligned() Replace the implementation for ether_addr_equal() with ether_addr_equal_unaligned() and add a define for ether_addr_equal() pointing to the now ether_addr_equal_unaligned() implementation. This way ether_addr_equal_unaligned() cannot be broken by accident [1]. Suggested by: emaste [1] Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30425 --- sys/compat/linuxkpi/common/include/linux/etherdevice.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h index 392f395a5feb..9062cd562347 100644 --- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h @@ -82,10 +82,11 @@ ether_addr_copy(u8 * dst, const u8 * src) } static inline bool -ether_addr_equal(const u8 *pa, const u8 *pb) +ether_addr_equal_unaligned(const u8 *pa, const u8 *pb) { return (memcmp(pa, pb, 6) == 0); } +#define ether_addr_equal(_pa, _pb) ether_addr_equal_unaligned(_pa, _pb) static inline bool ether_addr_equal_64bits(const u8 *pa, const u8 *pb) From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 8AF24651CB7; Tue, 25 May 2021 18:15: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 4FqMgm4lrkz3vNZ; Tue, 25 May 2021 18:15:16 +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 DC29F224ED; Tue, 25 May 2021 18:15: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 14PIFF7M044147; Tue, 25 May 2021 18:15:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFFg1044146; Tue, 25 May 2021 18:15:15 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:15 GMT Message-Id: <202105251815.14PIFFg1044146@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: e21652c13c7c - main - LinuxKPI: cache.h add SMP_CACHE_BYTES 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: e21652c13c7c161efac7fd0b247c73914312212a 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, 25 May 2021 18:15:17 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=e21652c13c7c161efac7fd0b247c73914312212a commit e21652c13c7c161efac7fd0b247c73914312212a Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:56:53 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:48 +0000 LinuxKPI: cache.h add SMP_CACHE_BYTES Add a definition for SMP_CACHE_BYTES and while here include sys/param.h for CACHE_LINE_SIZE as otherwise code might not compile standalone. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30419 --- sys/compat/linuxkpi/common/include/linux/cache.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/cache.h b/sys/compat/linuxkpi/common/include/linux/cache.h index a269e55eb90b..4d1d400152ff 100644 --- a/sys/compat/linuxkpi/common/include/linux/cache.h +++ b/sys/compat/linuxkpi/common/include/linux/cache.h @@ -31,7 +31,11 @@ #ifndef _LINUX_CACHE_H_ #define _LINUX_CACHE_H_ +#include + #define cache_line_size() CACHE_LINE_SIZE #define L1_CACHE_BYTES CACHE_LINE_SIZE +#define SMP_CACHE_BYTES L1_CACHE_BYTES + #endif /* _LINUX_CACHE_H_ */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 002EF651DA5; Tue, 25 May 2021 18:15: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 4FqMgp4lZlz3v4c; Tue, 25 May 2021 18:15: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 2EAAD221F4; Tue, 25 May 2021 18:15: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 14PIFIXc044197; Tue, 25 May 2021 18:15:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFI4a044196; Tue, 25 May 2021 18:15:18 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:18 GMT Message-Id: <202105251815.14PIFI4a044196@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: f4a145b136ad - main - LinuxKPI: add linux/bsearch.h for sort(9) 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: f4a145b136ad88f7a9f38e3f7732bc5a8b5cb517 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, 25 May 2021 18:15:19 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f4a145b136ad88f7a9f38e3f7732bc5a8b5cb517 commit f4a145b136ad88f7a9f38e3f7732bc5a8b5cb517 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 17:52:02 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:48 +0000 LinuxKPI: add linux/bsearch.h for sort(9) Add linux/bsearch.h which only includes libkern.h as the sort(9) functions seem to be compatible. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30417 --- sys/compat/linuxkpi/common/include/linux/bsearch.h | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/bsearch.h b/sys/compat/linuxkpi/common/include/linux/bsearch.h new file mode 100644 index 000000000000..b8cf7b19b467 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/bsearch.h @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_BSEARCH_H +#define __LKPI_LINUX_BSEARCH_H + +#include + +#endif /* __LKPI_LINUX_BSEARCH_H */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 C0471651AAF; Tue, 25 May 2021 18:15: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 4FqMgb0Grjz3ty2; Tue, 25 May 2021 18:15: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 9D0AE21FF5; Tue, 25 May 2021 18:15: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 14PIF6ke043963; Tue, 25 May 2021 18:15:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIF6E7043962; Tue, 25 May 2021 18:15:06 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:06 GMT Message-Id: <202105251815.14PIF6E7043962@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: b26fb63f2b96 - main - LinuxKPI: add linux/{ip,tcp,udp}.h 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: b26fb63f2b96fddf640260dc4a5acd703c7d425c 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, 25 May 2021 18:15:08 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b26fb63f2b96fddf640260dc4a5acd703c7d425c commit b26fb63f2b96fddf640260dc4a5acd703c7d425c Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:17:30 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:47 +0000 LinuxKPI: add linux/{ip,tcp,udp}.h Add header files for struct and accessors for IPv4, UDP, and TCP. Only parts of the fields of the structs have been seen while working on wireless drivers. The remaining field names are filled up with the FreeBSD field names for now. If you have insights into their correct naming in Linux, feel free to adjust. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30428 --- sys/compat/linuxkpi/common/include/linux/ip.h | 74 ++++++++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/tcp.h | 72 +++++++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/udp.h | 54 +++++++++++++++++++ 3 files changed, 200 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/ip.h b/sys/compat/linuxkpi/common/include/linux/ip.h new file mode 100644 index 000000000000..3507c6fe9b97 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/ip.h @@ -0,0 +1,74 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_IP_H +#define __LKPI_LINUX_IP_H + +#include + +#include +#include + +#include + +/* (u) unconfirmed structure field names; using FreeBSD's meanwhile. */ +struct iphdr { + uint8_t ip_hl:4, ip_ver:4; /* (u) */ + uint8_t ip_tos; /* (u) */ + uint16_t ip_len; /* (u) */ + uint16_t id; + uint16_t ip_off; /* (u) */ + uint8_t ip_ttl; /* (u) */ + uint8_t protocol; + uint16_t check; + uint32_t saddr; + uint32_t daddr; +}; + +static __inline struct iphdr * +ip_hdr(struct sk_buff *skb) +{ + + return (struct iphdr *)skb_network_header(skb); +} + +static __inline void +ip_send_check(struct iphdr *iph) +{ + + /* Clear the checksum before computing! */ + iph->check = 0; + /* An IPv4 header is the same everywhere even if names differ. */ + iph->check = in_cksum_hdr((const void *)iph); +} + +#endif /* __LKPI_LINUX_IP_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/tcp.h b/sys/compat/linuxkpi/common/include/linux/tcp.h new file mode 100644 index 000000000000..1197f38b7898 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/tcp.h @@ -0,0 +1,72 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_TCP_H +#define __LKPI_LINUX_TCP_H + +#include +#include + +/* (u) unconfirmed structure field names; using FreeBSD's meanwhile. */ +struct tcphdr { + uint16_t source; /* (u) */ + uint16_t dest; /* (u) */ + uint32_t th_seq; /* (u) */ + uint32_t th_ack; /* (u) */ +#if BYTE_ORDER == LITTLE_ENDIAN + uint8_t th_x2:4, doff:4; +#elif BYTE_ORDER == BIG_ENDIAN + uint8_t doff:4, th_x2:4; +#endif + uint8_t th_flags; /* (u) */ + uint16_t th_win; /* (u) */ + uint16_t check; + uint16_t th_urg; /* (u) */ +}; + +static __inline struct tcphdr * +tcp_hdr(struct sk_buff *skb) +{ + + return (struct tcphdr *)skb_transport_header(skb); +} + +static __inline uint32_t +tcp_hdrlen(struct sk_buff *skb) +{ + struct tcphdr *th; + + th = tcp_hdr(skb); + return (4 * th->doff); +} + +#endif /* __LKPI_LINUX_TCP_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/udp.h b/sys/compat/linuxkpi/common/include/linux/udp.h new file mode 100644 index 000000000000..259bdbfc1199 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/udp.h @@ -0,0 +1,54 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_UDP_H +#define __LKPI_LINUX_UDP_H + +#include +#include + +/* (u) unconfirmed structure field names. */ +struct udphdr { + uint16_t source; /* (u) */ + uint16_t dest; + uint16_t len; /* (u) */ + uint16_t check; +}; + +static __inline struct udphdr * +udp_hdr(struct sk_buff *skb) +{ + + return (struct udphdr *)skb_transport_header(skb); +} + +#endif /* __LKPI_LINUX_UDP_H */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:15: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 7AF4B651C37; Tue, 25 May 2021 18:15: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 4FqMgj47RJz3vLF; Tue, 25 May 2021 18:15: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 693CB224EB; Tue, 25 May 2021 18:15: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 14PIFCR7044082; Tue, 25 May 2021 18:15:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIFC51044081; Tue, 25 May 2021 18:15:12 GMT (envelope-from git) Date: Tue, 25 May 2021 18:15:12 GMT Message-Id: <202105251815.14PIFC51044081@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: 29923fea032a - main - LinuxKPI: add devcoredump.h 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: 29923fea032a6ac7c0defd74d0b23468b16fda93 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, 25 May 2021 18:15:14 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=29923fea032a6ac7c0defd74d0b23468b16fda93 commit 29923fea032a6ac7c0defd74d0b23468b16fda93 Author: Bjoern A. Zeeb AuthorDate: 2021-05-24 18:04:31 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-25 18:01:48 +0000 LinuxKPI: add devcoredump.h Add linux/devcoredump.h with stub implementation of dev_coredumpv() and dev_coredumpsg() which only free the passed in SG table as needed for iwlwifi. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30423 --- .../linuxkpi/common/include/linux/devcoredump.h | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/devcoredump.h b/sys/compat/linuxkpi/common/include/linux/devcoredump.h new file mode 100644 index 000000000000..4616fbb5a2ea --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/devcoredump.h @@ -0,0 +1,76 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_DEVCOREDUMP_H +#define __LKPI_LINUX_DEVCOREDUMP_H + +#include +#include +#include + +static inline void +_lkpi_dev_coredumpsg_free(struct scatterlist *table) +{ + struct scatterlist *iter; + struct page *p; + int i; + + iter = table; + for_each_sg(table, iter, sg_nents(table), i) { + p = sg_page(iter); + if (p) + __free_page(p); + } + + /* XXX what about chained tables? */ + kfree(table); +} + +static inline void +dev_coredumpv(struct device *dev __unused, void *data, size_t datalen __unused, + gfp_t gfp __unused) +{ + + /* UNIMPLEMENTED */ + vfree(data); +} + +static inline void +dev_coredumpsg(struct device *dev __unused, struct scatterlist *table, + size_t datalen __unused, gfp_t gfp __unused) +{ + + /* UNIMPLEMENTED */ + _lkpi_dev_coredumpsg_free(table); +} + +#endif /* __LKPI_LINUX_DEVCOREDUMP_H */ From owner-dev-commits-src-main@freebsd.org Tue May 25 18:58: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 B6E9A652D5E; Tue, 25 May 2021 18:58: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 4FqNf54RRrz4SqJ; Tue, 25 May 2021 18:58: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 80B8822ADC; Tue, 25 May 2021 18:58: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 14PIwrBO097521; Tue, 25 May 2021 18:58:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PIwrs6097520; Tue, 25 May 2021 18:58:53 GMT (envelope-from git) Date: Tue, 25 May 2021 18:58:53 GMT Message-Id: <202105251858.14PIwrs6097520@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: 323a4e2c4e28 - main - ipfilter: Fix ip_nat memory leak and use-after-free 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: 323a4e2c4e285e6f8eee8db3fe2cb7490a734da0 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, 25 May 2021 18:58:53 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=323a4e2c4e285e6f8eee8db3fe2cb7490a734da0 commit 323a4e2c4e285e6f8eee8db3fe2cb7490a734da0 Author: Cy Schubert AuthorDate: 2021-05-25 18:54:49 +0000 Commit: Cy Schubert CommitDate: 2021-05-25 18:58:14 +0000 ipfilter: Fix ip_nat memory leak and use-after-free Unfortunately the wrong elemet is freed, also resulting in use-after-free. PR: 255859 Submitted by: lylgood@foxmail.com Reported by: lylgood@foxmail.com MFC after: 3 days --- sys/contrib/ipfilter/netinet/ip_nat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 41e51880b3dd..0475a4386079 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -6245,7 +6245,7 @@ ipf_nat_rule_deref(softc, inp) if (n->in_tqehead[0] != NULL) { if (ipf_deletetimeoutqueue(n->in_tqehead[0]) == 0) { - ipf_freetimeoutqueue(softc, n->in_tqehead[1]); + ipf_freetimeoutqueue(softc, n->in_tqehead[0]); } } From owner-dev-commits-src-main@freebsd.org Tue May 25 21:25: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 CBF53654E9D; Tue, 25 May 2021 21:25: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 4FqRvS5RLwz4cCM; Tue, 25 May 2021 21:25: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 9EBBB24B35; Tue, 25 May 2021 21:25: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 14PLPexY095472; Tue, 25 May 2021 21:25:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PLPemW095471; Tue, 25 May 2021 21:25:40 GMT (envelope-from git) Date: Tue, 25 May 2021 21:25:40 GMT Message-Id: <202105252125.14PLPemW095471@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 724072ab1d58 - main - nfscl: Use hash lists to improve expected search performance for opens MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 724072ab1d588677a83a5a5011b5ad9ff5d56538 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, 25 May 2021 21:25:40 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=724072ab1d588677a83a5a5011b5ad9ff5d56538 commit 724072ab1d588677a83a5a5011b5ad9ff5d56538 Author: Rick Macklem AuthorDate: 2021-05-25 21:19:29 +0000 Commit: Rick Macklem CommitDate: 2021-05-25 21:19:29 +0000 nfscl: Use hash lists to improve expected search performance for opens A problem was reported via email, where a large (130000+) accumulation of NFSv4 opens on an NFSv4 mount caused significant lock contention on the mutex used to protect the client mount's open/lock state. Although the root cause for the accumulation of opens was not resolved, it is obvious that the NFSv4 client is not designed to handle 100000+ opens efficiently. When searching for an open, usually for a match by file handle, a linear search of all opens is done. Commit 3f7e14ad9345 added a hash table of lists hashed on file handle for the opens. This patch uses the hash lists for searching for a matching open based of file handle instead of an exhaustive linear search of all opens. This change appears to be performance neutral for a small number of opens, but should improve expected performance for a large number of opens. This patch also moves any found match to the front of the hash list, to try and maintain the hash lists in recently used ordering (least recently used at the end of the list). This commit should not affect the high level semantics of open handling. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 89 ++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 33 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index a8eace2ffd0b..63c70ebcfdf5 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -100,8 +100,9 @@ int nfscl_layouthighwater = NFSCLLAYOUTHIGHWATER; static int nfscl_delegcnt = 0; static int nfscl_layoutcnt = 0; -static int nfscl_getopen(struct nfsclownerhead *, u_int8_t *, int, u_int8_t *, - u_int8_t *, u_int32_t, struct nfscllockowner **, struct nfsclopen **); +static int nfscl_getopen(struct nfsclownerhead *, struct nfsclopenhash *, + u_int8_t *, int, u_int8_t *, u_int8_t *, u_int32_t, + struct nfscllockowner **, struct nfsclopen **); static bool nfscl_checkown(struct nfsclowner *, struct nfsclopen *, uint8_t *, uint8_t *, struct nfscllockowner **, struct nfsclopen **, struct nfsclopen **); @@ -509,8 +510,8 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, void **lckpp) { struct nfsclclient *clp; - struct nfsclowner *owp; struct nfsclopen *op = NULL, *top; + struct nfsclopenhash *oph; struct nfscllockowner *lp; struct nfscldeleg *dp; struct nfsnode *np; @@ -587,8 +588,8 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, else nfscl_filllockowner(p->td_proc, own, F_POSIX); lp = NULL; - error = nfscl_getopen(&clp->nfsc_owner, nfhp, fhlen, own, own, - mode, &lp, &op); + error = nfscl_getopen(NULL, clp->nfsc_openhash, nfhp, fhlen, + own, own, mode, &lp, &op); if (error == 0 && lp != NULL && fords == 0) { /* Don't return a lock stateid for a DS. */ stateidp->seqid = @@ -607,22 +608,22 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, /* If not found, just look for any OpenOwner that will work. */ top = NULL; done = false; - LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - if (op->nfso_fhlen == fhlen && - !NFSBCMP(op->nfso_fh, nfhp, fhlen)) { - if (top == NULL && (op->nfso_mode & - NFSV4OPEN_ACCESSWRITE) != 0 && - (mode & NFSV4OPEN_ACCESSREAD) != 0) - top = op; - if ((mode & op->nfso_mode) == mode) { - done = true; - break; - } + oph = NFSCLOPENHASH(clp, nfhp, fhlen); + LIST_FOREACH(op, oph, nfso_hash) { + if (op->nfso_fhlen == fhlen && + !NFSBCMP(op->nfso_fh, nfhp, fhlen)) { + if (top == NULL && (op->nfso_mode & + NFSV4OPEN_ACCESSWRITE) != 0 && + (mode & NFSV4OPEN_ACCESSREAD) != 0) + top = op; + if ((mode & op->nfso_mode) == mode) { + /* LRU order the hash list. */ + LIST_REMOVE(op, nfso_hash); + LIST_INSERT_HEAD(oph, op, nfso_hash); + done = true; + break; } } - if (done) - break; } if (!done) { NFSCL_DEBUG(2, "openmode top=%p\n", top); @@ -655,14 +656,17 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, * Search for a matching file, mode and, optionally, lockowner. */ static int -nfscl_getopen(struct nfsclownerhead *ohp, u_int8_t *nfhp, int fhlen, - u_int8_t *openown, u_int8_t *lockown, u_int32_t mode, - struct nfscllockowner **lpp, struct nfsclopen **opp) +nfscl_getopen(struct nfsclownerhead *ohp, struct nfsclopenhash *ohashp, + u_int8_t *nfhp, int fhlen, u_int8_t *openown, u_int8_t *lockown, + u_int32_t mode, struct nfscllockowner **lpp, struct nfsclopen **opp) { struct nfsclowner *owp; struct nfsclopen *op, *rop, *rop2; + struct nfsclopenhash *oph; bool keep_looping; + KASSERT(ohp == NULL || ohashp == NULL, ("nfscl_getopen: " + "only one of ohp and ohashp can be set")); if (lpp != NULL) *lpp = NULL; /* @@ -679,19 +683,38 @@ nfscl_getopen(struct nfsclownerhead *ohp, u_int8_t *nfhp, int fhlen, rop2 = NULL; keep_looping = true; /* Search the client list */ - LIST_FOREACH(owp, ohp, nfsow_list) { - /* and look for the correct open */ - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { + if (ohashp == NULL) { + /* Search the local opens on the delegation. */ + LIST_FOREACH(owp, ohp, nfsow_list) { + /* and look for the correct open */ + LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { + if (op->nfso_fhlen == fhlen && + !NFSBCMP(op->nfso_fh, nfhp, fhlen) + && (op->nfso_mode & mode) == mode) + keep_looping = nfscl_checkown(owp, op, openown, + lockown, lpp, &rop, &rop2); + if (!keep_looping) + break; + } + if (!keep_looping) + break; + } + } else { + /* Search for matching opens on the hash list. */ + oph = &ohashp[NFSCLOPENHASHFUNC(nfhp, fhlen)]; + LIST_FOREACH(op, oph, nfso_hash) { if (op->nfso_fhlen == fhlen && !NFSBCMP(op->nfso_fh, nfhp, fhlen) && (op->nfso_mode & mode) == mode) - keep_looping = nfscl_checkown(owp, op, openown, - lockown, lpp, &rop, &rop2); - if (!keep_looping) + keep_looping = nfscl_checkown(op->nfso_own, op, + openown, lockown, lpp, &rop, &rop2); + if (!keep_looping) { + /* LRU order the hash list. */ + LIST_REMOVE(op, nfso_hash); + LIST_INSERT_HEAD(oph, op, nfso_hash); break; + } } - if (!keep_looping) - break; } if (rop == NULL) rop = rop2; @@ -1090,10 +1113,10 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len, } if (dp != NULL) { /* Now, find an open and maybe a lockowner. */ - ret = nfscl_getopen(&dp->nfsdl_owner, np->n_fhp->nfh_fh, + ret = nfscl_getopen(&dp->nfsdl_owner, NULL, np->n_fhp->nfh_fh, np->n_fhp->nfh_len, openownp, ownp, mode, NULL, &op); if (ret) - ret = nfscl_getopen(&clp->nfsc_owner, + ret = nfscl_getopen(NULL, clp->nfsc_openhash, np->n_fhp->nfh_fh, np->n_fhp->nfh_len, openownp, ownp, mode, NULL, &op); if (!ret) { @@ -1110,7 +1133,7 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len, /* * Get the related Open and maybe lockowner. */ - error = nfscl_getopen(&clp->nfsc_owner, + error = nfscl_getopen(NULL, clp->nfsc_openhash, np->n_fhp->nfh_fh, np->n_fhp->nfh_len, openownp, ownp, mode, &lp, &op); if (!error) From owner-dev-commits-src-main@freebsd.org Tue May 25 21:51: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 E6DFB65570E; Tue, 25 May 2021 21:51:02 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FqSSk4XMJz4d0p; Tue, 25 May 2021 21:51:02 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621979460; bh=Ip0Xkrxu9dHhr6Y+vKojjy51e5GChU2pyeamr8J5LJM=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=ZyVSV/T5Nr+VFkr7gdj8sd1TWR9cCHJZ+/YLoybGtTBo9U3OiSaDeOHyYjDAn6WY6 yAmMG/QHjZ+WpHZSmsl+DBQ94L+7w2BhhjbiVi6JXIR6DfUwaRDaLrHTj39u4cQsgS RHwVDdxwBghsi0sAdW5eDcRm5vHoDJjW1HwJuSmg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([89.12.249.136]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mz9Z5-1lYmwB2kk7-00wDWH; Tue, 25 May 2021 23:51:00 +0200 Date: Tue, 25 May 2021 23:50:52 +0200 From: "Hartmann, O." To: "Bjoern A. Zeeb" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: d72cd275187c - main - Bump __FreeBSD_version to 1400015 for LinuxKPI changes. Message-ID: <20210525235052.68dcf83b@hermann.fritz.box> In-Reply-To: <202105251815.14PIFLEG044263@gitrepo.freebsd.org> References: <202105251815.14PIFLEG044263@gitrepo.freebsd.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/nS4I5wy1m+RQD96jO.NQPfH"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Provags-ID: V03:K1:zRjJN93xetKWbZiqX4tqb35lN6zYRY8z68EusPDS7upgMXR12ZP WwbcWDxbao1dDkIAdrr9r/Y/k7gNsFlks8tUrA5vOJ7te7VP7FKt1YyVIXHVkB9GQ5BUhxo Pp16iDfqo2HiPxBf6pvAzowc/syJfb7UL9198Ai6gqLfEz6lefufikLFrRDFU4N2RQZ59W7 kxUluCUsPsnsW3QQnlwgQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:zlFmY3VDTuI=:lyycN7C6haiJrRJQ5a60z6 QbCQIzcKt1xBNSSmAc3bv5UjRUS+ZKWcfc9vGIfnU6PlifuK7etwyGxduZlwqaulLYh57hWx4 cgDudaT9OkBzpjPo1w+Lhh8osS1z1z5x1nVPRVkNlD4ll8eaX2ASVMqf8Jc1KlM8rMVrfFxen LmYD0s6I72xFA52GX88ak93Lovt1SlZ2l74TBkvguNPefPSEyBbBqBhbxhvR3nP0cyOLReWkL 2r5TJgynXsWy163XZ42O6/L5ZFu1A3lmxurjEP1zDCzRhtaIIFwWwrudvEj226cpTchjLHSKd cJmnK+ewv5KXXfxS4yButsH/WnV+LqYYRMalbvVn1IxDoMlJ8z9a49bQyyF8hCGDVO80iLdGb 0Wvanz4gDg/+I+XxiQspBXCm5zt0rE2wA4fWg58Qriulg0umRcRid5wXKg6ZzEC11MM6rcuI7 wrLsHvprdiRZWwapvB4KRwpn+mfOgx37LSK5ECglKhdGNjnOgLkFeZfv0/71sW0hG13mBX2l/ pq/T8sA3Q0y5uWBRtElLYNbzuVDaTRblOn9qk5PXmsMibP3fr8AmZSFMgy4WEwyb0UECussDl VgoFPuhTrfvCSdfFlTLiVTHC8SPtWseVpwmvmjt5wc8OjHBRIYqvPO8AT37LXvmmkq3LkndYn JRfKamyYvU/HEKsoEgDEVwDvTEwFzT/VLMhtMzHKUyiwchRQlmjA/yLJqfTCWb1V76o/fwjQt pja2bTlQZSmlrPcOY/8pkWDKnJgsGIGincfK4FEVqmpWuQ+iyHKU22rVqfUdYuwZuXRUJjTpL KJpvLJ6Ddb4sacuoVeTTp+iLublITEPqmlwnkY5akhVbrK0eIktIX1zDrudL0HmRnx4C478Ya 4TMsXRXU3izWHvzJ/PC3LqpIRBIlkAa1/f5YLf7lo5kVOlQjnE6ttMN0pOkKLPDEaVM1sSLjY C6otHms5wQgNab6vtEEH8HHTofcApRotwhEQrsFytlarMSRjdKo0CU2t5o7E2L6NU1VnXkEGo rQ3sdDS4CsNP47HiNW4rhGX/RBxTrIm1J/TlGJA1I+z0eGkPyyr2qBVv3CwYsvtt27ia4/XeF BnlX6y4aYzujfN6nHdIONu5WDGLERz1tSVX44fklPI+45u8lmSXvIlyQjIym4hmvOqplG7WgA VAdrlLbV0+JcjJDHK7jwCW8A2o5fjg2H4FLfArI5ZKlTDiPwQsxA0FfniifW777I1TEZ5Hx1R V328SqUwhGSx51Qci X-Rspamd-Queue-Id: 4FqSSk4XMJz4d0p 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, 25 May 2021 21:51:03 -0000 --Sig_/nS4I5wy1m+RQD96jO.NQPfH Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 25 May 2021 18:15:21 GMT "Bjoern A. Zeeb" wrote: > The branch main has been updated by bz: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dd72cd275187c6399caf0ca4125= 292dc7e55fa478 >=20 > commit d72cd275187c6399caf0ca4125292dc7e55fa478 > Author: Bjoern A. Zeeb > AuthorDate: 2021-05-25 17:37:15 +0000 > Commit: Bjoern A. Zeeb > CommitDate: 2021-05-25 18:01:49 +0000 >=20 > Bump __FreeBSD_version to 1400015 for LinuxKPI changes. > =20 > Commits 17accc08ae15 and de102f870501 add new files to LinuxKPI > which break drm-kmod. In addition various other additions where > comitted. Bump __FreeBSD_version to 1400015 to be able to detect this. > =20 > Sponsored by: The FreeBSD Foundation > MFC after: 2 weeks > --- > UPDATING | 5 +++++ > sys/sys/param.h | 2 +- > 2 files changed, 6 insertions(+), 1 deletion(-) >=20 > diff --git a/UPDATING b/UPDATING > index 45f85647980b..f1ff8a8b64b1 100644 > --- a/UPDATING > +++ b/UPDATING > @@ -27,6 +27,11 @@ 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".) > =20 > +20210525: > + Commits 17accc08ae15 and de102f870501 add new files to LinuxKPI > + which break drm-kmod. In addition various other additions where > + comitted. Bump __FreeBSD_version to 1400015 to be able to detect this. > + > 20210513: > Commit ca179c4d74f2 changed the package in which the OpenSSL > libraries and utilities are packaged. > diff --git a/sys/sys/param.h b/sys/sys/param.h > index 81971777e87b..279164f2115b 100644 > --- a/sys/sys/param.h > +++ b/sys/sys/param.h > @@ -76,7 +76,7 @@ > * cannot include sys/param.h and should only be updated here. > */ > #undef __FreeBSD_version > -#define __FreeBSD_version 1400014 > +#define __FreeBSD_version 1400015 > =20 > /* > * __FreeBSD_kernel__ indicates that this system uses the kernel of Free= BSD, > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebs= d.org" After the latest source update of CURRENT, loading linux.ko and/or linux64.= ko via kldload fails and so does poudriere on our build server, see below. I have not figured out what change/commit trigered the error. [...] kldload: unexpected relocation type 10, symbol index 1633 link_elf_obj: symbol CPUID_STDEXT_SMAP undefined linker_load_file: /boot/kernel/linux.ko - unsupported file type kldload: unexpected relocation type 10, symbol index 1460 link_elf_obj: symbol CPUID_STDEXT_SMAP undefined linker_load_file: /boot/kernel/linux64.ko - unsupported file type --Sig_/nS4I5wy1m+RQD96jO.NQPfH Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCYK1xPAAKCRA4N1ZZPba5 R3hDAP9YZu3flhzXA8cmD/Ll+3M8AVl8av1qEBfF2YVRpccjFwEA7WiWM7JlKaeh vspGIXH4zxMVrq+dI5pIIZfw46Xr0QU= =vbOg -----END PGP SIGNATURE----- --Sig_/nS4I5wy1m+RQD96jO.NQPfH-- From owner-dev-commits-src-main@freebsd.org Tue May 25 21:54: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 9EB706551F6; Tue, 25 May 2021 21:54:33 +0000 (UTC) (envelope-from bz@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 4FqSXn3z3nz4dFs; Tue, 25 May 2021 21:54:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 5CB88266AB; Tue, 25 May 2021 21:54:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id C40D68D4A129; Tue, 25 May 2021 21:54:31 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 59F36E707DB; Tue, 25 May 2021 21:54:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 39pYWPDbBWUu; Tue, 25 May 2021 21:54:30 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 10382E707B7; Tue, 25 May 2021 21:54:29 +0000 (UTC) Date: Tue, 25 May 2021 21:54:29 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Hartmann, O." cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: d72cd275187c - main - Bump __FreeBSD_version to 1400015 for LinuxKPI changes. In-Reply-To: <20210525235052.68dcf83b@hermann.fritz.box> Message-ID: References: <202105251815.14PIFLEG044263@gitrepo.freebsd.org> <20210525235052.68dcf83b@hermann.fritz.box> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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, 25 May 2021 21:54:33 -0000 On Tue, 25 May 2021, Hartmann, O. wrote: > After the latest source update of CURRENT, loading linux.ko and/or linux64.ko via > kldload fails and so does poudriere on our build server, see below. > > I have not figured out what change/commit trigered the error. > > > [...] > kldload: unexpected relocation type 10, symbol index 1633 > link_elf_obj: symbol CPUID_STDEXT_SMAP undefined > linker_load_file: /boot/kernel/linux.ko - unsupported file type > kldload: unexpected relocation type 10, symbol index 1460 > link_elf_obj: symbol CPUID_STDEXT_SMAP undefined > linker_load_file: /boot/kernel/linux64.ko - unsupported file type That is related to commits around 91aae953cb807d6fb7a70782b323bf9beb60d7c9 etc. (linuxkpi != linuxolator). I was just going to write a separate email following up there for other reasons. /bz -- Bjoern A. Zeeb r15:7 From owner-dev-commits-src-main@freebsd.org Tue May 25 21:57: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 94B63655368; Tue, 25 May 2021 21:57:15 +0000 (UTC) (envelope-from bz@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 4FqSbv3dpNz4dQ4; Tue, 25 May 2021 21:57:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4B14F253F1; Tue, 25 May 2021 21:57:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 193208D4A129; Tue, 25 May 2021 21:57:13 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id E55DFE707DB; Tue, 25 May 2021 21:57:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id FG82KMRmgV59; Tue, 25 May 2021 21:57:11 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 5AF33E707B7; Tue, 25 May 2021 21:57:11 +0000 (UTC) Date: Tue, 25 May 2021 21:57:10 +0000 (UTC) From: "Bjoern A. Zeeb" To: Konstantin Belousov , markj@freebsd.org cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 91aae953cb80 - main - amd64: clear PSL.AC in the right frame In-Reply-To: <202105251520.14PFKpiA009553@gitrepo.freebsd.org> Message-ID: References: <202105251520.14PFKpiA009553@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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, 25 May 2021 21:57:15 -0000 On Tue, 25 May 2021, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=91aae953cb807d6fb7a70782b323bf9beb60d7c9 > > commit 91aae953cb807d6fb7a70782b323bf9beb60d7c9 > Author: Konstantin Belousov > AuthorDate: 2021-05-22 19:48:36 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-05-25 15:20:46 +0000 > > amd64: clear PSL.AC in the right frame > > If copyin family of routines fault, kernel does clear PSL.AC on the > fault entry, but the AC flag of the faulted frame is kept intact. Since > onfault handler is effectively jump, AC survives until syscall exit. > > Reported by: m00nbsd, via Sony > Reviewed by: markj > Sponsored by: The FreeBSD Foundation > admbugs: 975 I am getting this when trying to build LINT kernels on head/amd64: linking kernel ld: error: undefined symbol: CPUID_STDEXT_SMAP >>> referenced by linux32_support.o:(.text+0x6) and also people report that linux*.ko are no longer loading for similar reasons (as follow-up to my d72cd275187c6399caf0ca4125292dc7e55fa478 Bump __FreeBSD_version to 1400015 ..; see there). Can you please have a look? /bz -- Bjoern A. Zeeb r15:7 From owner-dev-commits-src-main@freebsd.org Tue May 25 22:24: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 97581655846; Tue, 25 May 2021 22:24: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 4FqTC53gzxz4fXS; Tue, 25 May 2021 22:24: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 669ED2575C; Tue, 25 May 2021 22:24: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 14PMOHjM076354; Tue, 25 May 2021 22:24:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PMOHCT076353; Tue, 25 May 2021 22:24:17 GMT (envelope-from git) Date: Tue, 25 May 2021 22:24:17 GMT Message-Id: <202105252224.14PMOHCT076353@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: a59f0285377a - main - amd64/linux*: add required header to get the constant value 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: a59f0285377aa3d61cccda64e9ade126ecb3d2d9 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, 25 May 2021 22:24:17 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a59f0285377aa3d61cccda64e9ade126ecb3d2d9 commit a59f0285377aa3d61cccda64e9ade126ecb3d2d9 Author: Konstantin Belousov AuthorDate: 2021-05-25 22:19:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-25 22:24:09 +0000 amd64/linux*: add required header to get the constant value Otherwise asm silently interpret it as the external global symbol. Reported by: bz Sponsored by: The FreeBSD Foundation Fixes: 91aae953cb80 --- sys/amd64/linux/linux_support.s | 1 + sys/amd64/linux32/linux32_support.s | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/amd64/linux/linux_support.s b/sys/amd64/linux/linux_support.s index bb1c218bdf89..79e361867f1d 100644 --- a/sys/amd64/linux/linux_support.s +++ b/sys/amd64/linux/linux_support.s @@ -30,6 +30,7 @@ #include "linux_assym.h" /* system definitions */ #include /* miscellaneous asm macros */ +#include #include "assym.inc" diff --git a/sys/amd64/linux32/linux32_support.s b/sys/amd64/linux32/linux32_support.s index 86f3d11b552b..2e2dbca4e24b 100644 --- a/sys/amd64/linux32/linux32_support.s +++ b/sys/amd64/linux32/linux32_support.s @@ -30,6 +30,7 @@ #include "linux32_assym.h" /* system definitions */ #include /* miscellaneous asm macros */ +#include #include "assym.inc" From owner-dev-commits-src-main@freebsd.org Tue May 25 23:18: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 4A331656692; Tue, 25 May 2021 23:18:48 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) (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 4FqVPz3zxYz4j6V; Tue, 25 May 2021 23:18:47 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x134.google.com with SMTP id j10so48557412lfb.12; Tue, 25 May 2021 16:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tYIo9yHWM6Oa6J+IOs0CYKP5BgpDxEAo/rH15hm+vfo=; b=o/qUVconodBqhpl3INHf/Hy0ImcBiFKXSLbq/8AxNavasRpGodw/YdWLPcux8gc7SR LpdzyBvKyVFS/yfr47pH+Fht6cElm+84M/0Xo/T+xMKeqFX+r+WLNHcFbRXgtx6pX0kb ovtOwIH3H4Ez8TZwnUUwW0m43xjWf2HvPkTbSTHzMwUHDlcWMx0lLWr+hdwhKFJypCdH rejD6HQcJDKLSqz5HUOErAJlNlG6Rvu0DmbDrBSlkCVF5SN6jBo37Bs2qkE/rLvaEXFd XbLPHmxRV3LyJRSQjGf3uCMmf6oK5DzR/atHxyYKES650R1iaeODvcxmcB02z5og64Pn ax0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tYIo9yHWM6Oa6J+IOs0CYKP5BgpDxEAo/rH15hm+vfo=; b=NTmLfh/OXLbBFQW2uYCq9Z09ZUA+W0mp+8+O8dmdwUz8mpYVjYO2BpDIXT11VA7luz T0CLwnXLplyVSu5l7gBEPzjO2m4Z2LUIlc/Ng8/OdOTEWFV7+y79F9QUjAqiLfvVUPjv 6bXdgcERquXHPku08yipR1LyJM6mU5ixEJw95Kg4kbAFPumzpN1F4hv5Ysi3CaCGKY3j WEdEUn3Xo/96Vadpkv++7cJmBBbYiTrkt9UpBjBTeNYLjzX8vDwfG6OfBHXJYjYVLDnQ 9U/mghunsY82iHKYe4kmG/qHb7uOeowDmx2VIh6F5nxpOhgLJmL0o2CjhJdIIkvTAPd8 pvcw== X-Gm-Message-State: AOAM531l7QUpNxGy0L/VGlNg6BrJyCdml8y/GwQ8GavAKRt4YRrOJRC/ gOum+ZRVzEFGopKgDUb87PUaWgUiVzNxSfAlz5qC5ktK X-Google-Smtp-Source: ABdhPJxQUgF1a9Os3y2MXdRVXHswsjri3D3vHK2XP/QcXaJpMwg4iZPWaTzxbrvTMqX1jQy0d/avW7pp2MovcLY29Hw= X-Received: by 2002:a05:6512:b0f:: with SMTP id w15mr38460lfu.118.1621984724970; Tue, 25 May 2021 16:18:44 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:9746:0:0:0:0:0 with HTTP; Tue, 25 May 2021 16:18:44 -0700 (PDT) In-Reply-To: References: <202105211604.14LG4EdR005067@gitrepo.freebsd.org> From: Mateusz Guzik Date: Wed, 26 May 2021 01:18:44 +0200 Message-ID: Subject: Re: git: 5b2a81f58dc7 - main - mmc: Add mmc-pwrseq driver To: Emmanuel Vadot Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4FqVPz3zxYz4j6V X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=o/qUVcon; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::134 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-2.03 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; 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]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::134:from]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.97)[0.967]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::134:from:127.0.2.255]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::134:from]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] 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, 25 May 2021 23:18:48 -0000 There is one more: _.arm.SOCFPGA On 5/23/21, Mateusz Guzik wrote: > This breaks tinderbox, for example buildkernel TARGET_ARCH=armv6 > KERNCONF=RPI-B MODULES_OVERRIDE="": > ld: error: undefined symbol: mmc_fdt_parse >>>> referenced by bcm2835_sdhci.c:320 >>>> (/usr/src/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c:320) >>>> bcm2835_sdhci.o:(bcm_sdhci_attach) > ld: error: undefined symbol: mmc_fdt_parse >>>> referenced by bcm2835_sdhci.c:320 >>>> (/usr/src/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c:320) >>>> bcm2835_sdhci.o:(bcm_sdhci_attach) > > > > On 5/21/21, Emmanuel Vadot wrote: >> The branch main has been updated by manu: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=5b2a81f58dc722ca76065536f07ba47efd98dc63 >> >> commit 5b2a81f58dc722ca76065536f07ba47efd98dc63 >> Author: Emmanuel Vadot >> AuthorDate: 2021-05-16 12:48:56 +0000 >> Commit: Emmanuel Vadot >> CommitDate: 2021-05-21 15:36:20 +0000 >> >> mmc: Add mmc-pwrseq driver >> >> This driver is used to power up sdio card or eMMC. >> It handle the reset-gpio, clocks and needed delays for >> powerup/powerdown. >> >> Sponsored by: Diablotin Systems >> Differential Revision: https://reviews.freebsd.org/D30288 >> --- >> sys/conf/files | 2 + >> sys/dev/mmc/mmc_pwrseq.c | 194 >> ++++++++++++++++++++++++++++++++++++++++++++ >> sys/dev/mmc/mmc_pwrseq_if.m | 38 +++++++++ >> 3 files changed, 234 insertions(+) >> >> diff --git a/sys/conf/files b/sys/conf/files >> index 22083169bfc7..70cdd9f68dc6 100644 >> --- a/sys/conf/files >> +++ b/sys/conf/files >> @@ -2476,6 +2476,8 @@ dev/mmc/mmcbr_if.m standard >> dev/mmc/mmcbus_if.m standard >> dev/mmc/mmcsd.c optional mmcsd !mmccam >> dev/mmc/mmc_fdt_helpers.c optional mmc fdt | mmccam fdt >> +dev/mmc/mmc_pwrseq.c optional mmc fdt | mmccam fdt >> +dev/mmc/mmc_pwrseq_if.m optional mmc fdt | mmccam fdt >> dev/mmcnull/mmcnull.c optional mmcnull >> dev/mpr/mpr.c optional mpr >> dev/mpr/mpr_config.c optional mpr >> diff --git a/sys/dev/mmc/mmc_pwrseq.c b/sys/dev/mmc/mmc_pwrseq.c >> new file mode 100644 >> index 000000000000..d4ccf814fe53 >> --- /dev/null >> +++ b/sys/dev/mmc/mmc_pwrseq.c >> @@ -0,0 +1,194 @@ >> +/* >> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD >> + * >> + * Copyright 2021 Emmanuel Vadot >> + * >> + * 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 >> + >> +#include >> +#include >> +#include >> + >> +#include >> + >> +#include "mmc_pwrseq_if.h" >> + >> +enum pwrseq_type { >> + PWRSEQ_SIMPLE = 1, >> + PWRSEQ_EMMC, >> +}; >> + >> +static struct ofw_compat_data compat_data[] = { >> + { "mmc-pwrseq-simple", PWRSEQ_SIMPLE }, >> + { "mmc-pwrseq-emmc", PWRSEQ_EMMC }, >> + { NULL, 0 } >> +}; >> + >> +struct mmc_pwrseq_softc { >> + enum pwrseq_type type; >> + clk_t ext_clock; >> + struct gpiobus_pin *reset_gpio; >> + >> + uint32_t post_power_on_delay_ms; >> + uint32_t power_off_delay_us; >> +}; >> + >> +static int >> +mmc_pwrseq_probe(device_t dev) >> +{ >> + enum pwrseq_type type; >> + >> + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) >> + return (ENXIO); >> + >> + type = (enum pwrseq_type)ofw_bus_search_compatible(dev, >> compat_data)->ocd_data; >> + switch (type) { >> + case PWRSEQ_SIMPLE: >> + device_set_desc(dev, "MMC Simple Power sequence"); >> + break; >> + case PWRSEQ_EMMC: >> + device_set_desc(dev, "MMC eMMC Power sequence"); >> + break; >> + } >> + return (BUS_PROBE_DEFAULT); >> +} >> + >> +static int >> +mmc_pwrseq_attach(device_t dev) >> +{ >> + struct mmc_pwrseq_softc *sc; >> + phandle_t node; >> + int rv; >> + >> + sc = device_get_softc(dev); >> + sc->type = (enum pwrseq_type)ofw_bus_search_compatible(dev, >> compat_data)->ocd_data; >> + node = ofw_bus_get_node(dev); >> + >> + if (sc->type == PWRSEQ_SIMPLE) { >> + if (OF_hasprop(node, "clocks")) { >> + rv = clk_get_by_ofw_name(dev, 0, "ext_clock", &sc->ext_clock); >> + if (rv != 0) { >> + device_printf(dev, >> + "Node have a clocks property but no clocks named >> \"ext_clock\"\n"); >> + return (ENXIO); >> + } >> + } >> + OF_getencprop(node, "post-power-on-delay-ms", >> &sc->post_power_on_delay_ms, sizeof(uint32_t)); >> + OF_getencprop(node, "power-off-delay-us", &sc->power_off_delay_us, >> sizeof(uint32_t)); >> + } >> + >> + if (OF_hasprop(node, "reset-gpios")) { >> + if (gpio_pin_get_by_ofw_property(dev, node, "reset-gpios", >> + &sc->reset_gpio) != 0) { >> + device_printf(dev, "Cannot get the reset-gpios\n"); >> + return (ENXIO); >> + } >> + gpio_pin_setflags(sc->reset_gpio, GPIO_PIN_OUTPUT); >> + gpio_pin_set_active(sc->reset_gpio, true); >> + } >> + >> + OF_device_register_xref(OF_xref_from_node(node), dev); >> + return (0); >> +} >> + >> +static int >> +mmc_pwrseq_detach(device_t dev) >> +{ >> + >> + return (EBUSY); >> +} >> + >> +static int >> +mmv_pwrseq_set_power(device_t dev, bool power_on) >> +{ >> + struct mmc_pwrseq_softc *sc; >> + int rv; >> + >> + sc = device_get_softc(dev); >> + >> + if (power_on) { >> + if (sc->ext_clock) { >> + rv = clk_enable(sc->ext_clock); >> + if (rv != 0) >> + return (rv); >> + } >> + >> + if (sc->reset_gpio) { >> + rv = gpio_pin_set_active(sc->reset_gpio, false); >> + if (rv != 0) >> + return (rv); >> + } >> + >> + if (sc->post_power_on_delay_ms) >> + DELAY(sc->post_power_on_delay_ms * 1000); >> + } else { >> + if (sc->reset_gpio) { >> + rv = gpio_pin_set_active(sc->reset_gpio, true); >> + if (rv != 0) >> + return (rv); >> + } >> + >> + if (sc->ext_clock) { >> + rv = clk_stop(sc->ext_clock); >> + if (rv != 0) >> + return (rv); >> + } >> + if (sc->power_off_delay_us) >> + DELAY(sc->power_off_delay_us); >> + } >> + >> + return (0); >> +} >> + >> +static device_method_t mmc_pwrseq_methods[] = { >> + /* Device interface */ >> + DEVMETHOD(device_probe, mmc_pwrseq_probe), >> + DEVMETHOD(device_attach, mmc_pwrseq_attach), >> + DEVMETHOD(device_detach, mmc_pwrseq_detach), >> + >> + DEVMETHOD(mmc_pwrseq_set_power, mmv_pwrseq_set_power), >> + DEVMETHOD_END >> +}; >> + >> +static driver_t mmc_pwrseq_driver = { >> + "mmc_pwrseq", >> + mmc_pwrseq_methods, >> + sizeof(struct mmc_pwrseq_softc), >> +}; >> + >> +static devclass_t mmc_pwrseq_devclass; >> + >> +EARLY_DRIVER_MODULE(mmc_pwrseq, simplebus, mmc_pwrseq_driver, >> mmc_pwrseq_devclass, 0, 0, >> + BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_FIRST); >> +MODULE_VERSION(mmc_pwrseq, 1); >> +SIMPLEBUS_PNP_INFO(compat_data); >> diff --git a/sys/dev/mmc/mmc_pwrseq_if.m b/sys/dev/mmc/mmc_pwrseq_if.m >> new file mode 100644 >> index 000000000000..e94b44052c20 >> --- /dev/null >> +++ b/sys/dev/mmc/mmc_pwrseq_if.m >> @@ -0,0 +1,38 @@ >> +#- >> +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD >> +# >> +# Copyright (c) 2021 Emmanuel Vadot >> +# >> +# 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. >> +# >> +# $FreeBSD$ >> +# >> + >> +INTERFACE mmc_pwrseq; >> + >> +# >> +# Power up/down the card >> +# >> +METHOD int set_power { >> + device_t bus; >> + bool power_on; >> +}; >> > > > -- > Mateusz Guzik > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 1B06C656F25; Tue, 25 May 2021 23:59: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 4FqWK305tGz4qfm; Tue, 25 May 2021 23:59: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 DBEA3263D1; Tue, 25 May 2021 23:59: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 14PNxYCa094862; Tue, 25 May 2021 23:59:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxYlQ094860; Tue, 25 May 2021 23:59:34 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:34 GMT Message-Id: <202105252359.14PNxYlQ094860@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: 3c7a01d773ac - main - Extend m_apply() to support unmapped mbufs. 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: 3c7a01d773ac2d128eabb596eed7098f76966cc5 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, 25 May 2021 23:59:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3c7a01d773ac2d128eabb596eed7098f76966cc5 commit 3c7a01d773ac2d128eabb596eed7098f76966cc5 Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:18 +0000 Extend m_apply() to support unmapped mbufs. m_apply() invokes the callback function separately on each segment of an unmapped mbuf: the TLS header, individual pages, and the TLS trailer. Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30132 --- sys/kern/uipc_mbuf.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index f7852bc7dd7f..e5de2286d8f3 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1239,6 +1239,62 @@ m_append(struct mbuf *m0, int len, c_caddr_t cp) return (remainder == 0); } +static int +m_apply_extpg_one(struct mbuf *m, int off, int len, + int (*f)(void *, void *, u_int), void *arg) +{ + void *p; + u_int i, count, pgoff, pglen; + int rval; + + KASSERT(PMAP_HAS_DMAP, + ("m_apply_extpg_one does not support unmapped mbufs")); + off += mtod(m, vm_offset_t); + if (off < m->m_epg_hdrlen) { + count = min(m->m_epg_hdrlen - off, len); + rval = f(arg, m->m_epg_hdr + off, count); + if (rval) + return (rval); + len -= count; + off = 0; + } else + off -= m->m_epg_hdrlen; + pgoff = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs && len > 0; i++) { + pglen = m_epg_pagelen(m, i, pgoff); + if (off < pglen) { + count = min(pglen - off, len); + p = (void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff); + rval = f(arg, p, count); + if (rval) + return (rval); + len -= count; + off = 0; + } else + off -= pglen; + pgoff = 0; + } + if (len > 0) { + KASSERT(off < m->m_epg_trllen, + ("m_apply_extpg_one: offset beyond trailer")); + KASSERT(len <= m->m_epg_trllen - off, + ("m_apply_extpg_one: length beyond trailer")); + return (f(arg, m->m_epg_trail + off, len)); + } + return (0); +} + +/* Apply function f to the data in a single mbuf. */ +static int +m_apply_one(struct mbuf *m, int off, int len, + int (*f)(void *, void *, u_int), void *arg) +{ + if ((m->m_flags & M_EXTPG) != 0) + return (m_apply_extpg_one(m, off, len, f, arg)); + else + return (f(arg, mtod(m, caddr_t) + off, len)); +} + /* * Apply function f to the data in an mbuf chain starting "off" bytes from * the beginning, continuing for "len" bytes. @@ -1262,7 +1318,7 @@ m_apply(struct mbuf *m, int off, int len, while (len > 0) { KASSERT(m != NULL, ("m_apply, offset > size of mbuf chain")); count = min(m->m_len - off, len); - rval = (*f)(arg, mtod(m, caddr_t) + off, count); + rval = m_apply_one(m, off, count, f, arg); if (rval) return (rval); len -= count; From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 2A467656F26; Tue, 25 May 2021 23:59: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 4FqWK40byTz4qqs; Tue, 25 May 2021 23:59: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 F241826A4E; Tue, 25 May 2021 23:59: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 14PNxZVV094889; Tue, 25 May 2021 23:59:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxZ22094888; Tue, 25 May 2021 23:59:35 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:35 GMT Message-Id: <202105252359.14PNxZ22094888@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: 3f9dac85cc8f - main - Extend m_copyback() to support unmapped mbufs. 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: 3f9dac85cc8f2963026fdc2d5477acb607176a89 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, 25 May 2021 23:59:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3f9dac85cc8f2963026fdc2d5477acb607176a89 commit 3f9dac85cc8f2963026fdc2d5477acb607176a89 Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:18 +0000 Extend m_copyback() to support unmapped mbufs. Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30133 --- sys/kern/uipc_mbuf.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index e5de2286d8f3..6a1085720a85 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1139,6 +1139,29 @@ m_devget(char *buf, int totlen, int off, struct ifnet *ifp, return (top); } +static void +m_copytounmapped(const struct mbuf *m, int off, int len, c_caddr_t cp) +{ + struct iovec iov; + struct uio uio; + int error; + + KASSERT(off >= 0, ("m_copytounmapped: negative off %d", off)); + KASSERT(len >= 0, ("m_copytounmapped: negative len %d", len)); + KASSERT(off < m->m_len, ("m_copytounmapped: len exceeds mbuf length")); + iov.iov_base = __DECONST(caddr_t, cp); + iov.iov_len = len; + uio.uio_resid = len; + uio.uio_iov = &iov; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_iovcnt = 1; + uio.uio_offset = 0; + uio.uio_rw = UIO_WRITE; + error = m_unmappedtouio(m, off, &uio, len); + KASSERT(error == 0, ("m_unmappedtouio failed: off %d, len %d", off, + len)); +} + /* * Copy data from a buffer back into the indicated mbuf chain, * starting "off" bytes from the beginning, extending the mbuf @@ -1172,7 +1195,10 @@ m_copyback(struct mbuf *m0, int off, int len, c_caddr_t cp) M_TRAILINGSPACE(m)); } mlen = min (m->m_len - off, len); - bcopy(cp, off + mtod(m, caddr_t), (u_int)mlen); + if ((m->m_flags & M_EXTPG) != 0) + m_copytounmapped(m, off, mlen, cp); + else + bcopy(cp, off + mtod(m, caddr_t), (u_int)mlen); cp += mlen; len -= mlen; mlen += off; @@ -1870,7 +1896,7 @@ m_uiotombuf(struct uio *uio, int how, int len, int align, int flags) } /* - * Copy data from an unmapped mbuf into a uio limited by len if set. + * Copy data to/from an unmapped mbuf into a uio limited by len if set. */ int m_unmappedtouio(const struct mbuf *m, int m_off, struct uio *uio, int len) From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 7FE24656E8F; Tue, 25 May 2021 23:59: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 4FqWK525wTz4qxw; Tue, 25 May 2021 23:59: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 248F026949; Tue, 25 May 2021 23:59: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 14PNxb1I094910; Tue, 25 May 2021 23:59:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxaCY094909; Tue, 25 May 2021 23:59:36 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:36 GMT Message-Id: <202105252359.14PNxaCY094909@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: aa341db39b63 - main - Rename m_unmappedtouio() to m_unmapped_uiomove(). 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: aa341db39b6373c5e242f376a3cabe6a6b99141e 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, 25 May 2021 23:59:37 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=aa341db39b6373c5e242f376a3cabe6a6b99141e commit aa341db39b6373c5e242f376a3cabe6a6b99141e Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:18 +0000 Rename m_unmappedtouio() to m_unmapped_uiomove(). This function doesn't only copy data into a uio but instead is a variant of uiomove() similar to uiomove_fromphys(). Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30444 --- sys/kern/uipc_mbuf.c | 12 ++++++------ sys/kern/uipc_socket.c | 3 ++- sys/sys/mbuf.h | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 6a1085720a85..b9e716b411be 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -628,8 +628,8 @@ m_copyfromunmapped(const struct mbuf *m, int off, int len, caddr_t cp) uio.uio_iovcnt = 1; uio.uio_offset = 0; uio.uio_rw = UIO_READ; - error = m_unmappedtouio(m, off, &uio, len); - KASSERT(error == 0, ("m_unmappedtouio failed: off %d, len %d", off, + error = m_unmapped_uiomove(m, off, &uio, len); + KASSERT(error == 0, ("m_unmapped_uiomove failed: off %d, len %d", off, len)); } @@ -1157,8 +1157,8 @@ m_copytounmapped(const struct mbuf *m, int off, int len, c_caddr_t cp) uio.uio_iovcnt = 1; uio.uio_offset = 0; uio.uio_rw = UIO_WRITE; - error = m_unmappedtouio(m, off, &uio, len); - KASSERT(error == 0, ("m_unmappedtouio failed: off %d, len %d", off, + error = m_unmapped_uiomove(m, off, &uio, len); + KASSERT(error == 0, ("m_unmapped_uiomove failed: off %d, len %d", off, len)); } @@ -1899,7 +1899,7 @@ m_uiotombuf(struct uio *uio, int how, int len, int align, int flags) * Copy data to/from an unmapped mbuf into a uio limited by len if set. */ int -m_unmappedtouio(const struct mbuf *m, int m_off, struct uio *uio, int len) +m_unmapped_uiomove(const struct mbuf *m, int m_off, struct uio *uio, int len) { vm_page_t pg; int error, i, off, pglen, pgoff, seglen, segoff; @@ -1970,7 +1970,7 @@ m_mbuftouio(struct uio *uio, const struct mbuf *m, int len) length = min(m->m_len, total - progress); if ((m->m_flags & M_EXTPG) != 0) - error = m_unmappedtouio(m, 0, uio, length); + error = m_unmapped_uiomove(m, 0, uio, length); else error = uiomove(mtod(m, void *), length, uio); if (error) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 0ca87bfc522a..94d7782b5f0a 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2198,7 +2198,8 @@ dontblock: SBLASTMBUFCHK(&so->so_rcv); SOCKBUF_UNLOCK(&so->so_rcv); if ((m->m_flags & M_EXTPG) != 0) - error = m_unmappedtouio(m, moff, uio, (int)len); + error = m_unmapped_uiomove(m, moff, uio, + (int)len); else error = uiomove(mtod(m, char *) + moff, (int)len, uio); diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 729653fa1e55..e37b872c74fe 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -833,7 +833,6 @@ struct mbuf *m_getm2(struct mbuf *, int, int, short, int); struct mbuf *m_getptr(struct mbuf *, int, int *); u_int m_length(struct mbuf *, struct mbuf **); int m_mbuftouio(struct uio *, const struct mbuf *, int); -int m_unmappedtouio(const struct mbuf *, int, struct uio *, int); void m_move_pkthdr(struct mbuf *, struct mbuf *); int m_pkthdr_init(struct mbuf *, int); struct mbuf *m_prepend(struct mbuf *, int, int); @@ -843,6 +842,8 @@ struct mbuf *m_pullup(struct mbuf *, int); int m_sanity(struct mbuf *, int); struct mbuf *m_split(struct mbuf *, int, int); struct mbuf *m_uiotombuf(struct uio *, int, int, int, int); +int m_unmapped_uiomove(const struct mbuf *, int, struct uio *, + int); struct mbuf *m_unshare(struct mbuf *, int); int m_snd_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 CDB9D656866; Tue, 25 May 2021 23:59: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 4FqWK62b7Yz4qpH; Tue, 25 May 2021 23:59: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 3E18426C06; Tue, 25 May 2021 23:59: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 14PNxckF094931; Tue, 25 May 2021 23:59:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxcv7094930; Tue, 25 May 2021 23:59:38 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:38 GMT Message-Id: <202105252359.14PNxcv7094930@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: 1c8f4b3c9f9e - main - Support unmapped mbufs in crypto buffers. 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: 1c8f4b3c9f9e8ca5823d153d3b117246b3d18db4 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, 25 May 2021 23:59:38 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1c8f4b3c9f9e8ca5823d153d3b117246b3d18db4 commit 1c8f4b3c9f9e8ca5823d153d3b117246b3d18db4 Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:18 +0000 Support unmapped mbufs in crypto buffers. Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30134 --- sys/opencrypto/criov.c | 121 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 111 insertions(+), 10 deletions(-) diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c index b18a01faf26a..bf7965032084 100644 --- a/sys/opencrypto/criov.c +++ b/sys/opencrypto/criov.c @@ -239,6 +239,99 @@ cvm_page_copydata(vm_page_t *pages, int off, int len, caddr_t cp) } #endif /* CRYPTO_MAY_HAVE_VMPAGE */ +/* + * Given a starting page in an m_epg, determine the length of the + * current physically contiguous segment. + */ +static __inline size_t +m_epg_pages_extent(struct mbuf *m, int idx, u_int pglen) +{ + size_t len; + u_int i; + + len = pglen; + for (i = idx + 1; i < m->m_epg_npgs; i++) { + if (m->m_epg_pa[i - 1] + PAGE_SIZE != m->m_epg_pa[i]) + break; + len += m_epg_pagelen(m, i, 0); + } + return (len); +} + +static __inline void * +m_epg_segbase(struct mbuf *m, size_t offset) +{ + u_int i, pglen, pgoff; + + offset += mtod(m, vm_offset_t); + if (offset < m->m_epg_hdrlen) + return (m->m_epg_hdr + offset); + offset -= m->m_epg_hdrlen; + pgoff = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs; i++) { + pglen = m_epg_pagelen(m, i, pgoff); + if (offset < pglen) + return ((void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff + + offset)); + offset -= pglen; + pgoff = 0; + } + KASSERT(offset <= m->m_epg_trllen, ("%s: offset beyond trailer", + __func__)); + return (m->m_epg_trail + offset); +} + +static __inline size_t +m_epg_seglen(struct mbuf *m, size_t offset) +{ + u_int i, pglen, pgoff; + + offset += mtod(m, vm_offset_t); + if (offset < m->m_epg_hdrlen) + return (m->m_epg_hdrlen - offset); + offset -= m->m_epg_hdrlen; + pgoff = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs; i++) { + pglen = m_epg_pagelen(m, i, pgoff); + if (offset < pglen) + return (m_epg_pages_extent(m, i, pglen) - offset); + offset -= pglen; + pgoff = 0; + } + KASSERT(offset <= m->m_epg_trllen, ("%s: offset beyond trailer", + __func__)); + return (m->m_epg_trllen - offset); +} + +static __inline void * +m_epg_contiguous_subsegment(struct mbuf *m, size_t skip, size_t len) +{ + u_int i, pglen, pgoff; + + skip += mtod(m, vm_offset_t); + if (skip < m->m_epg_hdrlen) { + if (len > m->m_epg_hdrlen - skip) + return (NULL); + return (m->m_epg_hdr + skip); + } + skip -= m->m_epg_hdrlen; + pgoff = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs; i++) { + pglen = m_epg_pagelen(m, i, pgoff); + if (skip < pglen) { + if (len > m_epg_pages_extent(m, i, pglen) - skip) + return (NULL); + return ((void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff + + skip)); + } + skip -= pglen; + pgoff = 0; + } + KASSERT(skip <= m->m_epg_trllen && len <= m->m_epg_trllen - skip, + ("%s: segment beyond trailer", __func__)); + return (m->m_epg_trail + skip); +} + void crypto_cursor_init(struct crypto_buffer_cursor *cc, const struct crypto_buffer *cb) @@ -345,8 +438,8 @@ crypto_cursor_segbase(struct crypto_buffer_cursor *cc) case CRYPTO_BUF_MBUF: if (cc->cc_mbuf == NULL) return (NULL); - KASSERT((cc->cc_mbuf->m_flags & M_EXTPG) == 0, - ("%s: not supported for unmapped mbufs", __func__)); + if (cc->cc_mbuf->m_flags & M_EXTPG) + return (m_epg_segbase(cc->cc_mbuf, cc->cc_offset)); return (mtod(cc->cc_mbuf, char *) + cc->cc_offset); case CRYPTO_BUF_VMPAGE: return ((char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( @@ -372,6 +465,8 @@ crypto_cursor_seglen(struct crypto_buffer_cursor *cc) case CRYPTO_BUF_MBUF: if (cc->cc_mbuf == NULL) return (0); + if (cc->cc_mbuf->m_flags & M_EXTPG) + return (m_epg_seglen(cc->cc_mbuf, cc->cc_offset)); return (cc->cc_mbuf->m_len - cc->cc_offset); case CRYPTO_BUF_UIO: return (cc->cc_iov->iov_len - cc->cc_offset); @@ -401,12 +496,14 @@ crypto_cursor_copyback(struct crypto_buffer_cursor *cc, int size, break; case CRYPTO_BUF_MBUF: for (;;) { - KASSERT((cc->cc_mbuf->m_flags & M_EXTPG) == 0, - ("%s: not supported for unmapped mbufs", __func__)); - dst = mtod(cc->cc_mbuf, char *) + cc->cc_offset; + /* + * This uses m_copyback() for individual + * mbufs so that cc_mbuf and cc_offset are + * updated. + */ remain = cc->cc_mbuf->m_len - cc->cc_offset; todo = MIN(remain, size); - memcpy(dst, src, todo); + m_copyback(cc->cc_mbuf, cc->cc_offset, todo, src); src += todo; if (todo < remain) { cc->cc_offset += todo; @@ -482,12 +579,14 @@ crypto_cursor_copydata(struct crypto_buffer_cursor *cc, int size, void *vdst) break; case CRYPTO_BUF_MBUF: for (;;) { - KASSERT((cc->cc_mbuf->m_flags & M_EXTPG) == 0, - ("%s: not supported for unmapped mbufs", __func__)); - src = mtod(cc->cc_mbuf, const char *) + cc->cc_offset; + /* + * This uses m_copydata() for individual + * mbufs so that cc_mbuf and cc_offset are + * updated. + */ remain = cc->cc_mbuf->m_len - cc->cc_offset; todo = MIN(remain, size); - memcpy(dst, src, todo); + m_copydata(cc->cc_mbuf, cc->cc_offset, todo, dst); dst += todo; if (todo < remain) { cc->cc_offset += todo; @@ -715,6 +814,8 @@ m_contiguous_subsegment(struct mbuf *m, size_t skip, size_t len) if (skip + len > m->m_len) return (NULL); + if (m->m_flags & M_EXTPG) + return (m_epg_contiguous_subsegment(m, skip, len)); return (mtod(m, char*) + skip); } From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 C807F656F32; Tue, 25 May 2021 23:59: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 4FqWK956QPz4qw5; Tue, 25 May 2021 23:59: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 960BB26C85; Tue, 25 May 2021 23:59: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 14PNxfRG095000; Tue, 25 May 2021 23:59:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxf7v094999; Tue, 25 May 2021 23:59:41 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:41 GMT Message-Id: <202105252359.14PNxf7v094999@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: 4a92afae7fcb - main - ktls_ocf: Fix a few places to not hardcode the GMAC hash 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: 4a92afae7fcbb0a8453712dfec5de086aaf5cba4 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, 25 May 2021 23:59:41 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4a92afae7fcbb0a8453712dfec5de086aaf5cba4 commit 4a92afae7fcbb0a8453712dfec5de086aaf5cba4 Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:18 +0000 ktls_ocf: Fix a few places to not hardcode the GMAC hash length. This is not a functional change as the Poly1305 hash is the same length as the GMAC hash length. Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30137 --- sys/opencrypto/ktls_ocf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 2f2249cd3bfe..31aaba119091 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -416,11 +416,11 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, /* Duplicate iovec and append vector for tag. */ memcpy(iov, tag_uio->uio_iov, outiovcnt * sizeof(struct iovec)); iov[outiovcnt].iov_base = trailer; - iov[outiovcnt].iov_len = AES_GMAC_HASH_LEN; + iov[outiovcnt].iov_len = tls->params.tls_tlen; tag_uio->uio_iov = iov; tag_uio->uio_iovcnt++; crp.crp_digest_start = tag_uio->uio_resid; - tag_uio->uio_resid += AES_GMAC_HASH_LEN; + tag_uio->uio_resid += tls->params.tls_tlen; crp.crp_op = CRYPTO_OP_ENCRYPT | CRYPTO_OP_COMPUTE_DIGEST; crp.crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE; @@ -505,7 +505,7 @@ ktls_ocf_tls12_aead_decrypt(struct ktls_session *tls, error = ktls_ocf_dispatch(os, &crp); crypto_destroyreq(&crp); - *trailer_len = AES_GMAC_HASH_LEN; + *trailer_len = tls->params.tls_tlen; return (error); } From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 8B53C656F8D; Tue, 25 May 2021 23:59: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 4FqWK73Ky9z4qrD; Tue, 25 May 2021 23:59: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 5A5C826C84; Tue, 25 May 2021 23:59: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 14PNxdM7094952; Tue, 25 May 2021 23:59:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxdLQ094951; Tue, 25 May 2021 23:59:39 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:39 GMT Message-Id: <202105252359.14PNxdLQ094951@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: 6663f8a23e7c - main - sglist: Add sglist_append_single_mbuf(). 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: 6663f8a23e7cb60d798c5ffbd9c716b62b204f2a 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, 25 May 2021 23:59:39 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6663f8a23e7cb60d798c5ffbd9c716b62b204f2a commit 6663f8a23e7cb60d798c5ffbd9c716b62b204f2a Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:18 +0000 sglist: Add sglist_append_single_mbuf(). This function appends the contents of a single mbuf to an sglist rather than an entire mbuf chain. Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30135 --- share/man/man9/Makefile | 1 + share/man/man9/sglist.9 | 12 +++++++++++- sys/kern/subr_sglist.c | 15 +++++++++++++++ sys/sys/sglist.h | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index da68da16ddf5..4699b1ef0afe 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1941,6 +1941,7 @@ MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_append_mbuf_epg.9 \ sglist.9 sglist_append_phys.9 \ sglist.9 sglist_append_sglist.9 \ + sglist.9 sglist_append_single_mbuf.9 \ sglist.9 sglist_append_uio.9 \ sglist.9 sglist_append_user.9 \ sglist.9 sglist_append_vmpages.9 \ diff --git a/share/man/man9/sglist.9 b/share/man/man9/sglist.9 index b1d781b84d63..408d23573489 100644 --- a/share/man/man9/sglist.9 +++ b/share/man/man9/sglist.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 24, 2020 +.Dd May 25, 2021 .Dt SGLIST 9 .Os .Sh NAME @@ -38,6 +38,7 @@ .Nm sglist_append_mbuf_epg, .Nm sglist_append_phys , .Nm sglist_append_sglist , +.Nm sglist_append_single_mbuf , .Nm sglist_append_uio , .Nm sglist_append_user , .Nm sglist_append_vmpages , @@ -74,6 +75,8 @@ .Ft int .Fn sglist_append_sglist "struct sglist *sg" "struct sglist *source" "size_t offset" "size_t len" .Ft int +.Fn sglist_append_single_mbuf "struct sglist *sg" "struct mbuf *m" +.Ft int .Fn sglist_append_uio "struct sglist *sg" "struct uio *uio" .Ft int .Fn sglist_append_user "struct sglist *sg" "void *buf" "size_t len" "struct thread *td" @@ -284,6 +287,13 @@ to the scatter/gather list .Fa sg . .Pp The +.Nm sglist_append_mbuf +function appends the physical address ranges described by a single mbuf +.Fa m +to the scatter/gather list +.Fa sg . +.Pp +The .Nm sglist_append_phys function appends a single physical address range to the scatter/gather list .Fa sg . diff --git a/sys/kern/subr_sglist.c b/sys/kern/subr_sglist.c index 71be45b4231d..7c520fda00f5 100644 --- a/sys/kern/subr_sglist.c +++ b/sys/kern/subr_sglist.c @@ -466,6 +466,21 @@ sglist_append_mbuf(struct sglist *sg, struct mbuf *m0) return (0); } +/* + * Append the segments that describe a single mbuf to a scatter/gather + * list. If there are insufficient segments, then this fails with + * EFBIG. + */ +int +sglist_append_single_mbuf(struct sglist *sg, struct mbuf *m) +{ + if ((m->m_flags & M_EXTPG) != 0) + return (sglist_append_mbuf_epg(sg, m, + mtod(m, vm_offset_t), m->m_len)); + else + return (sglist_append(sg, m->m_data, m->m_len)); +} + /* * Append the segments that describe a buffer spanning an array of VM * pages. The buffer begins at an offset of 'pgoff' in the first diff --git a/sys/sys/sglist.h b/sys/sys/sglist.h index 82a3ac6ed6ac..bf8aa482e3ce 100644 --- a/sys/sys/sglist.h +++ b/sys/sys/sglist.h @@ -94,6 +94,7 @@ int sglist_append_phys(struct sglist *sg, vm_paddr_t paddr, size_t len); int sglist_append_sglist(struct sglist *sg, struct sglist *source, size_t offset, size_t length); +int sglist_append_single_mbuf(struct sglist *sg, struct mbuf *m); int sglist_append_uio(struct sglist *sg, struct uio *uio); int sglist_append_user(struct sglist *sg, void *buf, size_t len, struct thread *td); From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 B2F9D656E16; Tue, 25 May 2021 23:59: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 4FqWK84Yy6z4qrM; Tue, 25 May 2021 23:59: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 83B3D2694A; Tue, 25 May 2021 23:59: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 14PNxewZ094973; Tue, 25 May 2021 23:59:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxegk094972; Tue, 25 May 2021 23:59:40 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:40 GMT Message-Id: <202105252359.14PNxegk094972@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: 883a0196b629 - main - crypto: Add a new type of crypto buffer for a single mbuf. 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: 883a0196b629a07e52562b4103cc0f6391083080 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, 25 May 2021 23:59:40 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=883a0196b629a07e52562b4103cc0f6391083080 commit 883a0196b629a07e52562b4103cc0f6391083080 Author: John Baldwin AuthorDate: 2021-05-25 23:59:18 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:18 +0000 crypto: Add a new type of crypto buffer for a single mbuf. This is intended for use in KTLS transmit where each TLS record is described by a single mbuf that is itself queued in the socket buffer. Using the existing CRYPTO_BUF_MBUF would result in bus_dmamap_load_crp() walking additional mbufs in the socket buffer that are not relevant, but generating a S/G list that potentially exceeds the limit of the tag (while also wasting CPU cycles). Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30136 --- share/man/man9/crypto_buffer.9 | 11 ++++++++--- sys/crypto/ccp/ccp.c | 3 +++ sys/dev/cxgbe/crypto/t4_crypto.c | 3 +++ sys/dev/sec/sec.c | 3 +++ sys/kern/subr_bus_dma.c | 25 +++++++++++++++++++++++++ sys/mips/nlm/dev/sec/nlmsec.c | 3 +++ sys/mips/nlm/dev/sec/nlmseclib.c | 3 +++ sys/opencrypto/criov.c | 21 +++++++++++++++++++++ sys/opencrypto/crypto.c | 2 ++ sys/opencrypto/cryptodev.h | 22 +++++++++++++++++++++- sys/opencrypto/cryptosoft.c | 1 + 11 files changed, 93 insertions(+), 4 deletions(-) diff --git a/share/man/man9/crypto_buffer.9 b/share/man/man9/crypto_buffer.9 index 333fc5ec449f..df6128650cd4 100644 --- a/share/man/man9/crypto_buffer.9 +++ b/share/man/man9/crypto_buffer.9 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 24, 2020 +.Dd May 25, 2021 .Dt CRYPTO_BUFFER 9 .Os .Sh NAME @@ -195,7 +195,10 @@ An array of bytes mapped into the kernel's address space. A scatter/gather list of kernel buffers as described in .Xr uio 9 . .It Dv CRYPTO_BUF_MBUF -A network memory buffer as described in +A chain of network memory buffers as described in +.Xr mbuf 9 . +.It Dv CRYPTO_BUF_SINGLE_MBUF +A single network memory buffer as described in .Xr mbuf 9 . .It Dv CRYPTO_BUF_VMPAGE A scatter/gather list of @@ -220,7 +223,9 @@ data buffer A pointer to a .Vt struct mbuf for -.Dv CRYPTO_BUF_MBUF . +.Dv CRYPTO_BUF_MBUF +and +.Dv CRYPTO_BUF_SINGLE_MBUF . .It Fa cb_uio A pointer to a .Vt struct uio diff --git a/sys/crypto/ccp/ccp.c b/sys/crypto/ccp/ccp.c index 63967d7f8e3c..7cc38b14f3fd 100644 --- a/sys/crypto/ccp/ccp.c +++ b/sys/crypto/ccp/ccp.c @@ -101,6 +101,9 @@ ccp_populate_sglist(struct sglist *sg, struct crypto_buffer *cb) case CRYPTO_BUF_MBUF: error = sglist_append_mbuf(sg, cb->cb_mbuf); break; + case CRYPTO_BUF_SINGLE_MBUF: + error = sglist_append_single_mbuf(sg, cb->cb_mbuf); + break; case CRYPTO_BUF_UIO: error = sglist_append_uio(sg, cb->cb_uio); break; diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index cdd14fcee2f9..0fc806dc2eb8 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -271,6 +271,9 @@ ccr_populate_sglist(struct sglist *sg, struct crypto_buffer *cb) case CRYPTO_BUF_MBUF: error = sglist_append_mbuf(sg, cb->cb_mbuf); break; + case CRYPTO_BUF_SINGLE_MBUF: + error = sglist_append_single_mbuf(sg, cb->cb_mbuf); + break; case CRYPTO_BUF_UIO: error = sglist_append_uio(sg, cb->cb_uio); break; diff --git a/sys/dev/sec/sec.c b/sys/dev/sec/sec.c index fa3e20806124..f485d932727b 100644 --- a/sys/dev/sec/sec.c +++ b/sys/dev/sec/sec.c @@ -850,6 +850,9 @@ sec_desc_map_dma(struct sec_softc *sc, struct sec_dma_mem *dma_mem, case CRYPTO_BUF_MBUF: size = m_length(crp->crp_buf.cb_mbuf, NULL); break; + case CRYPTO_BUF_SINGLE_MBUF: + size = crp->crp_buf.cb_mbuf->m_len; + break; case CRYPTO_BUF_VMPAGE: size = PAGE_SIZE - crp->crp_buf.cb_vm_page_offset; break; diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c index 6248dd520511..a7ad30e77715 100644 --- a/sys/kern/subr_bus_dma.c +++ b/sys/kern/subr_bus_dma.c @@ -172,6 +172,27 @@ _bus_dmamap_load_mbuf_epg(bus_dma_tag_t dmat, bus_dmamap_t map, return (error); } +/* + * Load a single mbuf. + */ +static int +_bus_dmamap_load_single_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, + struct mbuf *m, bus_dma_segment_t *segs, int *nsegs, int flags) +{ + int error; + + error = 0; + if ((m->m_flags & M_EXTPG) != 0) + error = _bus_dmamap_load_mbuf_epg(dmat, map, m, segs, nsegs, + flags); + else + error = _bus_dmamap_load_buffer(dmat, map, m->m_data, m->m_len, + kernel_pmap, flags | BUS_DMA_LOAD_MBUF, segs, nsegs); + CTR5(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d nsegs %d", + __func__, dmat, flags, error, *nsegs); + return (error); +} + /* * Load an mbuf chain. */ @@ -658,6 +679,10 @@ bus_dmamap_load_crp_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, error = _bus_dmamap_load_mbuf_sg(dmat, map, cb->cb_mbuf, NULL, &nsegs, flags); break; + case CRYPTO_BUF_SINGLE_MBUF: + error = _bus_dmamap_load_single_mbuf(dmat, map, cb->cb_mbuf, + NULL, &nsegs, flags); + break; case CRYPTO_BUF_UIO: error = _bus_dmamap_load_uio(dmat, map, cb->cb_uio, &nsegs, flags); diff --git a/sys/mips/nlm/dev/sec/nlmsec.c b/sys/mips/nlm/dev/sec/nlmsec.c index 9318206a04fd..fb3e0b65b5a1 100644 --- a/sys/mips/nlm/dev/sec/nlmsec.c +++ b/sys/mips/nlm/dev/sec/nlmsec.c @@ -468,12 +468,15 @@ xlp_get_nsegs(struct cryptop *crp, unsigned int *nsegs) switch (crp->crp_buf.cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: { struct mbuf *m = NULL; m = crp->crp_buf.cb_mbuf; while (m != NULL) { *nsegs += NLM_CRYPTO_NUM_SEGS_REQD(m->m_len); + if (crp->crp_buf.cb_type == CRYPTO_BUF_SINGLE_MBUF) + break; m = m->m_next; } break; diff --git a/sys/mips/nlm/dev/sec/nlmseclib.c b/sys/mips/nlm/dev/sec/nlmseclib.c index bb154b5d3d79..6e5e715c28f8 100644 --- a/sys/mips/nlm/dev/sec/nlmseclib.c +++ b/sys/mips/nlm/dev/sec/nlmseclib.c @@ -112,6 +112,7 @@ nlm_crypto_form_srcdst_segs(struct xlp_sec_command *cmd, switch (crp->crp_buf.cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: { struct mbuf *m = NULL; @@ -123,6 +124,8 @@ nlm_crypto_form_srcdst_segs(struct xlp_sec_command *cmd, dstseg = nlm_crypto_fill_dst_seg(cmd->paramp, dstseg, mtod(m,caddr_t), m->m_len); } + if (crp->crp_buf.cb_type == CRYPTO_BUF_SINGLE_MBUF) + break; m = m->m_next; } break; diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c index bf7965032084..df053b314d41 100644 --- a/sys/opencrypto/criov.c +++ b/sys/opencrypto/criov.c @@ -344,6 +344,7 @@ crypto_cursor_init(struct crypto_buffer_cursor *cc, cc->cc_buf_len = cb->cb_buf_len; break; case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: cc->cc_mbuf = cb->cb_mbuf; break; case CRYPTO_BUF_VMPAGE: @@ -389,6 +390,10 @@ crypto_cursor_advance(struct crypto_buffer_cursor *cc, size_t amount) break; } break; + case CRYPTO_BUF_SINGLE_MBUF: + MPASS(cc->cc_mbuf->m_len >= cc->cc_offset + amount); + cc->cc_offset += amount; + break; case CRYPTO_BUF_VMPAGE: for (;;) { SDT_PROBE2(opencrypto, criov, cursor_advance, vmpage, @@ -436,6 +441,7 @@ crypto_cursor_segbase(struct crypto_buffer_cursor *cc) case CRYPTO_BUF_CONTIG: return (cc->cc_buf); case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: if (cc->cc_mbuf == NULL) return (NULL); if (cc->cc_mbuf->m_flags & M_EXTPG) @@ -463,6 +469,7 @@ crypto_cursor_seglen(struct crypto_buffer_cursor *cc) case CRYPTO_BUF_VMPAGE: return (PAGE_SIZE - cc->cc_offset); case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: if (cc->cc_mbuf == NULL) return (0); if (cc->cc_mbuf->m_flags & M_EXTPG) @@ -516,6 +523,11 @@ crypto_cursor_copyback(struct crypto_buffer_cursor *cc, int size, break; } break; + case CRYPTO_BUF_SINGLE_MBUF: + MPASS(cc->cc_mbuf->m_len >= cc->cc_offset + size); + m_copyback(cc->cc_mbuf, cc->cc_offset, size, src); + cc->cc_offset += size; + break; case CRYPTO_BUF_VMPAGE: for (;;) { dst = (char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( @@ -599,6 +611,11 @@ crypto_cursor_copydata(struct crypto_buffer_cursor *cc, int size, void *vdst) break; } break; + case CRYPTO_BUF_SINGLE_MBUF: + MPASS(cc->cc_mbuf->m_len >= cc->cc_offset + size); + m_copydata(cc->cc_mbuf, cc->cc_offset, size, dst); + cc->cc_offset += size; + break; case CRYPTO_BUF_VMPAGE: for (;;) { src = (char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( @@ -699,6 +716,7 @@ crypto_copyback(struct cryptop *crp, int off, int size, const void *src) cb = &crp->crp_buf; switch (cb->cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: m_copyback(cb->cb_mbuf, off, size, src); break; #if CRYPTO_MAY_HAVE_VMPAGE @@ -731,6 +749,7 @@ crypto_copydata(struct cryptop *crp, int off, int size, void *dst) switch (crp->crp_buf.cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: m_copydata(crp->crp_buf.cb_mbuf, off, size, dst); break; #if CRYPTO_MAY_HAVE_VMPAGE @@ -765,6 +784,7 @@ crypto_apply_buf(struct crypto_buffer *cb, int off, int len, switch (cb->cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: error = m_apply(cb->cb_mbuf, off, len, (int (*)(void *, void *, u_int))f, arg); break; @@ -843,6 +863,7 @@ crypto_buffer_contiguous_subsegment(struct crypto_buffer *cb, size_t skip, switch (cb->cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: return (m_contiguous_subsegment(cb->cb_mbuf, skip, len)); case CRYPTO_BUF_UIO: return (cuio_contiguous_segment(cb->cb_uio, skip, len)); diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index b56d0fb70698..b6c4441b4284 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -1155,6 +1155,8 @@ crypto_buffer_len(struct crypto_buffer *cb) if (cb->cb_mbuf->m_flags & M_PKTHDR) return (cb->cb_mbuf->m_pkthdr.len); return (m_length(cb->cb_mbuf, NULL)); + case CRYPTO_BUF_SINGLE_MBUF: + return (cb->cb_mbuf->m_len); case CRYPTO_BUF_VMPAGE: return (cb->cb_vm_page_len); case CRYPTO_BUF_UIO: diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 862ad1d4f6e5..1adc81f2e4d3 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -354,7 +354,8 @@ enum crypto_buffer_type { CRYPTO_BUF_UIO, CRYPTO_BUF_MBUF, CRYPTO_BUF_VMPAGE, - CRYPTO_BUF_LAST = CRYPTO_BUF_VMPAGE + CRYPTO_BUF_SINGLE_MBUF, + CRYPTO_BUF_LAST = CRYPTO_BUF_SINGLE_MBUF }; /* @@ -480,6 +481,13 @@ _crypto_use_mbuf(struct crypto_buffer *cb, struct mbuf *m) cb->cb_type = CRYPTO_BUF_MBUF; } +static __inline void +_crypto_use_single_mbuf(struct crypto_buffer *cb, struct mbuf *m) +{ + cb->cb_mbuf = m; + cb->cb_type = CRYPTO_BUF_SINGLE_MBUF; +} + static __inline void _crypto_use_vmpage(struct crypto_buffer *cb, vm_page_t *pages, int len, int offset) @@ -509,6 +517,12 @@ crypto_use_mbuf(struct cryptop *crp, struct mbuf *m) _crypto_use_mbuf(&crp->crp_buf, m); } +static __inline void +crypto_use_single_mbuf(struct cryptop *crp, struct mbuf *m) +{ + _crypto_use_single_mbuf(&crp->crp_buf, m); +} + static __inline void crypto_use_vmpage(struct cryptop *crp, vm_page_t *pages, int len, int offset) { @@ -533,6 +547,12 @@ crypto_use_output_mbuf(struct cryptop *crp, struct mbuf *m) _crypto_use_mbuf(&crp->crp_obuf, m); } +static __inline void +crypto_use_output_single_mbuf(struct cryptop *crp, struct mbuf *m) +{ + _crypto_use_single_mbuf(&crp->crp_obuf, m); +} + static __inline void crypto_use_output_vmpage(struct cryptop *crp, vm_page_t *pages, int len, int offset) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index a09f085a1eef..4040a014881e 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1105,6 +1105,7 @@ swcr_compdec(struct swcr_session *ses, struct cryptop *crp) if (result < crp->crp_payload_length) { switch (crp->crp_buf.cb_type) { case CRYPTO_BUF_MBUF: + case CRYPTO_BUF_SINGLE_MBUF: adj = result - crp->crp_payload_length; m_adj(crp->crp_buf.cb_mbuf, adj); break; From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 40F0A65693A; Tue, 25 May 2021 23:59: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 4FqWKF5bvhz4qyF; Tue, 25 May 2021 23:59: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 083F4268F7; Tue, 25 May 2021 23:59: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 14PNxiYj095063; Tue, 25 May 2021 23:59:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxi59095062; Tue, 25 May 2021 23:59:44 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:44 GMT Message-Id: <202105252359.14PNxi59095062@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: beb817edfe22 - main - crypto: Add crypto_cursor_segment() to fetch both base and 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: beb817edfe22cdea91e19a60c42caabd9404da48 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, 25 May 2021 23:59:46 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=beb817edfe22cdea91e19a60c42caabd9404da48 commit beb817edfe22cdea91e19a60c42caabd9404da48 Author: John Baldwin AuthorDate: 2021-05-25 23:59:19 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:19 +0000 crypto: Add crypto_cursor_segment() to fetch both base and length. This function combines crypto_cursor_segbase() and crypto_cursor_seglen() into a single function. This is mostly beneficial in the unmapped mbuf case where back to back calls of these two functions have to iterate over the sub-components of unmapped mbufs twice. Bump __FreeBSD_version for crypto drivers in ports. Suggested by: markj Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30445 --- share/man/man9/Makefile | 1 + share/man/man9/crypto_buffer.9 | 11 ++++- sys/opencrypto/criov.c | 109 ++++++++++++++--------------------------- sys/opencrypto/cryptodev.h | 1 + sys/sys/param.h | 2 +- 5 files changed, 50 insertions(+), 74 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 4699b1ef0afe..7077a286e97c 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -925,6 +925,7 @@ MLINKS+=crypto_buffer.9 crypto_apply.9 \ crypto_buffer.9 crypto_cursor_copydata_noadv.9 \ crypto_buffer.9 crypto_cursor_segbase.9 \ crypto_buffer.9 crypto_cursor_seglen.9 \ + crypto_buffer.9 crypto_cursor_segment.9 \ crypto_buffer.9 CRYPTO_HAS_OUTPUT_BUFFER.9 MLINKS+=crypto_driver.9 crypto_copyback.9 \ crypto_driver.9 crypto_copydata.9 \ diff --git a/share/man/man9/crypto_buffer.9 b/share/man/man9/crypto_buffer.9 index df6128650cd4..a16206e8e607 100644 --- a/share/man/man9/crypto_buffer.9 +++ b/share/man/man9/crypto_buffer.9 @@ -94,6 +94,8 @@ .Fa "void *dst" .Fc .Ft void * +.Fn crypto_cursor_segment "struct crypto_buffer_cursor *cc" "size_t *len" +.Ft void * .Fn crypto_cursor_segbase "struct crypto_buffer_cursor *cc" .Ft size_t .Fn crypto_cursor_seglen "struct crypto_buffer_cursor *cc" @@ -293,6 +295,12 @@ is similar to except that it does not change the current position of .Fa cc . .Pp +.Fn crypto_cursor_segment +returns the start of the virtually-contiguous segment at the current position of +.Fa cc . +The length of the segment is stored in +.Fa len . +.Pp .Fn crypto_cursor_segbase and .Fn crypto_cursor_seglen @@ -307,8 +315,9 @@ return the return value from the caller-supplied callback function. .Pp .Fn crypto_buffer_contiguous_subsegment , .Fn crypto_contiguous_subsegment , -and .Fn crypto_cursor_segbase , +and +.Fn crypto_cursor_segment return a pointer to a contiguous segment or .Dv NULL . .Pp diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c index df053b314d41..25702e3592fe 100644 --- a/sys/opencrypto/criov.c +++ b/sys/opencrypto/criov.c @@ -258,78 +258,44 @@ m_epg_pages_extent(struct mbuf *m, int idx, u_int pglen) return (len); } -static __inline void * -m_epg_segbase(struct mbuf *m, size_t offset) +static void * +m_epg_segment(struct mbuf *m, size_t offset, size_t *len) { u_int i, pglen, pgoff; offset += mtod(m, vm_offset_t); - if (offset < m->m_epg_hdrlen) + if (offset < m->m_epg_hdrlen) { + *len = m->m_epg_hdrlen - offset; return (m->m_epg_hdr + offset); + } offset -= m->m_epg_hdrlen; pgoff = m->m_epg_1st_off; for (i = 0; i < m->m_epg_npgs; i++) { pglen = m_epg_pagelen(m, i, pgoff); - if (offset < pglen) + if (offset < pglen) { + *len = m_epg_pages_extent(m, i, pglen) - offset; return ((void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff + offset)); + } offset -= pglen; pgoff = 0; } KASSERT(offset <= m->m_epg_trllen, ("%s: offset beyond trailer", __func__)); + *len = m->m_epg_trllen - offset; return (m->m_epg_trail + offset); } -static __inline size_t -m_epg_seglen(struct mbuf *m, size_t offset) -{ - u_int i, pglen, pgoff; - - offset += mtod(m, vm_offset_t); - if (offset < m->m_epg_hdrlen) - return (m->m_epg_hdrlen - offset); - offset -= m->m_epg_hdrlen; - pgoff = m->m_epg_1st_off; - for (i = 0; i < m->m_epg_npgs; i++) { - pglen = m_epg_pagelen(m, i, pgoff); - if (offset < pglen) - return (m_epg_pages_extent(m, i, pglen) - offset); - offset -= pglen; - pgoff = 0; - } - KASSERT(offset <= m->m_epg_trllen, ("%s: offset beyond trailer", - __func__)); - return (m->m_epg_trllen - offset); -} - static __inline void * m_epg_contiguous_subsegment(struct mbuf *m, size_t skip, size_t len) { - u_int i, pglen, pgoff; + void *base; + size_t seglen; - skip += mtod(m, vm_offset_t); - if (skip < m->m_epg_hdrlen) { - if (len > m->m_epg_hdrlen - skip) - return (NULL); - return (m->m_epg_hdr + skip); - } - skip -= m->m_epg_hdrlen; - pgoff = m->m_epg_1st_off; - for (i = 0; i < m->m_epg_npgs; i++) { - pglen = m_epg_pagelen(m, i, pgoff); - if (skip < pglen) { - if (len > m_epg_pages_extent(m, i, pglen) - skip) - return (NULL); - return ((void *)PHYS_TO_DMAP(m->m_epg_pa[i] + pgoff + - skip)); - } - skip -= pglen; - pgoff = 0; - } - KASSERT(skip <= m->m_epg_trllen && len <= m->m_epg_trllen - skip, - ("%s: segment beyond trailer", __func__)); - return (m->m_epg_trail + skip); + base = m_epg_segment(m, skip, &seglen); + if (len > seglen) + return (NULL); + return (base); } void @@ -435,54 +401,53 @@ crypto_cursor_advance(struct crypto_buffer_cursor *cc, size_t amount) } void * -crypto_cursor_segbase(struct crypto_buffer_cursor *cc) +crypto_cursor_segment(struct crypto_buffer_cursor *cc, size_t *len) { switch (cc->cc_type) { case CRYPTO_BUF_CONTIG: + *len = cc->cc_buf_len; return (cc->cc_buf); case CRYPTO_BUF_MBUF: case CRYPTO_BUF_SINGLE_MBUF: - if (cc->cc_mbuf == NULL) + if (cc->cc_mbuf == NULL) { + *len = 0; return (NULL); + } if (cc->cc_mbuf->m_flags & M_EXTPG) - return (m_epg_segbase(cc->cc_mbuf, cc->cc_offset)); + return (m_epg_segment(cc->cc_mbuf, cc->cc_offset, len)); + *len = cc->cc_mbuf->m_len - cc->cc_offset; return (mtod(cc->cc_mbuf, char *) + cc->cc_offset); case CRYPTO_BUF_VMPAGE: + *len = PAGE_SIZE - cc->cc_offset; return ((char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( *cc->cc_vmpage)) + cc->cc_offset); case CRYPTO_BUF_UIO: + *len = cc->cc_iov->iov_len - cc->cc_offset; return ((char *)cc->cc_iov->iov_base + cc->cc_offset); default: #ifdef INVARIANTS panic("%s: invalid buffer type %d", __func__, cc->cc_type); #endif + *len = 0; return (NULL); } } +void * +crypto_cursor_segbase(struct crypto_buffer_cursor *cc) +{ + size_t len; + + return (crypto_cursor_segment(cc, &len)); +} + size_t crypto_cursor_seglen(struct crypto_buffer_cursor *cc) { - switch (cc->cc_type) { - case CRYPTO_BUF_CONTIG: - return (cc->cc_buf_len); - case CRYPTO_BUF_VMPAGE: - return (PAGE_SIZE - cc->cc_offset); - case CRYPTO_BUF_MBUF: - case CRYPTO_BUF_SINGLE_MBUF: - if (cc->cc_mbuf == NULL) - return (0); - if (cc->cc_mbuf->m_flags & M_EXTPG) - return (m_epg_seglen(cc->cc_mbuf, cc->cc_offset)); - return (cc->cc_mbuf->m_len - cc->cc_offset); - case CRYPTO_BUF_UIO: - return (cc->cc_iov->iov_len - cc->cc_offset); - default: -#ifdef INVARIANTS - panic("%s: invalid buffer type %d", __func__, cc->cc_type); -#endif - return (0); - } + size_t len; + + crypto_cursor_segment(cc, &len); + return (len); } void diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 1adc81f2e4d3..fae8ca2787c2 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -661,6 +661,7 @@ size_t crypto_buffer_len(struct crypto_buffer *cb); void crypto_cursor_init(struct crypto_buffer_cursor *cc, const struct crypto_buffer *cb); void crypto_cursor_advance(struct crypto_buffer_cursor *cc, size_t amount); +void *crypto_cursor_segment(struct crypto_buffer_cursor *cc, size_t *len); void *crypto_cursor_segbase(struct crypto_buffer_cursor *cc); size_t crypto_cursor_seglen(struct crypto_buffer_cursor *cc); void crypto_cursor_copyback(struct crypto_buffer_cursor *cc, int size, diff --git a/sys/sys/param.h b/sys/sys/param.h index a19f9bf8b893..959f0b94ca70 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400016 +#define __FreeBSD_version 1400017 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 64368657007; Tue, 25 May 2021 23:59: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 4FqWKB6FN7z4qrZ; Tue, 25 May 2021 23:59: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 B7B3426C86; Tue, 25 May 2021 23:59: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 14PNxgMq095021; Tue, 25 May 2021 23:59:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxgK0095020; Tue, 25 May 2021 23:59:42 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:42 GMT Message-Id: <202105252359.14PNxgK0095020@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: 21e3c1fbe246 - main - Assume OCF is the only KTLS software backend. 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: 21e3c1fbe2460f144f6d4dfd61c3346b2de59667 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, 25 May 2021 23:59:43 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=21e3c1fbe2460f144f6d4dfd61c3346b2de59667 commit 21e3c1fbe2460f144f6d4dfd61c3346b2de59667 Author: John Baldwin AuthorDate: 2021-05-25 23:59:19 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:19 +0000 Assume OCF is the only KTLS software backend. This removes support for loadable software backends. The KTLS OCF support is now always included in kernels with KERN_TLS and the ktls_ocf.ko module has been removed. The software encryption routines now take an mbuf directly and use the TLS mbuf as the crypto buffer when possible. Bump __FreeBSD_version for software backends in ports. Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30138 --- sys/conf/files | 1 + sys/kern/uipc_ktls.c | 232 +++++++----------------------- sys/modules/Makefile | 2 - sys/modules/ktls_ocf/Makefile | 8 -- sys/opencrypto/ktls_ocf.c | 328 ++++++++++++++++-------------------------- sys/sys/ktls.h | 25 +--- sys/sys/param.h | 2 +- 7 files changed, 181 insertions(+), 417 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 9b67200b3c91..ab170244f9d0 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4932,6 +4932,7 @@ opencrypto/cryptosoft.c optional crypto | ipsec | ipsec_support opencrypto/cryptodeflate.c optional crypto | ipsec | ipsec_support opencrypto/gmac.c optional crypto | ipsec | ipsec_support opencrypto/gfmult.c optional crypto | ipsec | ipsec_support +opencrypto/ktls_ocf.c optional kern_tls opencrypto/rmd160.c optional crypto | ipsec | ipsec_support opencrypto/xform.c optional crypto | ipsec | ipsec_support opencrypto/xform_cbc_mac.c optional crypto diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 1fd1eca39b59..5ca677a26e2c 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -93,8 +93,6 @@ struct ktls_domain_info { struct ktls_domain_info ktls_domains[MAXMEMDOM]; static struct ktls_wq *ktls_wq; static struct proc *ktls_proc; -LIST_HEAD(, ktls_crypto_backend) ktls_backends; -static struct rmlock ktls_backends_lock; static uma_zone_t ktls_session_zone; static uma_zone_t ktls_buffer_zone; static uint16_t ktls_cpuid_lookup[MAXCPU]; @@ -104,10 +102,6 @@ SYSCTL_NODE(_kern_ipc, OID_AUTO, tls, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, stats, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Kernel TLS offload stats"); -static int ktls_allow_unload; -SYSCTL_INT(_kern_ipc_tls, OID_AUTO, allow_unload, CTLFLAG_RDTUN, - &ktls_allow_unload, 0, "Allow software crypto modules to unload"); - #ifdef RSS static int ktls_bind_threads = 1; #else @@ -270,76 +264,6 @@ static void ktls_reset_send_tag(void *context, int pending); #endif static void ktls_work_thread(void *ctx); -int -ktls_crypto_backend_register(struct ktls_crypto_backend *be) -{ - struct ktls_crypto_backend *curr_be, *tmp; - - if (be->api_version != KTLS_API_VERSION) { - printf("KTLS: API version mismatch (%d vs %d) for %s\n", - be->api_version, KTLS_API_VERSION, - be->name); - return (EINVAL); - } - - rm_wlock(&ktls_backends_lock); - printf("KTLS: Registering crypto method %s with prio %d\n", - be->name, be->prio); - if (LIST_EMPTY(&ktls_backends)) { - LIST_INSERT_HEAD(&ktls_backends, be, next); - } else { - LIST_FOREACH_SAFE(curr_be, &ktls_backends, next, tmp) { - if (curr_be->prio < be->prio) { - LIST_INSERT_BEFORE(curr_be, be, next); - break; - } - if (LIST_NEXT(curr_be, next) == NULL) { - LIST_INSERT_AFTER(curr_be, be, next); - break; - } - } - } - rm_wunlock(&ktls_backends_lock); - return (0); -} - -int -ktls_crypto_backend_deregister(struct ktls_crypto_backend *be) -{ - struct ktls_crypto_backend *tmp; - - /* - * Don't error if the backend isn't registered. This permits - * MOD_UNLOAD handlers to use this function unconditionally. - */ - rm_wlock(&ktls_backends_lock); - LIST_FOREACH(tmp, &ktls_backends, next) { - if (tmp == be) - break; - } - if (tmp == NULL) { - rm_wunlock(&ktls_backends_lock); - return (0); - } - - if (!ktls_allow_unload) { - rm_wunlock(&ktls_backends_lock); - printf( - "KTLS: Deregistering crypto method %s is not supported\n", - be->name); - return (EBUSY); - } - - if (be->use_count) { - rm_wunlock(&ktls_backends_lock); - return (EBUSY); - } - - LIST_REMOVE(be, next); - rm_wunlock(&ktls_backends_lock); - return (0); -} - #if defined(INET) || defined(INET6) static u_int ktls_get_cpu(struct socket *so) @@ -358,7 +282,7 @@ ktls_get_cpu(struct socket *so) #endif /* * Just use the flowid to shard connections in a repeatable - * fashion. Note that some crypto backends rely on the + * fashion. Note that TLS 1.0 sessions rely on the * serialization provided by having the same connection use * the same queue. */ @@ -426,9 +350,6 @@ ktls_init(void *dummy __unused) cpuset_t mask; int count, domain, error, i; - rm_init(&ktls_backends_lock, "ktls backends"); - LIST_INIT(&ktls_backends); - ktls_wq = malloc(sizeof(*ktls_wq) * (mp_maxid + 1), M_KTLS, M_WAITOK | M_ZERO); @@ -761,7 +682,6 @@ ktls_cleanup(struct ktls_session *tls) counter_u64_add(ktls_offload_active, -1); switch (tls->mode) { case TCP_TLS_MODE_SW: - MPASS(tls->be != NULL); switch (tls->params.cipher_algorithm) { case CRYPTO_AES_CBC: counter_u64_add(ktls_sw_cbc, -1); @@ -773,7 +693,7 @@ ktls_cleanup(struct ktls_session *tls) counter_u64_add(ktls_sw_chacha20, -1); break; } - tls->free(tls); + ktls_ocf_free(tls); break; case TCP_TLS_MODE_IFNET: switch (tls->params.cipher_algorithm) { @@ -996,33 +916,11 @@ ktls_try_ifnet(struct socket *so, struct ktls_session *tls, bool force) static int ktls_try_sw(struct socket *so, struct ktls_session *tls, int direction) { - struct rm_priotracker prio; - struct ktls_crypto_backend *be; + int error; - /* - * Choose the best software crypto backend. Backends are - * stored in sorted priority order (larget value == most - * important at the head of the list), so this just stops on - * the first backend that claims the session by returning - * success. - */ - if (ktls_allow_unload) - rm_rlock(&ktls_backends_lock, &prio); - LIST_FOREACH(be, &ktls_backends, next) { - if (be->try(so, tls, direction) == 0) - break; - KASSERT(tls->cipher == NULL, - ("ktls backend leaked a cipher pointer")); - } - if (be != NULL) { - if (ktls_allow_unload) - be->use_count++; - tls->be = be; - } - if (ktls_allow_unload) - rm_runlock(&ktls_backends_lock, &prio); - if (be == NULL) - return (EOPNOTSUPP); + error = ktls_ocf_try(so, tls, direction); + if (error) + return (error); tls->mode = TCP_TLS_MODE_SW; switch (tls->params.cipher_algorithm) { case CRYPTO_AES_CBC: @@ -1531,14 +1429,8 @@ ktls_modify_txrtlmt(struct ktls_session *tls, uint64_t max_pacing_rate) void ktls_destroy(struct ktls_session *tls) { - struct rm_priotracker prio; ktls_cleanup(tls); - if (tls->be != NULL && ktls_allow_unload) { - rm_rlock(&ktls_backends_lock, &prio); - tls->be->use_count--; - rm_runlock(&ktls_backends_lock, &prio); - } uma_zfree(ktls_session_zone, tls); } @@ -1621,7 +1513,7 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, int *enq_cnt, * * Compute the final trailer length assuming * at most one block of padding. - * tls->params.sb_tls_tlen is the maximum + * tls->params.tls_tlen is the maximum * possible trailer length (padding + digest). * delta holds the number of excess padding * bytes if the maximum were used. Those @@ -2096,12 +1988,10 @@ ktls_encrypt(struct ktls_wq *wq, struct mbuf *top) struct socket *so; struct mbuf *m; vm_paddr_t parray[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)]; - struct iovec src_iov[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)]; struct iovec dst_iov[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)]; vm_page_t pg; void *cbuf; int error, i, len, npages, off, total_pages; - bool is_anon; so = top->m_epg_so; tls = top->m_epg_tls; @@ -2146,75 +2036,45 @@ ktls_encrypt(struct ktls_wq *wq, struct mbuf *top) m->m_epg_npgs, ktls_maxlen)); /* - * Generate source and destination ivoecs to pass to - * the SW encryption backend. For writable mbufs, the - * destination iovec is a copy of the source and - * encryption is done in place. For file-backed mbufs - * (from sendfile), anonymous wired pages are - * allocated and assigned to the destination iovec. + * For anonymous mbufs, encryption is done in place. + * For file-backed mbufs (from sendfile), anonymous + * wired pages are allocated and used as the + * encryption destination. */ - is_anon = (m->m_epg_flags & EPG_FLAG_ANON) != 0; - - off = m->m_epg_1st_off; - for (i = 0; i < m->m_epg_npgs; i++, off = 0) { - len = m_epg_pagelen(m, i, off); - src_iov[i].iov_len = len; - src_iov[i].iov_base = - (char *)(void *)PHYS_TO_DMAP(m->m_epg_pa[i]) + off; - } - - if (is_anon) { - memcpy(dst_iov, src_iov, i * sizeof(struct iovec)); - } else if ((cbuf = ktls_buffer_alloc(wq, m)) != NULL) { - len = ptoa(m->m_epg_npgs - 1) + m->m_epg_last_len - - m->m_epg_1st_off; - dst_iov[0].iov_base = (char *)cbuf + m->m_epg_1st_off; - dst_iov[0].iov_len = len; - parray[0] = DMAP_TO_PHYS((vm_offset_t)cbuf); - i = 1; + if ((m->m_epg_flags & EPG_FLAG_ANON) != 0) { + error = (*tls->sw_encrypt)(tls, m, NULL, 0); } else { - cbuf = NULL; - off = m->m_epg_1st_off; - for (i = 0; i < m->m_epg_npgs; i++, off = 0) { - do { - pg = vm_page_alloc(NULL, 0, - VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | - VM_ALLOC_NODUMP | - VM_ALLOC_WIRED | - VM_ALLOC_WAITFAIL); - } while (pg == NULL); - - len = m_epg_pagelen(m, i, off); - parray[i] = VM_PAGE_TO_PHYS(pg); - dst_iov[i].iov_base = - (char *)(void *)PHYS_TO_DMAP( - parray[i]) + off; - dst_iov[i].iov_len = len; + if ((cbuf = ktls_buffer_alloc(wq, m)) != NULL) { + len = ptoa(m->m_epg_npgs - 1) + + m->m_epg_last_len - m->m_epg_1st_off; + dst_iov[0].iov_base = (char *)cbuf + + m->m_epg_1st_off; + dst_iov[0].iov_len = len; + parray[0] = DMAP_TO_PHYS((vm_offset_t)cbuf); + i = 1; + } else { + off = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs; i++, off = 0) { + do { + pg = vm_page_alloc(NULL, 0, + VM_ALLOC_NORMAL | + VM_ALLOC_NOOBJ | + VM_ALLOC_NODUMP | + VM_ALLOC_WIRED | + VM_ALLOC_WAITFAIL); + } while (pg == NULL); + + len = m_epg_pagelen(m, i, off); + parray[i] = VM_PAGE_TO_PHYS(pg); + dst_iov[i].iov_base = + (char *)(void *)PHYS_TO_DMAP( + parray[i]) + off; + dst_iov[i].iov_len = len; + } } - } - if (__predict_false(m->m_epg_npgs == 0)) { - /* TLS 1.0 empty fragment. */ - npages++; - } else - npages += m->m_epg_npgs; + error = (*tls->sw_encrypt)(tls, m, dst_iov, i); - error = (*tls->sw_encrypt)(tls, - (const struct tls_record_layer *)m->m_epg_hdr, - m->m_epg_trail, src_iov, dst_iov, m->m_epg_npgs, i, - m->m_epg_seqno, m->m_epg_record_type); - if (error) { - counter_u64_add(ktls_offload_failed_crypto, 1); - break; - } - - /* - * For file-backed mbufs, release the file-backed - * pages and replace them in the ext_pgs array with - * the anonymous wired pages allocated above. - */ - if (!is_anon) { /* Free the old pages. */ m->m_ext.ext_free(m); @@ -2236,6 +2096,16 @@ ktls_encrypt(struct ktls_wq *wq, struct mbuf *top) /* Pages are now writable. */ m->m_epg_flags |= EPG_FLAG_ANON; } + if (error) { + counter_u64_add(ktls_offload_failed_crypto, 1); + break; + } + + if (__predict_false(m->m_epg_npgs == 0)) { + /* TLS 1.0 empty fragment. */ + npages++; + } else + npages += m->m_epg_npgs; /* * Drop a reference to the session now that it is no diff --git a/sys/modules/Makefile b/sys/modules/Makefile index fb2481140345..01a182ea016d 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -206,7 +206,6 @@ SUBDIR= \ khelp \ krpc \ ksyms \ - ${_ktls_ocf} \ le \ lge \ libalias \ @@ -422,7 +421,6 @@ _crypto= crypto _cryptodev= cryptodev _random_fortuna=random_fortuna _random_other= random_other -_ktls_ocf= ktls_ocf .endif .endif diff --git a/sys/modules/ktls_ocf/Makefile b/sys/modules/ktls_ocf/Makefile deleted file mode 100644 index 01e6fe87177b..000000000000 --- a/sys/modules/ktls_ocf/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/opencrypto - -KMOD= ktls_ocf -SRCS= ktls_ocf.c - -.include diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 31aaba119091..1d83cd6f93dc 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -37,17 +37,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include +#include +#include +#include #include struct ocf_session { crypto_session_t sid; crypto_session_t mac_sid; - int mac_len; struct mtx lock; + int mac_len; bool implicit_iv; /* Only used for TLS 1.0 with the implicit IV. */ @@ -176,33 +180,35 @@ ktls_ocf_dispatch(struct ocf_session *os, struct cryptop *crp) } static int -ktls_ocf_tls_cbc_encrypt(struct ktls_session *tls, - const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov, - struct iovec *outiov, int iniovcnt, int outiovcnt, uint64_t seqno, - uint8_t record_type __unused) +ktls_ocf_tls_cbc_encrypt(struct ktls_session *tls, struct mbuf *m, + struct iovec *outiov, int outiovcnt) { - struct uio uio, out_uio; + const struct tls_record_layer *hdr; + struct uio uio; struct tls_mac_data ad; struct cryptop crp; struct ocf_session *os; - struct iovec iov[iniovcnt + 2]; - struct iovec out_iov[outiovcnt + 1]; + struct iovec iov[m->m_epg_npgs + 2]; + u_int pgoff; int i, error; uint16_t tls_comp_len; uint8_t pad; - bool inplace; + + MPASS(outiovcnt + 1 <= nitems(iov)); os = tls->cipher; + hdr = (const struct tls_record_layer *)m->m_epg_hdr; #ifdef INVARIANTS if (os->implicit_iv) { mtx_lock(&os->lock); KASSERT(!os->in_progress, ("concurrent implicit IV encryptions")); - if (os->next_seqno != seqno) { + if (os->next_seqno != m->m_epg_seqno) { printf("KTLS CBC: TLS records out of order. " "Expected %ju, got %ju\n", - (uintmax_t)os->next_seqno, (uintmax_t)seqno); + (uintmax_t)os->next_seqno, + (uintmax_t)m->m_epg_seqno); mtx_unlock(&os->lock); return (EINVAL); } @@ -211,24 +217,11 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_session *tls, } #endif - /* - * Compute the payload length. - * - * XXX: This could be easily computed O(1) from the mbuf - * fields, but we don't have those accessible here. Can - * at least compute inplace as well while we are here. - */ - tls_comp_len = 0; - inplace = iniovcnt == outiovcnt; - for (i = 0; i < iniovcnt; i++) { - tls_comp_len += iniov[i].iov_len; - if (inplace && - (i >= outiovcnt || iniov[i].iov_base != outiov[i].iov_base)) - inplace = false; - } + /* Payload length. */ + tls_comp_len = m->m_len - (m->m_epg_hdrlen + m->m_epg_trllen); /* Initialize the AAD. */ - ad.seq = htobe64(seqno); + ad.seq = htobe64(m->m_epg_seqno); ad.type = hdr->tls_type; ad.tls_vmajor = hdr->tls_vmajor; ad.tls_vminor = hdr->tls_vminor; @@ -237,11 +230,16 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_session *tls, /* First, compute the MAC. */ iov[0].iov_base = &ad; iov[0].iov_len = sizeof(ad); - memcpy(&iov[1], iniov, sizeof(*iniov) * iniovcnt); - iov[iniovcnt + 1].iov_base = trailer; - iov[iniovcnt + 1].iov_len = os->mac_len; + pgoff = m->m_epg_1st_off; + for (i = 0; i < m->m_epg_npgs; i++, pgoff = 0) { + iov[i + 1].iov_base = (void *)PHYS_TO_DMAP(m->m_epg_pa[i] + + pgoff); + iov[i + 1].iov_len = m_epg_pagelen(m, i, pgoff); + } + iov[m->m_epg_npgs + 1].iov_base = m->m_epg_trail; + iov[m->m_epg_npgs + 1].iov_len = os->mac_len; uio.uio_iov = iov; - uio.uio_iovcnt = iniovcnt + 2; + uio.uio_iovcnt = m->m_epg_npgs + 2; uio.uio_offset = 0; uio.uio_segflg = UIO_SYSSPACE; uio.uio_td = curthread; @@ -269,54 +267,47 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_session *tls, } /* Second, add the padding. */ - pad = (unsigned)(AES_BLOCK_LEN - (tls_comp_len + os->mac_len + 1)) % - AES_BLOCK_LEN; + pad = m->m_epg_trllen - os->mac_len - 1; for (i = 0; i < pad + 1; i++) - trailer[os->mac_len + i] = pad; + m->m_epg_trail[os->mac_len + i] = pad; /* Finally, encrypt the record. */ - - /* - * Don't recopy the input iovec, instead just adjust the - * trailer length and skip over the AAD vector in the uio. - */ - iov[iniovcnt + 1].iov_len += pad + 1; - uio.uio_iov = iov + 1; - uio.uio_iovcnt = iniovcnt + 1; - uio.uio_resid = tls_comp_len + iov[iniovcnt + 1].iov_len; - KASSERT(uio.uio_resid % AES_BLOCK_LEN == 0, - ("invalid encryption size")); - crypto_initreq(&crp, os->sid); - crp.crp_payload_start = 0; - crp.crp_payload_length = uio.uio_resid; + crp.crp_payload_start = m->m_epg_hdrlen; + crp.crp_payload_length = tls_comp_len + m->m_epg_trllen; + KASSERT(crp.crp_payload_length % AES_BLOCK_LEN == 0, + ("invalid encryption size")); + crypto_use_single_mbuf(&crp, m); crp.crp_op = CRYPTO_OP_ENCRYPT; crp.crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE; if (os->implicit_iv) memcpy(crp.crp_iv, os->iv, AES_BLOCK_LEN); else memcpy(crp.crp_iv, hdr + 1, AES_BLOCK_LEN); - crypto_use_uio(&crp, &uio); - if (!inplace) { - memcpy(out_iov, outiov, sizeof(*outiov) * outiovcnt); - out_iov[outiovcnt] = iov[iniovcnt + 1]; - out_uio.uio_iov = out_iov; - out_uio.uio_iovcnt = outiovcnt + 1; - out_uio.uio_offset = 0; - out_uio.uio_segflg = UIO_SYSSPACE; - out_uio.uio_td = curthread; - out_uio.uio_resid = uio.uio_resid; - crypto_use_output_uio(&crp, &out_uio); + + if (outiov != NULL) { + /* Duplicate iovec and append vector for trailer. */ + memcpy(iov, outiov, outiovcnt * sizeof(struct iovec)); + iov[outiovcnt].iov_base = m->m_epg_trail; + iov[outiovcnt].iov_len = m->m_epg_trllen; + + uio.uio_iov = iov; + uio.uio_iovcnt = outiovcnt + 1; + uio.uio_offset = 0; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_td = curthread; + uio.uio_resid = crp.crp_payload_length; + crypto_use_output_uio(&crp, &uio); } if (os->implicit_iv) counter_u64_add(ocf_tls10_cbc_crypts, 1); else counter_u64_add(ocf_tls11_cbc_crypts, 1); - if (inplace) - counter_u64_add(ocf_inplace, 1); - else + if (outiov != NULL) counter_u64_add(ocf_separate_output, 1); + else + counter_u64_add(ocf_inplace, 1); error = ktls_ocf_dispatch(os, &crp); crypto_destroyreq(&crp); @@ -324,11 +315,11 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_session *tls, if (os->implicit_iv) { KASSERT(os->mac_len + pad + 1 >= AES_BLOCK_LEN, ("trailer too short to read IV")); - memcpy(os->iv, trailer + os->mac_len + pad + 1 - AES_BLOCK_LEN, + memcpy(os->iv, m->m_epg_trail + m->m_epg_trllen - AES_BLOCK_LEN, AES_BLOCK_LEN); #ifdef INVARIANTS mtx_lock(&os->lock); - os->next_seqno = seqno + 1; + os->next_seqno = m->m_epg_seqno + 1; os->in_progress = false; mtx_unlock(&os->lock); #endif @@ -337,33 +328,20 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_session *tls, } static int -ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, - const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov, - struct iovec *outiov, int iniovcnt, int outiovcnt, uint64_t seqno, - uint8_t record_type __unused) +ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, struct mbuf *m, + struct iovec *outiov, int outiovcnt) { - struct uio uio, out_uio, *tag_uio; + const struct tls_record_layer *hdr; + struct uio uio; struct tls_aead_data ad; struct cryptop crp; struct ocf_session *os; struct iovec iov[outiovcnt + 1]; - int i, error; + int error; uint16_t tls_comp_len; - bool inplace; os = tls->cipher; - - uio.uio_iov = iniov; - uio.uio_iovcnt = iniovcnt; - uio.uio_offset = 0; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_td = curthread; - - out_uio.uio_iov = outiov; - out_uio.uio_iovcnt = outiovcnt; - out_uio.uio_offset = 0; - out_uio.uio_segflg = UIO_SYSSPACE; - out_uio.uio_td = curthread; + hdr = (const struct tls_record_layer *)m->m_epg_hdr; crypto_initreq(&crp, os->sid); @@ -379,16 +357,12 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, * 1.3. */ memcpy(crp.crp_iv, tls->params.iv, tls->params.iv_len); - *(uint64_t *)(crp.crp_iv + 4) ^= htobe64(seqno); + *(uint64_t *)(crp.crp_iv + 4) ^= htobe64(m->m_epg_seqno); } /* Setup the AAD. */ - if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) - tls_comp_len = ntohs(hdr->tls_length) - - (AES_GMAC_HASH_LEN + sizeof(uint64_t)); - else - tls_comp_len = ntohs(hdr->tls_length) - POLY1305_HASH_LEN; - ad.seq = htobe64(seqno); + tls_comp_len = m->m_len - (m->m_epg_hdrlen + m->m_epg_trllen); + ad.seq = htobe64(m->m_epg_seqno); ad.type = hdr->tls_type; ad.tls_vmajor = hdr->tls_vmajor; ad.tls_vminor = hdr->tls_vminor; @@ -396,46 +370,39 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, crp.crp_aad = &ad; crp.crp_aad_length = sizeof(ad); - /* Compute payload length and determine if encryption is in place. */ - inplace = iniovcnt == outiovcnt; - crp.crp_payload_start = 0; - for (i = 0; i < iniovcnt; i++) { - if (inplace && - (i >= outiovcnt || iniov[i].iov_base != outiov[i].iov_base)) - inplace = false; - crp.crp_payload_length += iniov[i].iov_len; - } - uio.uio_resid = crp.crp_payload_length; - out_uio.uio_resid = crp.crp_payload_length; - - if (inplace) - tag_uio = &uio; - else - tag_uio = &out_uio; + /* Set fields for input payload. */ + crypto_use_single_mbuf(&crp, m); + crp.crp_payload_start = m->m_epg_hdrlen; + crp.crp_payload_length = tls_comp_len; - /* Duplicate iovec and append vector for tag. */ - memcpy(iov, tag_uio->uio_iov, outiovcnt * sizeof(struct iovec)); - iov[outiovcnt].iov_base = trailer; - iov[outiovcnt].iov_len = tls->params.tls_tlen; - tag_uio->uio_iov = iov; - tag_uio->uio_iovcnt++; - crp.crp_digest_start = tag_uio->uio_resid; - tag_uio->uio_resid += tls->params.tls_tlen; + if (outiov != NULL) { + /* Duplicate iovec and append vector for tag. */ + memcpy(iov, outiov, outiovcnt * sizeof(struct iovec)); + iov[outiovcnt].iov_base = m->m_epg_trail; + iov[outiovcnt].iov_len = tls->params.tls_tlen; + crp.crp_digest_start = crp.crp_payload_length; + + uio.uio_iov = iov; + uio.uio_iovcnt = outiovcnt + 1; + uio.uio_offset = 0; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_td = curthread; + uio.uio_resid = crp.crp_payload_length + tls->params.tls_tlen; + crypto_use_output_uio(&crp, &uio); + } else + crp.crp_digest_start = crp.crp_payload_start + + crp.crp_payload_length; crp.crp_op = CRYPTO_OP_ENCRYPT | CRYPTO_OP_COMPUTE_DIGEST; crp.crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE; - crypto_use_uio(&crp, &uio); - if (!inplace) - crypto_use_output_uio(&crp, &out_uio); - if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) counter_u64_add(ocf_tls12_gcm_crypts, 1); else counter_u64_add(ocf_tls12_chacha20_crypts, 1); - if (inplace) - counter_u64_add(ocf_inplace, 1); - else + if (outiov != NULL) counter_u64_add(ocf_separate_output, 1); + else + counter_u64_add(ocf_inplace, 1); error = ktls_ocf_dispatch(os, &crp); crypto_destroyreq(&crp); @@ -510,27 +477,26 @@ ktls_ocf_tls12_aead_decrypt(struct ktls_session *tls, } static int -ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, - const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov, - struct iovec *outiov, int iniovcnt, int outiovcnt, uint64_t seqno, - uint8_t record_type) +ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, struct mbuf *m, + struct iovec *outiov, int outiovcnt) { - struct uio uio, out_uio; + const struct tls_record_layer *hdr; + struct uio uio; struct tls_aead_data_13 ad; char nonce[12]; struct cryptop crp; struct ocf_session *os; - struct iovec iov[iniovcnt + 1], out_iov[outiovcnt + 1]; - int i, error; - bool inplace; + struct iovec iov[outiovcnt + 1]; + int error; os = tls->cipher; + hdr = (const struct tls_record_layer *)m->m_epg_hdr; crypto_initreq(&crp, os->sid); /* Setup the nonce. */ memcpy(nonce, tls->params.iv, tls->params.iv_len); - *(uint64_t *)(nonce + 4) ^= htobe64(seqno); + *(uint64_t *)(nonce + 4) ^= htobe64(m->m_epg_seqno); /* Setup the AAD. */ ad.type = hdr->tls_type; @@ -540,51 +506,32 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, crp.crp_aad = &ad; crp.crp_aad_length = sizeof(ad); - /* Compute payload length and determine if encryption is in place. */ - inplace = iniovcnt == outiovcnt; - crp.crp_payload_start = 0; - for (i = 0; i < iniovcnt; i++) { - if (inplace && (i >= outiovcnt || - iniov[i].iov_base != outiov[i].iov_base)) - inplace = false; - crp.crp_payload_length += iniov[i].iov_len; - } + /* Set fields for input payload. */ + crypto_use_single_mbuf(&crp, m); + crp.crp_payload_start = m->m_epg_hdrlen; + crp.crp_payload_length = m->m_len - (m->m_epg_hdrlen + m->m_epg_trllen); /* Store the record type as the first byte of the trailer. */ - trailer[0] = record_type; + m->m_epg_trail[0] = m->m_epg_record_type; crp.crp_payload_length++; - crp.crp_digest_start = crp.crp_payload_length; - /* - * Duplicate the input iov to append the trailer. Always - * include the full trailer as input to get the record_type - * even if only the first byte is used. - */ - memcpy(iov, iniov, iniovcnt * sizeof(*iov)); - iov[iniovcnt].iov_base = trailer; - iov[iniovcnt].iov_len = tls->params.tls_tlen; - uio.uio_iov = iov; - uio.uio_iovcnt = iniovcnt + 1; - uio.uio_offset = 0; - uio.uio_resid = crp.crp_payload_length + tls->params.tls_tlen - 1; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_td = curthread; - crypto_use_uio(&crp, &uio); - - if (!inplace) { - /* Duplicate the output iov to append the trailer. */ - memcpy(out_iov, outiov, outiovcnt * sizeof(*out_iov)); - out_iov[outiovcnt] = iov[iniovcnt]; - - out_uio.uio_iov = out_iov; - out_uio.uio_iovcnt = outiovcnt + 1; - out_uio.uio_offset = 0; - out_uio.uio_resid = crp.crp_payload_length + - tls->params.tls_tlen - 1; - out_uio.uio_segflg = UIO_SYSSPACE; - out_uio.uio_td = curthread; - crypto_use_output_uio(&crp, &out_uio); - } + if (outiov != NULL) { + /* Duplicate iovec and append vector for tag. */ + memcpy(iov, outiov, outiovcnt * sizeof(struct iovec)); + iov[outiovcnt].iov_base = m->m_epg_trail; + iov[outiovcnt].iov_len = tls->params.tls_tlen; + crp.crp_digest_start = crp.crp_payload_length; + + uio.uio_iov = iov; + uio.uio_iovcnt = outiovcnt + 1; + uio.uio_offset = 0; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_td = curthread; + uio.uio_resid = m->m_len - m->m_epg_hdrlen; + crypto_use_output_uio(&crp, &uio); + } else + crp.crp_digest_start = crp.crp_payload_start + + crp.crp_payload_length; crp.crp_op = CRYPTO_OP_ENCRYPT | CRYPTO_OP_COMPUTE_DIGEST; crp.crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE; @@ -595,17 +542,17 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, counter_u64_add(ocf_tls13_gcm_crypts, 1); else counter_u64_add(ocf_tls13_chacha20_crypts, 1); - if (inplace) - counter_u64_add(ocf_inplace, 1); - else + if (outiov != NULL) counter_u64_add(ocf_separate_output, 1); + else + counter_u64_add(ocf_inplace, 1); error = ktls_ocf_dispatch(os, &crp); crypto_destroyreq(&crp); return (error); } -static void +void ktls_ocf_free(struct ktls_session *tls) { struct ocf_session *os; @@ -616,7 +563,7 @@ ktls_ocf_free(struct ktls_session *tls) zfree(os, M_KTLS_OCF); } -static int +int ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) { struct crypto_session_params csp, mac_csp; @@ -773,34 +720,5 @@ ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) memcpy(os->iv, tls->params.iv, AES_BLOCK_LEN); } } - tls->free = ktls_ocf_free; return (0); } - -struct ktls_crypto_backend ocf_backend = { - .name = "OCF", - .prio = 5, - .api_version = KTLS_API_VERSION, - .try = ktls_ocf_try, -}; - -static int -ktls_ocf_modevent(module_t mod, int what, void *arg) -{ - switch (what) { - case MOD_LOAD: - return (ktls_crypto_backend_register(&ocf_backend)); - case MOD_UNLOAD: - return (ktls_crypto_backend_deregister(&ocf_backend)); - default: - return (EOPNOTSUPP); - } -} - -static moduledata_t ktls_ocf_moduledata = { - "ktls_ocf", - ktls_ocf_modevent, - NULL -}; - -DECLARE_MODULE(ktls_ocf, ktls_ocf_moduledata, SI_SUB_PROTO_END, SI_ORDER_ANY); diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index bf1e66fab027..b28c94965c97 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -166,8 +166,6 @@ struct tls_session_params { #define KTLS_TX 1 #define KTLS_RX 2 -#define KTLS_API_VERSION 8 - struct iovec; struct ktls_session; struct m_snd_tag; @@ -175,21 +173,10 @@ struct mbuf; struct sockbuf; struct socket; -struct ktls_crypto_backend { - LIST_ENTRY(ktls_crypto_backend) next; - int (*try)(struct socket *so, struct ktls_session *tls, int direction); - int prio; - int api_version; - int use_count; - const char *name; -}; - struct ktls_session { union { - int (*sw_encrypt)(struct ktls_session *tls, - const struct tls_record_layer *hdr, uint8_t *trailer, - struct iovec *src, struct iovec *dst, int srciovcnt, - int dstiovcnt, uint64_t seqno, uint8_t record_type); + int (*sw_encrypt)(struct ktls_session *tls, struct mbuf *m, + struct iovec *dst, int iovcnt); int (*sw_decrypt)(struct ktls_session *tls, const struct tls_record_layer *hdr, struct mbuf *m, uint64_t seqno, int *trailer_len); @@ -198,26 +185,24 @@ struct ktls_session { void *cipher; struct m_snd_tag *snd_tag; }; - struct ktls_crypto_backend *be; - void (*free)(struct ktls_session *tls); struct tls_session_params params; u_int wq_index; volatile u_int refcount; int mode; *** 33 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 40454656E23; Tue, 25 May 2021 23:59: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 4FqWKD0Rtmz4qlP; Tue, 25 May 2021 23:59: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 D59392694B; Tue, 25 May 2021 23:59: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 14PNxhFM095042; Tue, 25 May 2021 23:59:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxhUl095041; Tue, 25 May 2021 23:59:43 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:43 GMT Message-Id: <202105252359.14PNxhUl095041@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: 6b313a3a6045 - main - Include the trailer in the original dst_iov. 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: 6b313a3a60453e87f0a224361dad6284550395de 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, 25 May 2021 23:59:44 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6b313a3a60453e87f0a224361dad6284550395de commit 6b313a3a60453e87f0a224361dad6284550395de Author: John Baldwin AuthorDate: 2021-05-25 23:59:19 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:19 +0000 Include the trailer in the original dst_iov. This avoids creating a duplicate copy on the stack just to append the trailer. Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30139 --- sys/kern/uipc_ktls.c | 12 +++++++++--- sys/opencrypto/ktls_ocf.c | 27 ++++++--------------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 5ca677a26e2c..b0d7ea8016dd 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1981,14 +1981,16 @@ ktls_enqueue(struct mbuf *m, struct socket *so, int page_count) counter_u64_add(ktls_cnt_tx_queued, 1); } +#define MAX_TLS_PAGES (1 + btoc(TLS_MAX_MSG_SIZE_V10_2)) + static __noinline void ktls_encrypt(struct ktls_wq *wq, struct mbuf *top) { struct ktls_session *tls; struct socket *so; struct mbuf *m; - vm_paddr_t parray[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)]; - struct iovec dst_iov[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)]; + vm_paddr_t parray[MAX_TLS_PAGES + 1]; + struct iovec dst_iov[MAX_TLS_PAGES + 2]; vm_page_t pg; void *cbuf; int error, i, len, npages, off, total_pages; @@ -2072,8 +2074,12 @@ ktls_encrypt(struct ktls_wq *wq, struct mbuf *top) dst_iov[i].iov_len = len; } } + KASSERT(i + 1 <= nitems(dst_iov), + ("dst_iov is too small")); + dst_iov[i].iov_base = m->m_epg_trail; + dst_iov[i].iov_len = m->m_epg_trllen; - error = (*tls->sw_encrypt)(tls, m, dst_iov, i); + error = (*tls->sw_encrypt)(tls, m, dst_iov, i + 1); /* Free the old pages. */ m->m_ext.ext_free(m); diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 1d83cd6f93dc..bbe26e3f5f18 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -286,13 +286,8 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_session *tls, struct mbuf *m, memcpy(crp.crp_iv, hdr + 1, AES_BLOCK_LEN); if (outiov != NULL) { - /* Duplicate iovec and append vector for trailer. */ - memcpy(iov, outiov, outiovcnt * sizeof(struct iovec)); - iov[outiovcnt].iov_base = m->m_epg_trail; - iov[outiovcnt].iov_len = m->m_epg_trllen; - - uio.uio_iov = iov; - uio.uio_iovcnt = outiovcnt + 1; + uio.uio_iov = outiov; + uio.uio_iovcnt = outiovcnt; uio.uio_offset = 0; uio.uio_segflg = UIO_SYSSPACE; uio.uio_td = curthread; @@ -336,7 +331,6 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, struct mbuf *m, struct tls_aead_data ad; struct cryptop crp; struct ocf_session *os; - struct iovec iov[outiovcnt + 1]; int error; uint16_t tls_comp_len; @@ -376,14 +370,10 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, struct mbuf *m, crp.crp_payload_length = tls_comp_len; if (outiov != NULL) { - /* Duplicate iovec and append vector for tag. */ - memcpy(iov, outiov, outiovcnt * sizeof(struct iovec)); - iov[outiovcnt].iov_base = m->m_epg_trail; - iov[outiovcnt].iov_len = tls->params.tls_tlen; crp.crp_digest_start = crp.crp_payload_length; - uio.uio_iov = iov; - uio.uio_iovcnt = outiovcnt + 1; + uio.uio_iov = outiov; + uio.uio_iovcnt = outiovcnt; uio.uio_offset = 0; uio.uio_segflg = UIO_SYSSPACE; uio.uio_td = curthread; @@ -486,7 +476,6 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, struct mbuf *m, char nonce[12]; struct cryptop crp; struct ocf_session *os; - struct iovec iov[outiovcnt + 1]; int error; os = tls->cipher; @@ -516,14 +505,10 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, struct mbuf *m, crp.crp_payload_length++; if (outiov != NULL) { - /* Duplicate iovec and append vector for tag. */ - memcpy(iov, outiov, outiovcnt * sizeof(struct iovec)); - iov[outiovcnt].iov_base = m->m_epg_trail; - iov[outiovcnt].iov_len = tls->params.tls_tlen; crp.crp_digest_start = crp.crp_payload_length; - uio.uio_iov = iov; - uio.uio_iovcnt = outiovcnt + 1; + uio.uio_iov = outiov; + uio.uio_iovcnt = outiovcnt; uio.uio_offset = 0; uio.uio_segflg = UIO_SYSSPACE; uio.uio_td = curthread; From owner-dev-commits-src-main@freebsd.org Tue May 25 23: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 192E4656E29; Tue, 25 May 2021 23: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 4FqWKH2bVjz4qlZ; Tue, 25 May 2021 23:59:46 +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 27B9E26C87; Tue, 25 May 2021 23:59:46 +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 14PNxkMQ095084; Tue, 25 May 2021 23:59:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxkh5095083; Tue, 25 May 2021 23:59:46 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:46 GMT Message-Id: <202105252359.14PNxkh5095083@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: 86be314d09bc - main - cryptosoft: Use crypto_cursor_segment(). 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: 86be314d09bc2857bb63d0a1e34945c63daa0008 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, 25 May 2021 23:59:49 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=86be314d09bc2857bb63d0a1e34945c63daa0008 commit 86be314d09bc2857bb63d0a1e34945c63daa0008 Author: John Baldwin AuthorDate: 2021-05-25 23:59:19 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:19 +0000 cryptosoft: Use crypto_cursor_segment(). Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30446 --- sys/opencrypto/cryptosoft.c | 107 +++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 61 deletions(-) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 4040a014881e..9e551ba9652b 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -105,7 +105,8 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) const struct crypto_session_params *csp; struct swcr_encdec *sw; struct enc_xform *exf; - int i, blks, inlen, ivlen, outlen, resid; + size_t inlen, outlen; + int i, blks, ivlen, resid; struct crypto_buffer_cursor cc_in, cc_out; const unsigned char *inblk; unsigned char *outblk; @@ -153,15 +154,13 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - inlen = crypto_cursor_seglen(&cc_in); - inblk = crypto_cursor_segbase(&cc_in); + inblk = crypto_cursor_segment(&cc_in, &inlen); if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { crypto_cursor_init(&cc_out, &crp->crp_obuf); crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - outlen = crypto_cursor_seglen(&cc_out); - outblk = crypto_cursor_segbase(&cc_out); + outblk = crypto_cursor_segment(&cc_out, &outlen); resid = crp->crp_payload_length; encrypting = CRYPTO_OP_IS_ENCRYPT(crp->crp_op); @@ -225,8 +224,7 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) } if (inlen < blks) { - inlen = crypto_cursor_seglen(&cc_in); - inblk = crypto_cursor_segbase(&cc_in); + inblk = crypto_cursor_segment(&cc_in, &inlen); } else { crypto_cursor_advance(&cc_in, blks); inlen -= blks; @@ -235,8 +233,7 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) if (outlen < blks) { crypto_cursor_copyback(&cc_out, blks, blk); - outlen = crypto_cursor_seglen(&cc_out); - outblk = crypto_cursor_segbase(&cc_out); + outblk = crypto_cursor_segment(&cc_out, &outlen); } else { crypto_cursor_advance(&cc_out, blks); outlen -= blks; @@ -256,17 +253,14 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) __func__, exf->name)); KASSERT(resid < blks, ("%s: partial block too big", __func__)); - inlen = crypto_cursor_seglen(&cc_in); - outlen = crypto_cursor_seglen(&cc_out); + inblk = crypto_cursor_segment(&cc_in, &inlen); + outblk = crypto_cursor_segment(&cc_out, &outlen); if (inlen < resid) { crypto_cursor_copydata(&cc_in, resid, blk); inblk = blk; - } else - inblk = crypto_cursor_segbase(&cc_in); + } if (outlen < resid) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); if (encrypting) exf->encrypt_last(sw->sw_kschedule, inblk, outblk, resid); @@ -397,7 +391,8 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *crp) struct swcr_auth *swa; struct auth_hash *axf; uint32_t *blkp; - int blksz, error, ivlen, len, resid; + size_t len; + int blksz, error, ivlen, resid; swa = &ses->swcr_auth; axf = swa->sw_axf; @@ -415,9 +410,8 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_init(&cc, &crp->crp_buf); crypto_cursor_advance(&cc, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid >= blksz; resid -= len) { - len = crypto_cursor_seglen(&cc); + inblk = crypto_cursor_segment(&cc, &len); if (len >= blksz) { - inblk = crypto_cursor_segbase(&cc); len = rounddown(MIN(len, resid), blksz); crypto_cursor_advance(&cc, len); } else { @@ -477,7 +471,8 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) struct auth_hash *axf; struct enc_xform *exf; uint32_t *blkp; - int blksz, error, ivlen, len, r, resid; + size_t len; + int blksz, error, ivlen, r, resid; swa = &ses->swcr_auth; axf = swa->sw_axf; @@ -518,9 +513,8 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_advance(&cc_in, crp->crp_aad_start); for (resid = crp->crp_aad_length; resid >= blksz; resid -= len) { - len = crypto_cursor_seglen(&cc_in); + inblk = crypto_cursor_segment(&cc_in, &len); if (len >= blksz) { - inblk = crypto_cursor_segbase(&cc_in); len = rounddown(MIN(len, resid), blksz); crypto_cursor_advance(&cc_in, len); } else { @@ -551,18 +545,17 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) } else cc_out = cc_in; for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; } else { - inblk = crypto_cursor_segbase(&cc_in); crypto_cursor_advance(&cc_in, blksz); } if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->encrypt(swe->sw_kschedule, inblk, outblk); axf->Update(&ctx, outblk, blksz); if (outblk == blk) @@ -612,17 +605,15 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_advance(&cc_in, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid > blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->decrypt(swe->sw_kschedule, inblk, outblk); if (outblk == blk) crypto_cursor_copyback(&cc_out, blksz, blk); @@ -717,6 +708,7 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) struct swcr_encdec *swe; struct auth_hash *axf; struct enc_xform *exf; + size_t len; int blksz, error, ivlen, r, resid; swa = &ses->swcr_auth; @@ -772,18 +764,16 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) } else cc_out = cc_in; for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); axf->Update(&ctx, inblk, blksz); exf->encrypt(swe->sw_kschedule, inblk, outblk); if (outblk == blk) @@ -839,17 +829,15 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_advance(&cc_in, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid > blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->decrypt(swe->sw_kschedule, inblk, outblk); if (outblk == blk) crypto_cursor_copyback(&cc_out, blksz, blk); @@ -889,6 +877,7 @@ swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) struct swcr_encdec *swe; struct auth_hash *axf; struct enc_xform *exf; + size_t len; int blksz, error, r, resid; swa = &ses->swcr_auth; @@ -937,18 +926,16 @@ swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) } else cc_out = cc_in; for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->encrypt(swe->sw_kschedule, inblk, outblk); axf->Update(&ctx, outblk, blksz); if (outblk == blk) @@ -1001,17 +988,15 @@ swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) crypto_cursor_advance(&cc_in, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid > blksz; resid -= blksz) { - if (crypto_cursor_seglen(&cc_in) < blksz) { + inblk = crypto_cursor_segment(&cc_in, &len); + if (len < blksz) { crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - } else { - inblk = crypto_cursor_segbase(&cc_in); + } else crypto_cursor_advance(&cc_in, blksz); - } - if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = crypto_cursor_segment(&cc_out, &len); + if (len < blksz) outblk = blk; - else - outblk = crypto_cursor_segbase(&cc_out); exf->decrypt(swe->sw_kschedule, inblk, outblk); if (outblk == blk) crypto_cursor_copyback(&cc_out, blksz, blk); From owner-dev-commits-src-main@freebsd.org Tue May 25 23:59: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 5625C657088; Tue, 25 May 2021 23:59: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 4FqWKH6mW7z4r1v; Tue, 25 May 2021 23:59: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 4D4E92694C; Tue, 25 May 2021 23:59: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 14PNxlfd095111; Tue, 25 May 2021 23:59:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14PNxl2t095110; Tue, 25 May 2021 23:59:47 GMT (envelope-from git) Date: Tue, 25 May 2021 23:59:47 GMT Message-Id: <202105252359.14PNxl2t095110@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: 1c09320d5833 - main - ossl: Use crypto_cursor_segment(). 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: 1c09320d5833fef8a4b6cc0091883fd47ea1eb1b 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, 25 May 2021 23:59:48 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1c09320d5833fef8a4b6cc0091883fd47ea1eb1b commit 1c09320d5833fef8a4b6cc0091883fd47ea1eb1b Author: John Baldwin AuthorDate: 2021-05-25 23:59:19 +0000 Commit: John Baldwin CommitDate: 2021-05-25 23:59:19 +0000 ossl: Use crypto_cursor_segment(). Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30447 --- sys/crypto/openssl/ossl_chacha20.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/sys/crypto/openssl/ossl_chacha20.c b/sys/crypto/openssl/ossl_chacha20.c index 7fa1a297052e..a6f56aca1f8f 100644 --- a/sys/crypto/openssl/ossl_chacha20.c +++ b/sys/crypto/openssl/ossl_chacha20.c @@ -65,15 +65,13 @@ ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) resid = crp->crp_payload_length; crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { crypto_cursor_init(&cc_out, &crp->crp_obuf); crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); while (resid >= CHACHA_BLK_SIZE) { if (inlen < CHACHA_BLK_SIZE) { crypto_cursor_copydata(&cc_in, CHACHA_BLK_SIZE, block); @@ -111,16 +109,14 @@ ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) if (out == block) { crypto_cursor_copyback(&cc_out, CHACHA_BLK_SIZE, block); - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); } else { crypto_cursor_advance(&cc_out, todo); outseg += todo; outlen -= todo; } if (in == block) { - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); } else { crypto_cursor_advance(&cc_in, todo); inseg += todo; @@ -196,15 +192,13 @@ ossl_chacha20_poly1305_encrypt(struct cryptop *crp, resid = crp->crp_payload_length; crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { crypto_cursor_init(&cc_out, &crp->crp_obuf); crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); while (resid >= CHACHA_BLK_SIZE) { if (inlen < CHACHA_BLK_SIZE) { crypto_cursor_copydata(&cc_in, CHACHA_BLK_SIZE, block); @@ -243,16 +237,14 @@ ossl_chacha20_poly1305_encrypt(struct cryptop *crp, if (out == block) { crypto_cursor_copyback(&cc_out, CHACHA_BLK_SIZE, block); - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); } else { crypto_cursor_advance(&cc_out, todo); outseg += todo; outlen -= todo; } if (in == block) { - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); } else { crypto_cursor_advance(&cc_in, todo); inseg += todo; @@ -368,15 +360,13 @@ ossl_chacha20_poly1305_decrypt(struct cryptop *crp, resid = crp->crp_payload_length; crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { crypto_cursor_init(&cc_out, &crp->crp_obuf); crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); while (resid >= CHACHA_BLK_SIZE) { if (inlen < CHACHA_BLK_SIZE) { crypto_cursor_copydata(&cc_in, CHACHA_BLK_SIZE, block); @@ -414,16 +404,14 @@ ossl_chacha20_poly1305_decrypt(struct cryptop *crp, if (out == block) { crypto_cursor_copyback(&cc_out, CHACHA_BLK_SIZE, block); - outseg = crypto_cursor_segbase(&cc_out); - outlen = crypto_cursor_seglen(&cc_out); + outseg = crypto_cursor_segment(&cc_out, &outlen); } else { crypto_cursor_advance(&cc_out, todo); outseg += todo; outlen -= todo; } if (in == block) { - inseg = crypto_cursor_segbase(&cc_in); - inlen = crypto_cursor_seglen(&cc_in); + inseg = crypto_cursor_segment(&cc_in, &inlen); } else { crypto_cursor_advance(&cc_in, todo); inseg += todo; From owner-dev-commits-src-main@freebsd.org Wed May 26 05:03: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 F013C6334E2; Wed, 26 May 2021 05:03: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 4Fqf4B61nHz3jMm; Wed, 26 May 2021 05:03: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 B74C22D84; Wed, 26 May 2021 05:03: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 14Q53sva007421; Wed, 26 May 2021 05:03:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14Q53sFm007420; Wed, 26 May 2021 05:03:54 GMT (envelope-from git) Date: Wed, 26 May 2021 05:03:54 GMT Message-Id: <202105260503.14Q53sFm007420@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 962b3a092616 - main - rtwn_usb(4): add D-Link DWA-121 (N150 Nano) to the rtwn_usb hardware list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 962b3a092616c95c68c0b0a844f4660675aa40f6 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, 26 May 2021 05:03:55 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=962b3a092616c95c68c0b0a844f4660675aa40f6 commit 962b3a092616c95c68c0b0a844f4660675aa40f6 Author: Dmitry Chagin AuthorDate: 2021-05-26 05:01:04 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-26 05:01:04 +0000 rtwn_usb(4): add D-Link DWA-121 (N150 Nano) to the rtwn_usb hardware list MFC after: 2 weeks --- share/man/man4/rtwn_usb.4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/man/man4/rtwn_usb.4 b/share/man/man4/rtwn_usb.4 index 3019827fd5e4..0bd57699262c 100644 --- a/share/man/man4/rtwn_usb.4 +++ b/share/man/man4/rtwn_usb.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd June 27, 2020 +.Dd May 26, 2021 .Dt RTWN_USB 4 .Os .Sh NAME @@ -70,6 +70,7 @@ based USB wireless network adapters, including: .It "Buffalo WI-U2-433DHP" Ta RTL8821AU Ta USB 2.0 .It "Buffalo WI-U2-433DM" Ta RTL8821AU Ta USB 2.0 .It "Buffalo WI-U3-866D" Ta RTL8812AU Ta USB 3.0 +.It "D-Link DWA-121 (N150 Nano)" Ta RTL8188EU Ta USB 2.0 .It "D-Link DWA-123 rev D1" Ta RTL8188EU Ta USB 2.0 .It "D-Link DWA-125 rev D1" Ta RTL8188EU Ta USB 2.0 .It "D-Link DWA-131" Ta RTL8192CU Ta USB 2.0 From owner-dev-commits-src-main@freebsd.org Wed May 26 05:34: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 415F66342CE; Wed, 26 May 2021 05:34: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 4Fqfls14Ltz3lqR; Wed, 26 May 2021 05:34: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 03A53323E; Wed, 26 May 2021 05:34: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 14Q5Ymgv047078; Wed, 26 May 2021 05:34:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14Q5YmfI047077; Wed, 26 May 2021 05:34:48 GMT (envelope-from git) Date: Wed, 26 May 2021 05:34:48 GMT Message-Id: <202105260534.14Q5YmfI047077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 5184e2da4192 - main - linux_common: retire extra module version. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5184e2da41921dfec5a3668756890b5c073fbad9 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, 26 May 2021 05:34:49 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=5184e2da41921dfec5a3668756890b5c073fbad9 commit 5184e2da41921dfec5a3668756890b5c073fbad9 Author: Dmitry Chagin AuthorDate: 2021-05-26 05:34:32 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-26 05:34:32 +0000 linux_common: retire extra module version. The second 'linuxcommon' line was added by c66f5b079d2a259c3a65b1efe0f2143cd030dc52 but Linuxulator's modules dependend on 'linux_common'. To avoid such mistakes in the future rename moduledata name and module name to 'linux_common' and retire 'linuxcommon' line. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D30409 MFC after: 2 weeks --- sys/compat/linux/linux_common.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/compat/linux/linux_common.c b/sys/compat/linux/linux_common.c index 5a0ac015ed0e..4d81470649de 100644 --- a/sys/compat/linux/linux_common.c +++ b/sys/compat/linux/linux_common.c @@ -43,8 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -MODULE_VERSION(linux_common, 1); - SET_DECLARE(linux_device_handler_set, struct linux_device_handler); TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_handlers = @@ -83,10 +81,10 @@ linux_common_modevent(module_t mod, int type, void *data) } static moduledata_t linux_common_mod = { - "linuxcommon", + "linux_common", linux_common_modevent, 0 }; -DECLARE_MODULE(linuxcommon, linux_common_mod, SI_SUB_EXEC, SI_ORDER_ANY); -MODULE_VERSION(linuxcommon, 1); +DECLARE_MODULE(linux_common, linux_common_mod, SI_SUB_EXEC, SI_ORDER_ANY); +MODULE_VERSION(linux_common, 1); From owner-dev-commits-src-main@freebsd.org Wed May 26 06:09: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 9D0A3634DA1; Wed, 26 May 2021 06:09: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 4FqgWr3nX8z3qNt; Wed, 26 May 2021 06:09: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 6A6313847; Wed, 26 May 2021 06:09: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 14Q69ScY087359; Wed, 26 May 2021 06:09:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14Q69SdH087358; Wed, 26 May 2021 06:09:28 GMT (envelope-from git) Date: Wed, 26 May 2021 06:09:28 GMT Message-Id: <202105260609.14Q69SdH087358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 79f27053e4e0 - main - stress2: Fix cleanup on exit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 79f27053e4e072afaf808c06e59c734b72e82c9b 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, 26 May 2021 06:09:28 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=79f27053e4e072afaf808c06e59c734b72e82c9b commit 79f27053e4e072afaf808c06e59c734b72e82c9b Author: Peter Holm AuthorDate: 2021-05-26 06:05:55 +0000 Commit: Peter Holm CommitDate: 2021-05-26 06:05:55 +0000 stress2: Fix cleanup on exit --- tools/test/stress2/misc/force7.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/test/stress2/misc/force7.sh b/tools/test/stress2/misc/force7.sh index 9eef1936cb98..1e987bc13a72 100755 --- a/tools/test/stress2/misc/force7.sh +++ b/tools/test/stress2/misc/force7.sh @@ -71,5 +71,10 @@ while [ $((`date +%s` - start)) -lt 300 ]; do fsck_ffs -fyR /dev/md$mdstart > $log 2>&1; s=$? [ $s -ne 0 ] && break done -[ $s -eq 0 ] && rm -f $diskimage $log || cat $log +if [ $s -eq 0 ]; then + mdconfig -d -u $mdstart + rm -f $diskimage $log +else + cat $log +fi exit $s From owner-dev-commits-src-main@freebsd.org Wed May 26 06:09:29 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 B3E116343F6; Wed, 26 May 2021 06:09:29 +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 4FqgWs4lKJz3qTp; Wed, 26 May 2021 06:09:29 +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 8BF3038F4; Wed, 26 May 2021 06:09:29 +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 14Q69Tg0087381; Wed, 26 May 2021 06:09:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14Q69TXg087380; Wed, 26 May 2021 06:09:29 GMT (envelope-from git) Date: Wed, 26 May 2021 06:09:29 GMT Message-Id: <202105260609.14Q69TXg087380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: bad9303974fc - main - stress2: Update the exclude list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bad9303974fc7e88e34cc6e0f47564ba26517173 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, 26 May 2021 06:09:29 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=bad9303974fc7e88e34cc6e0f47564ba26517173 commit bad9303974fc7e88e34cc6e0f47564ba26517173 Author: Peter Holm AuthorDate: 2021-05-26 06:06:38 +0000 Commit: Peter Holm CommitDate: 2021-05-26 06:06:38 +0000 stress2: Update the exclude list --- tools/test/stress2/misc/all.exclude | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index 9f856c1b9d2f..27142b026538 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -59,9 +59,6 @@ swapoff5.sh log0005.txt, known issue 20210111 systrace.sh WiP 20200227 systrace2.sh WiP 20200227 syzkaller11.sh WiP 20200721 -syzkaller15.sh WiP 20200712 -syzkaller16.sh WiP 20200620 -syzkaller17.sh WiP 20200630 syzkaller19.sh WiP 20200712 syzkaller25.sh WiP 20201116 syzkaller28.sh WiP 20201120 From owner-dev-commits-src-main@freebsd.org Wed May 26 06:09: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 E573E6343F7; Wed, 26 May 2021 06:09: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 4FqgWt64RDz3qG0; Wed, 26 May 2021 06:09: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 AE5F938F5; Wed, 26 May 2021 06:09: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 14Q69U5p087402; Wed, 26 May 2021 06:09:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14Q69ULX087401; Wed, 26 May 2021 06:09:30 GMT (envelope-from git) Date: Wed, 26 May 2021 06:09:30 GMT Message-Id: <202105260609.14Q69ULX087401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 0b5d6b8173d9 - main - stress2: Added a new ptrace() test scenario MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b5d6b8173d91802cd0d765ce2e19d856f4bc401 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, 26 May 2021 06:09:31 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=0b5d6b8173d91802cd0d765ce2e19d856f4bc401 commit 0b5d6b8173d91802cd0d765ce2e19d856f4bc401 Author: Peter Holm AuthorDate: 2021-05-26 06:08:56 +0000 Commit: Peter Holm CommitDate: 2021-05-26 06:08:56 +0000 stress2: Added a new ptrace() test scenario --- tools/test/stress2/misc/truss2.sh | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tools/test/stress2/misc/truss2.sh b/tools/test/stress2/misc/truss2.sh new file mode 100755 index 000000000000..6a5743550b04 --- /dev/null +++ b/tools/test/stress2/misc/truss2.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Peter Holm +# +# 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. +# + +# Trace random cc, c++ or make threads from a buildkernel +# Test scenario idea by kib@ + +old=`sysctl -in kern.kill_on_debugger_exit` +[ -z "$old" ] && exit 0 +trap "sysctl kern.kill_on_debugger_exit=$old" EXIT INT + +# Enable ptrace(2)d processes to continue +sysctl kern.kill_on_debugger_exit=0 +./buildkernel.sh & kpid=$! +while true; do + for i in `jot 8`; do + rpid=`ps -l | grep -vwE 'grep|RE|defunct' | \ + grep -E "(cc|c\+\+|make) " | \ + sort -R | head -1 | awk '{print $2}'` + [ -n "$rpid" ] && break + sleep 1 + done + [ -z "$rpid" ] && break + kill -0 $rpid 2>/dev/null || continue + ps -lp $rpid | tail -1 + echo "truss -f -o /dev/null -p $rpid" + truss -f -o /dev/null -p $rpid & tpid=$! + sleep `jot -r 1 5 10` + pkill -9 truss + wait $tpid +done +wait $kpid +exit $? From owner-dev-commits-src-main@freebsd.org Wed May 26 06:47: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 EA148635652; Wed, 26 May 2021 06:47: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 4FqhN46DBBz3sp0; Wed, 26 May 2021 06:47: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 BCE9144E3; Wed, 26 May 2021 06:47: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 14Q6lmRR039636; Wed, 26 May 2021 06:47:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14Q6lml7039635; Wed, 26 May 2021 06:47:48 GMT (envelope-from git) Date: Wed, 26 May 2021 06:47:48 GMT Message-Id: <202105260647.14Q6lml7039635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 17dafdc0de7e - main - rtwn_usb(4): add revision number for D-Link DWA-121 (N150 Nano). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17dafdc0de7e8ab0c750d1339e4debc78262e19b 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, 26 May 2021 06:47:49 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=17dafdc0de7e8ab0c750d1339e4debc78262e19b commit 17dafdc0de7e8ab0c750d1339e4debc78262e19b Author: Dmitry Chagin AuthorDate: 2021-05-26 06:47:30 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-26 06:47:30 +0000 rtwn_usb(4): add revision number for D-Link DWA-121 (N150 Nano). MFC after: 2 weeks --- share/man/man4/rtwn_usb.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/rtwn_usb.4 b/share/man/man4/rtwn_usb.4 index 0bd57699262c..1a9460d8c9c7 100644 --- a/share/man/man4/rtwn_usb.4 +++ b/share/man/man4/rtwn_usb.4 @@ -70,7 +70,7 @@ based USB wireless network adapters, including: .It "Buffalo WI-U2-433DHP" Ta RTL8821AU Ta USB 2.0 .It "Buffalo WI-U2-433DM" Ta RTL8821AU Ta USB 2.0 .It "Buffalo WI-U3-866D" Ta RTL8812AU Ta USB 3.0 -.It "D-Link DWA-121 (N150 Nano)" Ta RTL8188EU Ta USB 2.0 +.It "D-Link DWA-121 rev C1A (N150 Nano)" Ta RTL8188EU Ta USB 2.0 .It "D-Link DWA-123 rev D1" Ta RTL8188EU Ta USB 2.0 .It "D-Link DWA-125 rev D1" Ta RTL8188EU Ta USB 2.0 .It "D-Link DWA-131" Ta RTL8192CU Ta USB 2.0 From owner-dev-commits-src-main@freebsd.org Wed May 26 07:13: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 DC8D6635F31; Wed, 26 May 2021 07:13: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 4Fqhxk5sMSz3twk; Wed, 26 May 2021 07:13: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 B1A0B4BFE; Wed, 26 May 2021 07:13: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 14Q7DUOY079886; Wed, 26 May 2021 07:13:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14Q7DU3v079885; Wed, 26 May 2021 07:13:30 GMT (envelope-from git) Date: Wed, 26 May 2021 07:13:30 GMT Message-Id: <202105260713.14Q7DU3v079885@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 399bad7b9a10 - main - rtwn_usb(4): add Mercusys MW150US (N150 Nano) to the rtwn_usb hardware list. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 399bad7b9a105930b8203ad0a1fd154681bc16b8 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, 26 May 2021 07:13:30 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=399bad7b9a105930b8203ad0a1fd154681bc16b8 commit 399bad7b9a105930b8203ad0a1fd154681bc16b8 Author: Dmitry Chagin AuthorDate: 2021-05-26 07:13:08 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-26 07:13:08 +0000 rtwn_usb(4): add Mercusys MW150US (N150 Nano) to the rtwn_usb hardware list. MFC after: 2 weeks --- share/man/man4/rtwn_usb.4 | 1 + 1 file changed, 1 insertion(+) diff --git a/share/man/man4/rtwn_usb.4 b/share/man/man4/rtwn_usb.4 index 1a9460d8c9c7..b146cfe4fe09 100644 --- a/share/man/man4/rtwn_usb.4 +++ b/share/man/man4/rtwn_usb.4 @@ -93,6 +93,7 @@ based USB wireless network adapters, including: .It "NEC AtermWL900U PA-WL900U" Ta RTL8812AU Ta USB 3.0 .It "Netgear A6100" Ta RTL8821AU Ta USB 2.0 .It "Netgear WNA1000M" Ta RTL8188CUS Ta USB 2.0 +.It "Mercusys MW150US" Ta RTL8188EU Ta USB 2.0 .It "Planex GW-900D" Ta RTL8812AU Ta USB 3.0 .It "Realtek RTL8192CU" Ta RTL8192CU Ta USB 2.0 .It "Realtek RTL8188CUS" Ta RTL8188CUS Ta USB 2.0 From owner-dev-commits-src-main@freebsd.org Wed May 26 09:30: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 7D1DD63819D; Wed, 26 May 2021 09:30: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 4Fqlzz36ksz4Ygx; Wed, 26 May 2021 09:30: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 53F0E66EA; Wed, 26 May 2021 09:30: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 14Q9UdZg060269; Wed, 26 May 2021 09:30:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14Q9Ud2k060268; Wed, 26 May 2021 09:30:39 GMT (envelope-from git) Date: Wed, 26 May 2021 09:30:39 GMT Message-Id: <202105260930.14Q9Ud2k060268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Takanori Watanabe Subject: git: 14803ec8d193 - main - Fix a use-after-free in an error case. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: takawata X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 14803ec8d193d8d46f4137a7dba61b277c6a2fed 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, 26 May 2021 09:30:39 -0000 The branch main has been updated by takawata: URL: https://cgit.FreeBSD.org/src/commit/?id=14803ec8d193d8d46f4137a7dba61b277c6a2fed commit 14803ec8d193d8d46f4137a7dba61b277c6a2fed Author: Takanori Watanabe AuthorDate: 2021-05-26 09:23:33 +0000 Commit: Takanori Watanabe CommitDate: 2021-05-26 09:23:33 +0000 Fix a use-after-free in an error case. PR: 255872 Submitted by: lylgood Differential Revision: https://reviews.freebsd.org/D30454 --- sys/netgraph/bluetooth/hci/ng_hci_evnt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netgraph/bluetooth/hci/ng_hci_evnt.c b/sys/netgraph/bluetooth/hci/ng_hci_evnt.c index 9e299d12fd1e..64ab4f0b36b9 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_evnt.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_evnt.c @@ -528,6 +528,7 @@ static int le_connection_complete(ng_hci_unit_p unit, struct mbuf *event) if (error != 0) { ng_hci_con_untimeout(con); ng_hci_free_con(con); + goto out; } } else if ((error = ng_hci_con_untimeout(con)) != 0) From owner-dev-commits-src-main@freebsd.org Wed May 26 10:00: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 F3E126381E9; Wed, 26 May 2021 10:00:09 +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 4Fqmf16PYBz4dBM; Wed, 26 May 2021 10:00: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 C40BF6A2B; Wed, 26 May 2021 10:00: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 14QA09mj095193; Wed, 26 May 2021 10:00:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QA09uO095190; Wed, 26 May 2021 10:00:09 GMT (envelope-from git) Date: Wed, 26 May 2021 10:00:09 GMT Message-Id: <202105261000.14QA09uO095190@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ruslan Bukin Subject: git: 38e7025a60b2 - main - o Fix i2c read operation for large transfers (more than 32 bytes). o Fix slave address setting. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: br X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38e7025a60b28623b5991622a6efd1b8a329ccb2 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, 26 May 2021 10:00:10 -0000 The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=38e7025a60b28623b5991622a6efd1b8a329ccb2 commit 38e7025a60b28623b5991622a6efd1b8a329ccb2 Author: Ruslan Bukin AuthorDate: 2021-05-26 09:55:23 +0000 Commit: Ruslan Bukin CommitDate: 2021-05-26 09:55:23 +0000 o Fix i2c read operation for large transfers (more than 32 bytes). o Fix slave address setting. This allows to read the EDID from an HDMI monitor. Reviewed by: manu Sponsored by: UKRI Differential Revision: https://reviews.freebsd.org/D27139 --- sys/arm64/rockchip/rk_i2c.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/sys/arm64/rockchip/rk_i2c.c b/sys/arm64/rockchip/rk_i2c.c index fa824c76003b..c54f523088fe 100644 --- a/sys/arm64/rockchip/rk_i2c.c +++ b/sys/arm64/rockchip/rk_i2c.c @@ -291,6 +291,7 @@ static void rk_i2c_intr_locked(struct rk_i2c_softc *sc) { uint32_t reg; + int transfer_len; sc->ipd = RK_I2C_READ(sc, RK_I2C_IPD); @@ -324,11 +325,16 @@ rk_i2c_intr_locked(struct rk_i2c_softc *sc) RK_I2C_WRITE(sc, RK_I2C_IEN, RK_I2C_IEN_MBRFIEN | RK_I2C_IEN_NAKRCVIEN); - reg = RK_I2C_READ(sc, RK_I2C_CON); - reg |= RK_I2C_CON_LASTACK; - RK_I2C_WRITE(sc, RK_I2C_CON, reg); + if ((sc->msg->len - sc->cnt) > 32) + transfer_len = 32; + else { + transfer_len = sc->msg->len - sc->cnt; + reg = RK_I2C_READ(sc, RK_I2C_CON); + reg |= RK_I2C_CON_LASTACK; + RK_I2C_WRITE(sc, RK_I2C_CON, reg); + } - RK_I2C_WRITE(sc, RK_I2C_MRXCNT, sc->msg->len); + RK_I2C_WRITE(sc, RK_I2C_MRXCNT, transfer_len); } else { sc->state = STATE_WRITE; RK_I2C_WRITE(sc, RK_I2C_IEN, RK_I2C_IEN_MBTFIEN | @@ -344,6 +350,23 @@ rk_i2c_intr_locked(struct rk_i2c_softc *sc) if (sc->cnt == sc->msg->len) rk_i2c_send_stop(sc); + else { + sc->mode = RK_I2C_CON_MODE_RX; + reg = RK_I2C_READ(sc, RK_I2C_CON) & \ + ~RK_I2C_CON_CTRL_MASK; + reg |= sc->mode << RK_I2C_CON_MODE_SHIFT; + reg |= RK_I2C_CON_EN; + + if ((sc->msg->len - sc->cnt) > 32) + transfer_len = 32; + else { + transfer_len = sc->msg->len - sc->cnt; + reg |= RK_I2C_CON_LASTACK; + } + + RK_I2C_WRITE(sc, RK_I2C_CON, reg); + RK_I2C_WRITE(sc, RK_I2C_MRXCNT, transfer_len); + } break; case STATE_WRITE: @@ -509,7 +532,7 @@ rk_i2c_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) sc->mode = RK_I2C_CON_MODE_RX; } else { sc->mode = RK_I2C_CON_MODE_RRX; - reg = msgs[i].slave & LSB; + reg = msgs[i].slave & ~LSB; reg |= RK_I2C_MRXADDR_VALID(0); RK_I2C_WRITE(sc, RK_I2C_MRXADDR, reg); RK_I2C_WRITE(sc, RK_I2C_MRXRADDR, 0); From owner-dev-commits-src-main@freebsd.org Wed May 26 10:45: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 539AE6397BC; Wed, 26 May 2021 10:45: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 4Fqnfq6bBXz4jMV; Wed, 26 May 2021 10:45: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 CA42172C9; Wed, 26 May 2021 10:45: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 14QAjtNp057811; Wed, 26 May 2021 10:45:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QAjtVk057810; Wed, 26 May 2021 10:45:55 GMT (envelope-from git) Date: Wed, 26 May 2021 10:45:55 GMT Message-Id: <202105261045.14QAjtVk057810@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: 4f3addd94be5 - main - tcp: Add a socket option to rack so we can test various changes to the slop value in timers. 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: 4f3addd94be5e02e6e425f6119f5409972ab5d14 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, 26 May 2021 10:45:56 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=4f3addd94be5e02e6e425f6119f5409972ab5d14 commit 4f3addd94be5e02e6e425f6119f5409972ab5d14 Author: Randall Stewart AuthorDate: 2021-05-26 10:43:30 +0000 Commit: Randall Stewart CommitDate: 2021-05-26 10:43:30 +0000 tcp: Add a socket option to rack so we can test various changes to the slop value in timers. Timer_slop, in TCP, has been 200ms for a long time. This value dates back a long time when delayed ack timers were longer and links were slower. A 200ms timer slop allows 1 MSS to be sent over a 60kbps link. Its possible that lowering this value to something more in line with todays delayed ack values (40ms) might improve TCP. This bit of code makes it so rack can, via a socket option, adjust the timer slop. Reviewed by: mtuexen Sponsered by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30249 --- sys/netinet/tcp.h | 1 + sys/netinet/tcp_stacks/rack.c | 44 +++++++++++++++++++++++++++------------ sys/netinet/tcp_stacks/tcp_rack.h | 2 ++ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index 7ba99df51ed3..45bece9fa9dd 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -306,6 +306,7 @@ struct tcphdr { #define TCP_FAST_RSM_HACK 1137 /* Do we do the broken thing where we don't twiddle the TLP bits properly in fast_rsm_output? */ #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 */ /* Start of reserved space for third-party user-settable options. */ #define TCP_VENDOR SO_VENDOR diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index ad2c7d31d110..b7e8c1578f2b 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -408,8 +408,8 @@ counter_u64_t rack_opts_arry[RACK_OPTS_SIZE]; #define RACK_REXMTVAL(tp) max(rack_rto_min, ((tp)->t_srtt + ((tp)->t_rttvar << 2))) -#define RACK_TCPT_RANGESET(tv, value, tvmin, tvmax) do { \ - (tv) = (value) + TICKS_2_USEC(tcp_rexmit_slop); \ +#define RACK_TCPT_RANGESET(tv, value, tvmin, tvmax, slop) do { \ + (tv) = (value) + slop; \ if ((u_long)(tv) < (u_long)(tvmin)) \ (tv) = (tvmin); \ if ((u_long)(tv) > (u_long)(tvmax)) \ @@ -2448,7 +2448,7 @@ rack_log_rtt_sample(struct tcp_rack *rack, uint32_t rtt) /* Lets capture all the things that make up t_rtxcur */ log.u_bbr.applimited = rack_rto_min; log.u_bbr.epoch = rack_rto_max; - log.u_bbr.lt_epoch = rtt; + log.u_bbr.lt_epoch = rack->r_ctl.timer_slop; log.u_bbr.lost = rack_rto_min; log.u_bbr.pkt_epoch = TICKS_2_USEC(tcp_rexmit_slop); log.u_bbr.rttProp = RACK_REXMTVAL(rack->rc_tp); @@ -5260,7 +5260,7 @@ rack_get_persists_timer_val(struct tcpcb *tp, struct tcp_rack *rack) t = (tp->t_srtt + (tp->t_rttvar << 2)); RACK_TCPT_RANGESET(tt, t * tcp_backoff[tp->t_rxtshift], - rack_persist_min, rack_persist_max); + rack_persist_min, rack_persist_max, rack->r_ctl.timer_slop); if (tp->t_rxtshift < TCP_MAXRXTSHIFT) tp->t_rxtshift++; rack->r_ctl.rc_hpts_flags |= PACE_TMR_PERSIT; @@ -5526,7 +5526,7 @@ rack_enter_persist(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) rack_timer_cancel(tp, rack, cts, __LINE__); tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), - rack_rto_min, rack_rto_max); + rack_rto_min, rack_rto_max, rack->r_ctl.timer_slop); rack->rc_in_persist = 1; } } @@ -5581,7 +5581,7 @@ rack_exit_persist(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) rack->r_ctl.rc_went_idle_time = 0; tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), - rack_rto_min, rack_rto_max); + rack_rto_min, rack_rto_max, rack->r_ctl.timer_slop); rack->r_ctl.rc_agg_delayed = 0; rack->r_early = 0; rack->r_late = 0; @@ -6777,7 +6777,7 @@ drop_it: rexmt = max(rack_rto_min, (tp->t_srtt + (tp->t_rttvar << 2))) * tcp_backoff[tp->t_rxtshift]; RACK_TCPT_RANGESET(tp->t_rxtcur, rexmt, - max(rack_rto_min, rexmt), rack_rto_max); + max(rack_rto_min, rexmt), rack_rto_max, rack->r_ctl.timer_slop); /* * We enter the path for PLMTUD if connection is established or, if * connection is FIN_WAIT_1 status, reason for the last is that if @@ -7702,7 +7702,7 @@ tcp_rack_xmit_timer_commit(struct tcp_rack *rack, struct tcpcb *tp) */ tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), - max(rack_rto_min, rtt + 2), rack_rto_max); + max(rack_rto_min, rtt + 2), rack_rto_max, rack->r_ctl.timer_slop); rack_log_rtt_sample(rack, rtt); tp->t_softerror = 0; } @@ -7877,7 +7877,7 @@ rack_update_rtt(struct tcpcb *tp, struct tcp_rack *rack, */ tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), - rack_rto_min, rack_rto_max); + rack_rto_min, rack_rto_max, rack->r_ctl.timer_slop); tp->t_softerror = 0; if (to && (to->to_flags & TOF_TS) && (ack_type == CUM_ACKED) && @@ -9735,7 +9735,7 @@ rack_process_ack(struct mbuf *m, struct tcphdr *th, struct socket *so, if (rack->rc_in_persist) { tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), - rack_rto_min, rack_rto_max); + rack_rto_min, rack_rto_max, rack->r_ctl.timer_slop); } if ((th->th_ack == tp->snd_una) && (tiwin == tp->snd_wnd)) { rack_strike_dupack(rack); @@ -9798,7 +9798,7 @@ rack_process_ack(struct mbuf *m, struct tcphdr *th, struct socket *so, /* assure we are not backed off */ tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), - rack_rto_min, rack_rto_max); + rack_rto_min, rack_rto_max, rack->r_ctl.timer_slop); rack->rc_tlp_in_progress = 0; rack->r_ctl.rc_tlp_cnt_out = 0; /* @@ -10648,7 +10648,7 @@ rack_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, m_freem(mfree); tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), - rack_rto_min, rack_rto_max); + rack_rto_min, rack_rto_max, rack->r_ctl.timer_slop); rack->rc_tlp_in_progress = 0; rack->r_ctl.rc_tlp_cnt_out = 0; /* @@ -12089,6 +12089,7 @@ rack_init(struct tcpcb *tp) rack->r_ctl.rc_lowest_us_rtt = 0xffffffff; rack->r_ctl.rc_highest_us_rtt = 0; rack->r_ctl.bw_rate_cap = rack_bw_rate_cap; + rack->r_ctl.timer_slop = TICKS_2_USEC(tcp_rexmit_slop); if (rack_use_cmp_acks) rack->r_use_cmp_ack = 1; if (rack_disable_prr) @@ -13182,7 +13183,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb /* Clear out shifts and such */ tp->t_rxtshift = 0; RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), - rack_rto_min, rack_rto_max); + rack_rto_min, rack_rto_max, rack->r_ctl.timer_slop); rack->rc_tlp_in_progress = 0; rack->r_ctl.rc_tlp_cnt_out = 0; /* Send recover and snd_nxt must be dragged along */ @@ -18879,6 +18880,19 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_saved_beta.beta = optval; } break; + case TCP_RACK_TIMER_SLOP: + RACK_OPTS_INC(tcp_rack_timer_slop); + rack->r_ctl.timer_slop = optval; + if (rack->rc_tp->t_srtt) { + /* + * If we have an SRTT lets update t_rxtcur + * to have the new slop. + */ + RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), + rack_rto_min, rack_rto_max, + rack->r_ctl.timer_slop); + } + break; case TCP_RACK_PACING_BETA_ECN: RACK_OPTS_INC(tcp_rack_beta_ecn); if (strcmp(tp->cc_algo->name, CCALGONAME_NEWRENO) != 0) { @@ -19525,6 +19539,7 @@ rack_set_sockopt(struct socket *so, struct sockopt *sopt, case TCP_DEFER_OPTIONS: /* URL:defer */ case TCP_RACK_PACING_BETA: /* URL:pacing_beta */ case TCP_RACK_PACING_BETA_ECN: /* URL:pacing_beta_ecn */ + case TCP_RACK_TIMER_SLOP: /* URL:timer_slop */ break; default: /* Filter off all unknown options to the base stack */ @@ -19856,6 +19871,9 @@ rack_get_sockopt(struct socket *so, struct sockopt *sopt, case TCP_SHARED_CWND_TIME_LIMIT: optval = rack->r_limit_scw; break; + case TCP_RACK_TIMER_SLOP: + optval = rack->r_ctl.timer_slop; + break; default: return (tcp_default_ctloutput(so, sopt, inp, tp)); break; diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index 7f2b2ce4786a..349f6daec2f4 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -245,6 +245,7 @@ struct rack_opts_stats { uint64_t tcp_rack_fastrsm_hack; uint64_t tcp_rack_beta; uint64_t tcp_rack_beta_ecn; + uint64_t tcp_rack_timer_slop; }; /* RTT shrink reasons */ @@ -341,6 +342,7 @@ struct rack_control { struct rack_sendmap *rc_resend; /* something we have been asked to * resend */ struct rack_fast_send_blk fsb; /* The fast-send block */ + uint32_t timer_slop; uint32_t input_pkt; uint32_t saved_input_pkt; uint32_t rc_hpts_flags; From owner-dev-commits-src-main@freebsd.org Wed May 26 10: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 6EEE8639671; Wed, 26 May 2021 10: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 4Fqnnt2h77z4kr8; Wed, 26 May 2021 10: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 4424B7825; Wed, 26 May 2021 10: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 14QAq2b3070432; Wed, 26 May 2021 10: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 14QAq285070431; Wed, 26 May 2021 10:52:02 GMT (envelope-from git) Date: Wed, 26 May 2021 10:52:02 GMT Message-Id: <202105261052.14QAq285070431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 905d192d6f16 - main - Unstaticize parts of coredumping code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 905d192d6f161496c26db29d0d429525166bfff7 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, 26 May 2021 10:52:02 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=905d192d6f161496c26db29d0d429525166bfff7 commit 905d192d6f161496c26db29d0d429525166bfff7 Author: Edward Tomasz Napierala AuthorDate: 2021-05-26 09:23:37 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-26 10:51:57 +0000 Unstaticize parts of coredumping code This makes it possible to call __elfN(size_segments) and __elfN(puthdr) from Linux coredump code. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30455 --- sys/kern/imgact_elf.c | 23 ++++++++++++----------- sys/sys/imgact_elf.h | 8 ++++++++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 15976d143988..57e9ac18e63b 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1434,12 +1434,6 @@ struct phdr_closure { Elf_Off offset; /* Offset of segment in core file */ }; -/* Closure for cb_size_segment(). */ -struct sseg_closure { - int count; /* Count of writable segments. */ - size_t size; /* Total size of all writable segments. */ -}; - typedef void (*outfunc_t)(void *, struct sbuf *, size_t *); struct note_info { @@ -1463,7 +1457,6 @@ static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t, struct note_info_list *, size_t, int); static void __elfN(prepare_notes)(struct thread *, struct note_info_list *, size_t *); -static void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int); static void __elfN(putnote)(struct note_info *, struct sbuf *); static size_t register_note(struct note_info_list *, int, outfunc_t, void *); @@ -1508,9 +1501,7 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) TAILQ_INIT(¬elst); /* Size the program segments. */ - seginfo.count = 0; - seginfo.size = 0; - each_dumpable_segment(td, cb_size_segment, &seginfo, flags); + __elfN(size_segments)(td, &seginfo, flags); /* * Collect info about the core file header area. @@ -1645,6 +1636,16 @@ cb_size_segment(vm_map_entry_t entry, void *closure) ssc->size += entry->end - entry->start; } +void +__elfN(size_segments)(struct thread *td, struct sseg_closure *seginfo, + int flags) +{ + seginfo->count = 0; + seginfo->size = 0; + + each_dumpable_segment(td, cb_size_segment, seginfo, flags); +} + /* * For each writable segment in the process's memory map, call the given * function with a pointer to the map entry and some arbitrary @@ -1803,7 +1804,7 @@ __elfN(prepare_notes)(struct thread *td, struct note_info_list *list, *sizep = size; } -static void +void __elfN(puthdr)(struct thread *td, void *hdr, size_t hdrsize, int numsegs, size_t notesz, int flags) { diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h index ca95798c7288..f0c112b2bcdc 100644 --- a/sys/sys/imgact_elf.h +++ b/sys/sys/imgact_elf.h @@ -100,6 +100,12 @@ __ElfType(Brandinfo); #define MAX_BRANDS 8 +/* Closure for __elfN(size_segments)(). */ +struct sseg_closure { + int count; /* Count of writable segments. */ + size_t size; /* Total size of all writable segments. */ +}; + int __elfN(brand_inuse)(Elf_Brandinfo *entry); int __elfN(insert_brand_entry)(Elf_Brandinfo *entry); int __elfN(remove_brand_entry)(Elf_Brandinfo *entry); @@ -108,6 +114,8 @@ int __elfN(coredump)(struct thread *, struct vnode *, off_t, int); size_t __elfN(populate_note)(int, void *, void *, size_t, void **); void __elfN(stackgap)(struct image_params *, uintptr_t *); int __elfN(freebsd_copyout_auxargs)(struct image_params *, uintptr_t); +void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int); +void __elfN(size_segments)(struct thread *, struct sseg_closure *, int); /* Machine specific function to dump per-thread information. */ void __elfN(dump_thread)(struct thread *, void *, size_t *); From owner-dev-commits-src-main@freebsd.org Wed May 26 11:41: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 85F1663A3D9; Wed, 26 May 2021 11:41: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 4FqptS3BgVz4nmH; Wed, 26 May 2021 11:41: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 55D6010431; Wed, 26 May 2021 11:41: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 14QBf4Rn033768; Wed, 26 May 2021 11:41:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QBf4ck033767; Wed, 26 May 2021 11:41:04 GMT (envelope-from git) Date: Wed, 26 May 2021 11:41:04 GMT Message-Id: <202105261141.14QBf4ck033767@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: 3bca93e04275 - main - rc.d/random: add support for zero harvest_mask MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3bca93e04275045c3d868d09a57f9201999908f0 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, 26 May 2021 11:41:04 -0000 The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=3bca93e04275045c3d868d09a57f9201999908f0 commit 3bca93e04275045c3d868d09a57f9201999908f0 Author: Eugene Grosbein AuthorDate: 2021-05-26 11:30:24 +0000 Commit: Eugene Grosbein CommitDate: 2021-05-26 11:30:24 +0000 rc.d/random: add support for zero harvest_mask Replace the check for zero harvest_mask with new check for empty string. This allows one to specify harvest_mask="0" that disables harversting entropy from all but "pure" sources. Exact bit values for "pure" sources differ for stable/12 and later branches, so it is handy to use zero. The check for zero pre-dates introduction of "pure" non-maskable sources Use empty string to disable altering sysctl kern.random.harvest.mask. Note that notion of "pure" random sources is not documented in user level manual pages yet. Still, it helps to extend battery life for hardware with embedded "Intel Secure Key RNG" by disabling all other sources. Note that no defaults changed and default behaviour is not affected. Reported by: Dmitry Luhtionov --- libexec/rc/rc.d/random | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/random b/libexec/rc/rc.d/random index d275284e13d6..fda3c8a71fae 100755 --- a/libexec/rc/rc.d/random +++ b/libexec/rc/rc.d/random @@ -47,7 +47,7 @@ feed_dev_random() random_start() { - if [ ${harvest_mask} -gt 0 ]; then + if [ -n "${harvest_mask}" ]; then echo -n 'Setting up harvesting: ' ${SYSCTL} kern.random.harvest.mask=${harvest_mask} > /dev/null ${SYSCTL_N} kern.random.harvest.mask_symbolic From owner-dev-commits-src-main@freebsd.org Wed May 26 12:43:21 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 E927563B7F6; Wed, 26 May 2021 12:43:21 +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 4FqrGK642wz4sTn; Wed, 26 May 2021 12:43:21 +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 B865A112A5; Wed, 26 May 2021 12:43:21 +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 14QChLD8017823; Wed, 26 May 2021 12:43:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QChLeA017822; Wed, 26 May 2021 12:43:21 GMT (envelope-from git) Date: Wed, 26 May 2021 12:43:21 GMT Message-Id: <202105261243.14QChLeA017822@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: c35034b338eb - main - LinuxKPI/OFED/mlx4: cleanup netdevice.h some more 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: c35034b338eb4de6fb42fd855865bce21c81a225 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, 26 May 2021 12:43:22 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c35034b338eb4de6fb42fd855865bce21c81a225 commit c35034b338eb4de6fb42fd855865bce21c81a225 Author: Bjoern A. Zeeb AuthorDate: 2021-05-26 12:27:26 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-26 12:30:02 +0000 LinuxKPI/OFED/mlx4: cleanup netdevice.h some more This removes all unused bits from linux/netdevice.h and migrates two inline functions into the mlx4 and ofed code respectively. This gets the mlx4/ofed (struct ifnet) specific bits down to 7 lines in netdevice.h. Sponsored by: The FreeBSD Foundation MFC after: 13 days Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D30461 --- .../linuxkpi/common/include/linux/netdevice.h | 64 ---------------------- sys/dev/mlx4/mlx4_en/en.h | 6 ++ sys/ofed/drivers/infiniband/core/ib_addr.c | 1 - sys/ofed/drivers/infiniband/core/ib_cma.c | 1 - sys/ofed/include/rdma/ib_addr.h | 2 +- sys/ofed/include/rdma/ib_addr_freebsd.h | 15 +++++ sys/ofed/include/rdma/ib_sa.h | 1 + 7 files changed, 23 insertions(+), 67 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h index 9ec76d9b90ef..07c111cc4fc9 100644 --- a/sys/compat/linuxkpi/common/include/linux/netdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h @@ -40,10 +40,6 @@ #include #include -#include -#include -#include -#include #include #include @@ -57,21 +53,6 @@ #define net_device ifnet -static inline struct ifnet * -dev_get_by_index(struct vnet *vnet, int if_index) -{ - struct epoch_tracker et; - struct ifnet *retval; - - NET_EPOCH_ENTER(et); - CURVNET_SET(vnet); - retval = ifnet_byindex_ref(if_index); - CURVNET_RESTORE(); - NET_EPOCH_EXIT(et); - - return (retval); -} - #define dev_hold(d) if_ref(d) #define dev_put(d) if_rele(d) #define dev_net(d) ((d)->if_vnet) @@ -79,56 +60,11 @@ dev_get_by_index(struct vnet *vnet, int if_index) #define net_eq(a,b) ((a) == (b)) #define netif_running(dev) !!((dev)->if_drv_flags & IFF_DRV_RUNNING) -#define netif_oper_up(dev) !!((dev)->if_flags & IFF_UP) #define netif_carrier_ok(dev) ((dev)->if_link_state == LINK_STATE_UP) -static inline void * -netdev_priv(const struct net_device *dev) -{ - return (dev->if_softc); -} - #define rtnl_lock() #define rtnl_unlock() -static inline int -dev_mc_delete(struct net_device *dev, void *addr, int alen, int all) -{ - struct sockaddr_dl sdl; - - if (alen > sizeof(sdl.sdl_data)) - return (-EINVAL); - memset(&sdl, 0, sizeof(sdl)); - sdl.sdl_len = sizeof(sdl); - sdl.sdl_family = AF_LINK; - sdl.sdl_alen = alen; - memcpy(&sdl.sdl_data, addr, alen); - - return -if_delmulti(dev, (struct sockaddr *)&sdl); -} - -static inline int -dev_mc_del(struct net_device *dev, void *addr) -{ - return (dev_mc_delete(dev, addr, 6, 0)); -} - -static inline int -dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly) -{ - struct sockaddr_dl sdl; - - if (alen > sizeof(sdl.sdl_data)) - return (-EINVAL); - memset(&sdl, 0, sizeof(sdl)); - sdl.sdl_len = sizeof(sdl); - sdl.sdl_family = AF_LINK; - sdl.sdl_alen = alen; - memcpy(&sdl.sdl_data, addr, alen); - - return -if_addmulti(dev, (struct sockaddr *)&sdl, NULL); -} - /* According to linux::ipoib_main.c. */ struct netdev_notifier_info { struct net_device *dev; diff --git a/sys/dev/mlx4/mlx4_en/en.h b/sys/dev/mlx4/mlx4_en/en.h index e7a02f02c8b7..e63027bc9dc0 100644 --- a/sys/dev/mlx4/mlx4_en/en.h +++ b/sys/dev/mlx4/mlx4_en/en.h @@ -654,6 +654,12 @@ struct mlx4_mac_entry { u64 reg_id; }; +static inline void * +netdev_priv(const struct net_device *dev) +{ + return (dev->if_softc); +} + static inline struct mlx4_cqe *mlx4_en_get_cqe(u8 *buf, int idx, int cqe_sz) { return (struct mlx4_cqe *)(buf + idx * cqe_sz); diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index f8c1cb180af8..ef5e264577e0 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 717d7c70e9de..7c03841d51d7 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h index 052fc636f617..535e6c2b3b14 100644 --- a/sys/ofed/include/rdma/ib_addr.h +++ b/sys/ofed/include/rdma/ib_addr.h @@ -49,7 +49,7 @@ #include #include #include -#include +#include struct rdma_addr_client { atomic_t refcount; diff --git a/sys/ofed/include/rdma/ib_addr_freebsd.h b/sys/ofed/include/rdma/ib_addr_freebsd.h index 5ce5f2f8a5ed..79b7231875ec 100644 --- a/sys/ofed/include/rdma/ib_addr_freebsd.h +++ b/sys/ofed/include/rdma/ib_addr_freebsd.h @@ -92,4 +92,19 @@ ip6_ifp_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id) } #endif +static inline struct ifnet * +dev_get_by_index(struct vnet *vnet, int if_index) +{ + struct epoch_tracker et; + struct ifnet *retval; + + NET_EPOCH_ENTER(et); + CURVNET_SET(vnet); + retval = ifnet_byindex_ref(if_index); + CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); + + return (retval); +} + #endif /* _RDMA_IB_ADDR_FREEBSD_H */ diff --git a/sys/ofed/include/rdma/ib_sa.h b/sys/ofed/include/rdma/ib_sa.h index 28e9a7887cab..beea96a02e1a 100644 --- a/sys/ofed/include/rdma/ib_sa.h +++ b/sys/ofed/include/rdma/ib_sa.h @@ -43,6 +43,7 @@ #include #include +#include #include #include From owner-dev-commits-src-main@freebsd.org Wed May 26 13:26: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 33E6963D91E; Wed, 26 May 2021 13:26: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 4FqsCb0xwQz3CNd; Wed, 26 May 2021 13:26: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 08541118EE; Wed, 26 May 2021 13:26: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 14QDQ2W1075488; Wed, 26 May 2021 13:26:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QDQ2bt075487; Wed, 26 May 2021 13:26:02 GMT (envelope-from git) Date: Wed, 26 May 2021 13:26:02 GMT Message-Id: <202105261326.14QDQ2bt075487@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: 3032c353882a - main - pf: Move nvlist conversion functions to pf_nv 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: 3032c353882aa70a461ef251b8aa6c59a0829ec5 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, 26 May 2021 13:26:03 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3032c353882aa70a461ef251b8aa6c59a0829ec5 commit 3032c353882aa70a461ef251b8aa6c59a0829ec5 Author: Kristof Provost AuthorDate: 2021-05-18 07:24:50 +0000 Commit: Kristof Provost CommitDate: 2021-05-26 11:18:47 +0000 pf: Move nvlist conversion functions to pf_nv Separate the conversion functions (between kernel structs and nvlists) to pf_nv. This reduces the size of pf_ioctl.c, which is already quite large and complex, a good bit. It also keeps all the fairly straightforward conversion code together. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30359 --- sys/netpfil/pf/pf_ioctl.c | 866 +--------------------------------------------- sys/netpfil/pf/pf_nv.c | 851 +++++++++++++++++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_nv.h | 42 ++- 3 files changed, 888 insertions(+), 871 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 5686a93f6e52..2d379d66486e 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -276,14 +276,6 @@ pflog_packet_t *pflog_packet_ptr = NULL; extern u_long pf_ioctl_maxcount; -#define ERROUT_FUNCTION(target, x) \ - do { \ - error = (x); \ - SDT_PROBE3(pf, ioctl, function, error, __func__, error, \ - __LINE__); \ - goto target; \ - } while (0) - static void pfattach_vnet(void) { @@ -1666,648 +1658,6 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) rule->u_src_nodes = counter_u64_fetch(krule->src_nodes); } -static int -pf_check_rule_addr(const struct pf_rule_addr *addr) -{ - - switch (addr->addr.type) { - case PF_ADDR_ADDRMASK: - case PF_ADDR_NOROUTE: - case PF_ADDR_DYNIFTL: - case PF_ADDR_TABLE: - case PF_ADDR_URPFFAILED: - case PF_ADDR_RANGE: - break; - default: - return (EINVAL); - } - - if (addr->addr.p.dyn != NULL) { - return (EINVAL); - } - - return (0); -} - -static int -pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *paddr) -{ - return (pf_nvbinary(nvl, "addr", paddr, sizeof(*paddr))); -} - -static nvlist_t * -pf_addr_to_nvaddr(const struct pf_addr *paddr) -{ - nvlist_t *nvl; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - nvlist_add_binary(nvl, "addr", paddr, sizeof(*paddr)); - - return (nvl); -} - -static int -pf_nvmape_to_mape(const nvlist_t *nvl, struct pf_mape_portset *mape) -{ - int error = 0; - - bzero(mape, sizeof(*mape)); - PFNV_CHK(pf_nvuint8(nvl, "offset", &mape->offset)); - PFNV_CHK(pf_nvuint8(nvl, "psidlen", &mape->psidlen)); - PFNV_CHK(pf_nvuint16(nvl, "psid", &mape->psid)); - -errout: - return (error); -} - -static nvlist_t * -pf_mape_to_nvmape(const struct pf_mape_portset *mape) -{ - nvlist_t *nvl; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - nvlist_add_number(nvl, "offset", mape->offset); - nvlist_add_number(nvl, "psidlen", mape->psidlen); - nvlist_add_number(nvl, "psid", mape->psid); - - return (nvl); -} - -static int -pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_kpool *kpool) -{ - int error = 0; - - bzero(kpool, sizeof(*kpool)); - - PFNV_CHK(pf_nvbinary(nvl, "key", &kpool->key, sizeof(kpool->key))); - - if (nvlist_exists_nvlist(nvl, "counter")) { - PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "counter"), - &kpool->counter)); - } - - PFNV_CHK(pf_nvint(nvl, "tblidx", &kpool->tblidx)); - PFNV_CHK(pf_nvuint16_array(nvl, "proxy_port", kpool->proxy_port, 2, - NULL)); - PFNV_CHK(pf_nvuint8(nvl, "opts", &kpool->opts)); - - if (nvlist_exists_nvlist(nvl, "mape")) { - PFNV_CHK(pf_nvmape_to_mape(nvlist_get_nvlist(nvl, "mape"), - &kpool->mape)); - } - -errout: - return (error); -} - -static nvlist_t * -pf_pool_to_nvpool(const struct pf_kpool *pool) -{ - nvlist_t *nvl; - nvlist_t *tmp; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); - tmp = pf_addr_to_nvaddr(&pool->counter); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "counter", tmp); - nvlist_destroy(tmp); - - nvlist_add_number(nvl, "tblidx", pool->tblidx); - pf_uint16_array_nv(nvl, "proxy_port", pool->proxy_port, 2); - nvlist_add_number(nvl, "opts", pool->opts); - - tmp = pf_mape_to_nvmape(&pool->mape); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "mape", tmp); - nvlist_destroy(tmp); - - return (nvl); - -error: - nvlist_destroy(nvl); - return (NULL); -} - -static int -pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) -{ - int error = 0; - - bzero(addr, sizeof(*addr)); - - PFNV_CHK(pf_nvuint8(nvl, "type", &addr->type)); - PFNV_CHK(pf_nvuint8(nvl, "iflags", &addr->iflags)); - if (addr->type == PF_ADDR_DYNIFTL) - PFNV_CHK(pf_nvstring(nvl, "ifname", addr->v.ifname, - sizeof(addr->v.ifname))); - if (addr->type == PF_ADDR_TABLE) - PFNV_CHK(pf_nvstring(nvl, "tblname", addr->v.tblname, - sizeof(addr->v.tblname))); - - if (! nvlist_exists_nvlist(nvl, "addr")) - return (EINVAL); - PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), - &addr->v.a.addr)); - - if (! nvlist_exists_nvlist(nvl, "mask")) - return (EINVAL); - PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), - &addr->v.a.mask)); - - switch (addr->type) { - case PF_ADDR_DYNIFTL: - case PF_ADDR_TABLE: - case PF_ADDR_RANGE: - case PF_ADDR_ADDRMASK: - case PF_ADDR_NOROUTE: - case PF_ADDR_URPFFAILED: - break; - default: - return (EINVAL); - } - -errout: - return (error); -} - -static nvlist_t * -pf_addr_wrap_to_nvaddr_wrap(const struct pf_addr_wrap *addr) -{ - nvlist_t *nvl; - nvlist_t *tmp; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - nvlist_add_number(nvl, "type", addr->type); - nvlist_add_number(nvl, "iflags", addr->iflags); - if (addr->type == PF_ADDR_DYNIFTL) - nvlist_add_string(nvl, "ifname", addr->v.ifname); - if (addr->type == PF_ADDR_TABLE) - nvlist_add_string(nvl, "tblname", addr->v.tblname); - - tmp = pf_addr_to_nvaddr(&addr->v.a.addr); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "addr", tmp); - nvlist_destroy(tmp); - tmp = pf_addr_to_nvaddr(&addr->v.a.mask); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "mask", tmp); - nvlist_destroy(tmp); - - return (nvl); - -error: - nvlist_destroy(nvl); - return (NULL); -} - -static int -pf_validate_op(uint8_t op) -{ - switch (op) { - case PF_OP_NONE: - case PF_OP_IRG: - case PF_OP_EQ: - case PF_OP_NE: - case PF_OP_LT: - case PF_OP_LE: - case PF_OP_GT: - case PF_OP_GE: - case PF_OP_XRG: - case PF_OP_RRG: - break; - default: - return (EINVAL); - } - - return (0); -} - -static int -pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) -{ - int error = 0; - - if (! nvlist_exists_nvlist(nvl, "addr")) - return (EINVAL); - - PFNV_CHK(pf_nvaddr_wrap_to_addr_wrap(nvlist_get_nvlist(nvl, "addr"), - &addr->addr)); - PFNV_CHK(pf_nvuint16_array(nvl, "port", addr->port, 2, NULL)); - PFNV_CHK(pf_nvuint8(nvl, "neg", &addr->neg)); - PFNV_CHK(pf_nvuint8(nvl, "port_op", &addr->port_op)); - - PFNV_CHK(pf_validate_op(addr->port_op)); - -errout: - return (error); -} - -static nvlist_t * -pf_rule_addr_to_nvrule_addr(const struct pf_rule_addr *addr) -{ - nvlist_t *nvl; - nvlist_t *tmp; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - tmp = pf_addr_wrap_to_nvaddr_wrap(&addr->addr); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "addr", tmp); - nvlist_destroy(tmp); - pf_uint16_array_nv(nvl, "port", addr->port, 2); - nvlist_add_number(nvl, "neg", addr->neg); - nvlist_add_number(nvl, "port_op", addr->port_op); - - return (nvl); - -error: - nvlist_destroy(nvl); - return (NULL); -} - -static int -pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) -{ - int error = 0; - - bzero(uid, sizeof(*uid)); - - PFNV_CHK(pf_nvuint32_array(nvl, "uid", uid->uid, 2, NULL)); - PFNV_CHK(pf_nvuint8(nvl, "op", &uid->op)); - - PFNV_CHK(pf_validate_op(uid->op)); - -errout: - return (error); -} - -static nvlist_t * -pf_rule_uid_to_nvrule_uid(const struct pf_rule_uid *uid) -{ - nvlist_t *nvl; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - pf_uint32_array_nv(nvl, "uid", uid->uid, 2); - nvlist_add_number(nvl, "op", uid->op); - - return (nvl); -} - -static int -pf_nvrule_gid_to_rule_gid(const nvlist_t *nvl, struct pf_rule_gid *gid) -{ - /* Cheat a little. These stucts are the same, other than the name of - * the first field. */ - return (pf_nvrule_uid_to_rule_uid(nvl, (struct pf_rule_uid *)gid)); -} - -static int -pf_nvrule_to_krule(const nvlist_t *nvl, struct pf_krule **prule) -{ - struct pf_krule *rule; - int error = 0; - -#define ERROUT(x) ERROUT_FUNCTION(errout, x) - - rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK | M_ZERO); - - PFNV_CHK(pf_nvuint32(nvl, "nr", &rule->nr)); - - if (! nvlist_exists_nvlist(nvl, "src")) - ERROUT(EINVAL); - - error = pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "src"), - &rule->src); - if (error != 0) - ERROUT(error); - - if (! nvlist_exists_nvlist(nvl, "dst")) - ERROUT(EINVAL); - - PFNV_CHK(pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), - &rule->dst)); - - if (nvlist_exists_string(nvl, "label")) { - PFNV_CHK(pf_nvstring(nvl, "label", rule->label[0], - sizeof(rule->label[0]))); - } else if (nvlist_exists_string_array(nvl, "labels")) { - const char *const *strs; - size_t items; - int ret; - - strs = nvlist_get_string_array(nvl, "labels", &items); - if (items > PF_RULE_MAX_LABEL_COUNT) - ERROUT(E2BIG); - - for (size_t i = 0; i < items; i++) { - ret = strlcpy(rule->label[i], strs[i], - sizeof(rule->label[0])); - if (ret >= sizeof(rule->label[0])) - ERROUT(E2BIG); - } - } - - PFNV_CHK(pf_nvstring(nvl, "ifname", rule->ifname, - sizeof(rule->ifname))); - PFNV_CHK(pf_nvstring(nvl, "qname", rule->qname, sizeof(rule->qname))); - PFNV_CHK(pf_nvstring(nvl, "pqname", rule->pqname, - sizeof(rule->pqname))); - PFNV_CHK(pf_nvstring(nvl, "tagname", rule->tagname, - sizeof(rule->tagname))); - PFNV_CHK(pf_nvstring(nvl, "match_tagname", rule->match_tagname, - sizeof(rule->match_tagname))); - PFNV_CHK(pf_nvstring(nvl, "overload_tblname", rule->overload_tblname, - sizeof(rule->overload_tblname))); - - if (! nvlist_exists_nvlist(nvl, "rpool")) - ERROUT(EINVAL); - PFNV_CHK(pf_nvpool_to_pool(nvlist_get_nvlist(nvl, "rpool"), - &rule->rpool)); - - PFNV_CHK(pf_nvuint32(nvl, "os_fingerprint", &rule->os_fingerprint)); - - PFNV_CHK(pf_nvint(nvl, "rtableid", &rule->rtableid)); - PFNV_CHK(pf_nvuint32_array(nvl, "timeout", rule->timeout, PFTM_MAX, NULL)); - PFNV_CHK(pf_nvuint32(nvl, "max_states", &rule->max_states)); - PFNV_CHK(pf_nvuint32(nvl, "max_src_nodes", &rule->max_src_nodes)); - PFNV_CHK(pf_nvuint32(nvl, "max_src_states", &rule->max_src_states)); - PFNV_CHK(pf_nvuint32(nvl, "max_src_conn", &rule->max_src_conn)); - PFNV_CHK(pf_nvuint32(nvl, "max_src_conn_rate.limit", - &rule->max_src_conn_rate.limit)); - PFNV_CHK(pf_nvuint32(nvl, "max_src_conn_rate.seconds", - &rule->max_src_conn_rate.seconds)); - PFNV_CHK(pf_nvuint32(nvl, "prob", &rule->prob)); - PFNV_CHK(pf_nvuint32(nvl, "cuid", &rule->cuid)); - PFNV_CHK(pf_nvuint32(nvl, "cpid", &rule->cpid)); - - PFNV_CHK(pf_nvuint16(nvl, "return_icmp", &rule->return_icmp)); - PFNV_CHK(pf_nvuint16(nvl, "return_icmp6", &rule->return_icmp6)); - - PFNV_CHK(pf_nvuint16(nvl, "max_mss", &rule->max_mss)); - PFNV_CHK(pf_nvuint16(nvl, "scrub_flags", &rule->scrub_flags)); - - if (! nvlist_exists_nvlist(nvl, "uid")) - ERROUT(EINVAL); - PFNV_CHK(pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "uid"), - &rule->uid)); - - if (! nvlist_exists_nvlist(nvl, "gid")) - ERROUT(EINVAL); - PFNV_CHK(pf_nvrule_gid_to_rule_gid(nvlist_get_nvlist(nvl, "gid"), - &rule->gid)); - - PFNV_CHK(pf_nvuint32(nvl, "rule_flag", &rule->rule_flag)); - PFNV_CHK(pf_nvuint8(nvl, "action", &rule->action)); - PFNV_CHK(pf_nvuint8(nvl, "direction", &rule->direction)); - PFNV_CHK(pf_nvuint8(nvl, "log", &rule->log)); - PFNV_CHK(pf_nvuint8(nvl, "logif", &rule->logif)); - PFNV_CHK(pf_nvuint8(nvl, "quick", &rule->quick)); - PFNV_CHK(pf_nvuint8(nvl, "ifnot", &rule->ifnot)); - PFNV_CHK(pf_nvuint8(nvl, "match_tag_not", &rule->match_tag_not)); - PFNV_CHK(pf_nvuint8(nvl, "natpass", &rule->natpass)); - - PFNV_CHK(pf_nvuint8(nvl, "keep_state", &rule->keep_state)); - PFNV_CHK(pf_nvuint8(nvl, "af", &rule->af)); - PFNV_CHK(pf_nvuint8(nvl, "proto", &rule->proto)); - PFNV_CHK(pf_nvuint8(nvl, "type", &rule->type)); - PFNV_CHK(pf_nvuint8(nvl, "code", &rule->code)); - PFNV_CHK(pf_nvuint8(nvl, "flags", &rule->flags)); - PFNV_CHK(pf_nvuint8(nvl, "flagset", &rule->flagset)); - PFNV_CHK(pf_nvuint8(nvl, "min_ttl", &rule->min_ttl)); - PFNV_CHK(pf_nvuint8(nvl, "allow_opts", &rule->allow_opts)); - PFNV_CHK(pf_nvuint8(nvl, "rt", &rule->rt)); - PFNV_CHK(pf_nvuint8(nvl, "return_ttl", &rule->return_ttl)); - PFNV_CHK(pf_nvuint8(nvl, "tos", &rule->tos)); - PFNV_CHK(pf_nvuint8(nvl, "set_tos", &rule->set_tos)); - PFNV_CHK(pf_nvuint8(nvl, "anchor_relative", &rule->anchor_relative)); - PFNV_CHK(pf_nvuint8(nvl, "anchor_wildcard", &rule->anchor_wildcard)); - - PFNV_CHK(pf_nvuint8(nvl, "flush", &rule->flush)); - PFNV_CHK(pf_nvuint8(nvl, "prio", &rule->prio)); - - PFNV_CHK(pf_nvuint8_array(nvl, "set_prio", &rule->prio, 2, NULL)); - - if (nvlist_exists_nvlist(nvl, "divert")) { - const nvlist_t *nvldivert = nvlist_get_nvlist(nvl, "divert"); - - if (! nvlist_exists_nvlist(nvldivert, "addr")) - ERROUT(EINVAL); - PFNV_CHK(pf_nvaddr_to_addr(nvlist_get_nvlist(nvldivert, "addr"), - &rule->divert.addr)); - PFNV_CHK(pf_nvuint16(nvldivert, "port", &rule->divert.port)); - } - - /* Validation */ -#ifndef INET - if (rule->af == AF_INET) - ERROUT(EAFNOSUPPORT); -#endif /* INET */ -#ifndef INET6 - if (rule->af == AF_INET6) - ERROUT(EAFNOSUPPORT); -#endif /* INET6 */ - - PFNV_CHK(pf_check_rule_addr(&rule->src)); - PFNV_CHK(pf_check_rule_addr(&rule->dst)); - - *prule = rule; - - return (0); - -#undef ERROUT -errout: - pf_krule_free(rule); - *prule = NULL; - - return (error); -} - -static nvlist_t * -pf_divert_to_nvdivert(const struct pf_krule *rule) -{ - nvlist_t *nvl; - nvlist_t *tmp; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - tmp = pf_addr_to_nvaddr(&rule->divert.addr); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "addr", tmp); - nvlist_destroy(tmp); - nvlist_add_number(nvl, "port", rule->divert.port); - - return (nvl); - -error: - nvlist_destroy(nvl); - return (NULL); -} - -static nvlist_t * -pf_krule_to_nvrule(const struct pf_krule *rule) -{ - nvlist_t *nvl, *tmp; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (nvl); - - nvlist_add_number(nvl, "nr", rule->nr); - tmp = pf_rule_addr_to_nvrule_addr(&rule->src); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "src", tmp); - nvlist_destroy(tmp); - tmp = pf_rule_addr_to_nvrule_addr(&rule->dst); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "dst", tmp); - nvlist_destroy(tmp); - - for (int i = 0; i < PF_SKIP_COUNT; i++) { - nvlist_append_number_array(nvl, "skip", - rule->skip[i].ptr ? rule->skip[i].ptr->nr : -1); - } - - for (int i = 0; i < PF_RULE_MAX_LABEL_COUNT; i++) { - nvlist_append_string_array(nvl, "labels", rule->label[i]); - } - nvlist_add_string(nvl, "label", rule->label[0]); - nvlist_add_string(nvl, "ifname", rule->ifname); - nvlist_add_string(nvl, "qname", rule->qname); - nvlist_add_string(nvl, "pqname", rule->pqname); - nvlist_add_string(nvl, "tagname", rule->tagname); - nvlist_add_string(nvl, "match_tagname", rule->match_tagname); - nvlist_add_string(nvl, "overload_tblname", rule->overload_tblname); - - tmp = pf_pool_to_nvpool(&rule->rpool); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "rpool", tmp); - nvlist_destroy(tmp); - - nvlist_add_number(nvl, "evaluations", - counter_u64_fetch(rule->evaluations)); - for (int i = 0; i < 2; i++) { - nvlist_append_number_array(nvl, "packets", - counter_u64_fetch(rule->packets[i])); - nvlist_append_number_array(nvl, "bytes", - counter_u64_fetch(rule->bytes[i])); - } - - nvlist_add_number(nvl, "os_fingerprint", rule->os_fingerprint); - - nvlist_add_number(nvl, "rtableid", rule->rtableid); - pf_uint32_array_nv(nvl, "timeout", rule->timeout, PFTM_MAX); - nvlist_add_number(nvl, "max_states", rule->max_states); - nvlist_add_number(nvl, "max_src_nodes", rule->max_src_nodes); - nvlist_add_number(nvl, "max_src_states", rule->max_src_states); - nvlist_add_number(nvl, "max_src_conn", rule->max_src_conn); - nvlist_add_number(nvl, "max_src_conn_rate.limit", - rule->max_src_conn_rate.limit); - nvlist_add_number(nvl, "max_src_conn_rate.seconds", - rule->max_src_conn_rate.seconds); - nvlist_add_number(nvl, "qid", rule->qid); - nvlist_add_number(nvl, "pqid", rule->pqid); - nvlist_add_number(nvl, "prob", rule->prob); - nvlist_add_number(nvl, "cuid", rule->cuid); - nvlist_add_number(nvl, "cpid", rule->cpid); - - nvlist_add_number(nvl, "states_cur", - counter_u64_fetch(rule->states_cur)); - nvlist_add_number(nvl, "states_tot", - counter_u64_fetch(rule->states_tot)); - nvlist_add_number(nvl, "src_nodes", - counter_u64_fetch(rule->src_nodes)); - - nvlist_add_number(nvl, "return_icmp", rule->return_icmp); - nvlist_add_number(nvl, "return_icmp6", rule->return_icmp6); - - nvlist_add_number(nvl, "max_mss", rule->max_mss); - nvlist_add_number(nvl, "scrub_flags", rule->scrub_flags); - - tmp = pf_rule_uid_to_nvrule_uid(&rule->uid); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "uid", tmp); - nvlist_destroy(tmp); - tmp = pf_rule_uid_to_nvrule_uid((const struct pf_rule_uid *)&rule->gid); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "gid", tmp); - nvlist_destroy(tmp); - - nvlist_add_number(nvl, "rule_flag", rule->rule_flag); - nvlist_add_number(nvl, "action", rule->action); - nvlist_add_number(nvl, "direction", rule->direction); - nvlist_add_number(nvl, "log", rule->log); - nvlist_add_number(nvl, "logif", rule->logif); - nvlist_add_number(nvl, "quick", rule->quick); - nvlist_add_number(nvl, "ifnot", rule->ifnot); - nvlist_add_number(nvl, "match_tag_not", rule->match_tag_not); - nvlist_add_number(nvl, "natpass", rule->natpass); - - nvlist_add_number(nvl, "keep_state", rule->keep_state); - nvlist_add_number(nvl, "af", rule->af); - nvlist_add_number(nvl, "proto", rule->proto); - nvlist_add_number(nvl, "type", rule->type); - nvlist_add_number(nvl, "code", rule->code); - nvlist_add_number(nvl, "flags", rule->flags); - nvlist_add_number(nvl, "flagset", rule->flagset); - nvlist_add_number(nvl, "min_ttl", rule->min_ttl); - nvlist_add_number(nvl, "allow_opts", rule->allow_opts); - nvlist_add_number(nvl, "rt", rule->rt); - nvlist_add_number(nvl, "return_ttl", rule->return_ttl); - nvlist_add_number(nvl, "tos", rule->tos); - nvlist_add_number(nvl, "set_tos", rule->set_tos); - nvlist_add_number(nvl, "anchor_relative", rule->anchor_relative); - nvlist_add_number(nvl, "anchor_wildcard", rule->anchor_wildcard); - - nvlist_add_number(nvl, "flush", rule->flush); - nvlist_add_number(nvl, "prio", rule->prio); - - pf_uint8_array_nv(nvl, "set_prio", &rule->prio, 2); - - tmp = pf_divert_to_nvdivert(rule); - if (tmp == NULL) - goto error; - nvlist_add_nvlist(nvl, "divert", tmp); - nvlist_destroy(tmp); - - return (nvl); - -error: - nvlist_destroy(nvl); - return (NULL); -} - static int pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) { @@ -2433,219 +1783,6 @@ pf_state_kill_to_kstate_kill(const struct pfioc_state_kill *psk, return (0); } -static int -pf_nvstate_cmp_to_state_cmp(const nvlist_t *nvl, struct pf_state_cmp *cmp) -{ - int error = 0; - - bzero(cmp, sizeof(*cmp)); - - PFNV_CHK(pf_nvuint64(nvl, "id", &cmp->id)); - PFNV_CHK(pf_nvuint32(nvl, "creatorid", &cmp->creatorid)); - PFNV_CHK(pf_nvuint8(nvl, "direction", &cmp->direction)); - -errout: - return (error); -} - -static int -pf_nvstate_kill_to_kstate_kill(const nvlist_t *nvl, - struct pf_kstate_kill *kill) -{ - int error = 0; - - bzero(kill, sizeof(*kill)); - - if (! nvlist_exists_nvlist(nvl, "cmp")) - return (EINVAL); - - PFNV_CHK(pf_nvstate_cmp_to_state_cmp(nvlist_get_nvlist(nvl, "cmp"), - &kill->psk_pfcmp)); - PFNV_CHK(pf_nvuint8(nvl, "af", &kill->psk_af)); - PFNV_CHK(pf_nvint(nvl, "proto", &kill->psk_proto)); - - if (! nvlist_exists_nvlist(nvl, "src")) - return (EINVAL); - PFNV_CHK(pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "src"), - &kill->psk_src)); - if (! nvlist_exists_nvlist(nvl, "dst")) - return (EINVAL); - PFNV_CHK(pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), - &kill->psk_dst)); - if (nvlist_exists_nvlist(nvl, "rt_addr")) { - PFNV_CHK(pf_nvrule_addr_to_rule_addr( - nvlist_get_nvlist(nvl, "rt_addr"), &kill->psk_rt_addr)); - } - - PFNV_CHK(pf_nvstring(nvl, "ifname", kill->psk_ifname, - sizeof(kill->psk_ifname))); - PFNV_CHK(pf_nvstring(nvl, "label", kill->psk_label, - sizeof(kill->psk_label))); - if (nvlist_exists_bool(nvl, "kill_match")) - kill->psk_kill_match = nvlist_get_bool(nvl, "kill_match"); - -errout: - return (error); -} - -static nvlist_t * -pf_state_key_to_nvstate_key(const struct pf_state_key *key) -{ - nvlist_t *nvl, *tmp; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - for (int i = 0; i < 2; i++) { - tmp = pf_addr_to_nvaddr(&key->addr[i]); - if (tmp == NULL) - goto errout; - nvlist_append_nvlist_array(nvl, "addr", tmp); - nvlist_append_number_array(nvl, "port", key->port[i]); - } - nvlist_add_number(nvl, "af", key->af); - nvlist_add_number(nvl, "proto", key->proto); - - return (nvl); - -errout: - nvlist_destroy(nvl); - return (NULL); -} - -static nvlist_t * -pf_state_scrub_to_nvstate_scrub(const struct pf_state_scrub *scrub) -{ - nvlist_t *nvl; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - nvlist_add_bool(nvl, "timestamp", scrub->pfss_flags & PFSS_TIMESTAMP); - nvlist_add_number(nvl, "ttl", scrub->pfss_ttl); - nvlist_add_number(nvl, "ts_mod", scrub->pfss_ts_mod); - - return (nvl); -} - -static nvlist_t * -pf_state_peer_to_nvstate_peer(const struct pf_state_peer *peer) -{ - nvlist_t *nvl, *tmp; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - if (peer->scrub) { - tmp = pf_state_scrub_to_nvstate_scrub(peer->scrub); - if (tmp == NULL) - goto errout; - nvlist_add_nvlist(nvl, "scrub", tmp); - nvlist_destroy(tmp); - } - - nvlist_add_number(nvl, "seqlo", peer->seqlo); - nvlist_add_number(nvl, "seqhi", peer->seqhi); - nvlist_add_number(nvl, "seqdiff", peer->seqdiff); - nvlist_add_number(nvl, "max_win", peer->max_win); - nvlist_add_number(nvl, "mss", peer->mss); - nvlist_add_number(nvl, "state", peer->state); - nvlist_add_number(nvl, "wscale", peer->wscale); - - return (nvl); - -errout: - nvlist_destroy(nvl); - return (NULL); -} - - -static nvlist_t * -pf_state_to_nvstate(const struct pf_state *s) -{ - nvlist_t *nvl, *tmp; - uint32_t expire, flags = 0; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - nvlist_add_number(nvl, "id", s->id); - nvlist_add_string(nvl, "ifname", s->kif->pfik_name); - nvlist_add_string(nvl, "orig_ifname", s->orig_kif->pfik_name); - - tmp = pf_state_key_to_nvstate_key(s->key[PF_SK_STACK]); - if (tmp == NULL) - goto errout; - nvlist_add_nvlist(nvl, "stack_key", tmp); - nvlist_destroy(tmp); - - tmp = pf_state_key_to_nvstate_key(s->key[PF_SK_WIRE]); - if (tmp == NULL) - goto errout; - nvlist_add_nvlist(nvl, "wire_key", tmp); - nvlist_destroy(tmp); - - tmp = pf_state_peer_to_nvstate_peer(&s->src); - if (tmp == NULL) - goto errout; - nvlist_add_nvlist(nvl, "src", tmp); - nvlist_destroy(tmp); - - tmp = pf_state_peer_to_nvstate_peer(&s->dst); - if (tmp == NULL) - goto errout; - nvlist_add_nvlist(nvl, "dst", tmp); - nvlist_destroy(tmp); - - tmp = pf_addr_to_nvaddr(&s->rt_addr); - if (tmp == NULL) - goto errout; - nvlist_add_nvlist(nvl, "rt_addr", tmp); - nvlist_destroy(tmp); - - nvlist_add_number(nvl, "rule", s->rule.ptr ? s->rule.ptr->nr : -1); - nvlist_add_number(nvl, "anchor", - s->anchor.ptr ? s->anchor.ptr->nr : -1); - nvlist_add_number(nvl, "nat_rule", - s->nat_rule.ptr ? s->nat_rule.ptr->nr : -1); - nvlist_add_number(nvl, "creation", s->creation); - - expire = pf_state_expires(s); - if (expire <= time_uptime) - expire = 0; - else - expire = expire - time_uptime; - nvlist_add_number(nvl, "expire", expire); - - for (int i = 0; i < 2; i++) { - nvlist_append_number_array(nvl, "packets", - counter_u64_fetch(s->packets[i])); - nvlist_append_number_array(nvl, "bytes", - counter_u64_fetch(s->bytes[i])); - } - - nvlist_add_number(nvl, "creatorid", s->creatorid); - nvlist_add_number(nvl, "direction", s->direction); - nvlist_add_number(nvl, "log", s->log); - nvlist_add_number(nvl, "state_flags", s->state_flags); - nvlist_add_number(nvl, "timeout", s->timeout); - if (s->src_node) - flags |= PFSYNC_FLAG_SRCNODE; - if (s->nat_src_node) - flags |= PFSYNC_FLAG_NATSRCNODE; - nvlist_add_number(nvl, "sync_flags", flags); - - return (nvl); - -errout: - nvlist_destroy(nvl); - return (NULL); -} - static int pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, uint32_t pool_ticket, const char *anchor, const char *anchor_call, @@ -3139,8 +2276,9 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td if (! nvlist_exists_nvlist(nvl, "rule")) ERROUT(EINVAL); + rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK | M_ZERO); error = pf_nvrule_to_krule(nvlist_get_nvlist(nvl, "rule"), - &rule); + rule); if (error) ERROUT(error); diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 1fdb52e5fad0..863259dbf9aa 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -28,9 +28,13 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet.h" +#include "opt_inet6.h" + #include #include #include +#include #include #include @@ -137,3 +141,850 @@ pf_nvstring(const nvlist_t *nvl, const char *name, char *str, size_t maxlen) return (0); } + +static int +pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *paddr) +{ + return (pf_nvbinary(nvl, "addr", paddr, sizeof(*paddr))); +} + +static nvlist_t * +pf_addr_to_nvaddr(const struct pf_addr *paddr) +{ + nvlist_t *nvl; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (NULL); + + nvlist_add_binary(nvl, "addr", paddr, sizeof(*paddr)); + + return (nvl); +} + +static int +pf_nvmape_to_mape(const nvlist_t *nvl, struct pf_mape_portset *mape) +{ + int error = 0; + + bzero(mape, sizeof(*mape)); + PFNV_CHK(pf_nvuint8(nvl, "offset", &mape->offset)); + PFNV_CHK(pf_nvuint8(nvl, "psidlen", &mape->psidlen)); + PFNV_CHK(pf_nvuint16(nvl, "psid", &mape->psid)); + +errout: + return (error); +} + +static nvlist_t * +pf_mape_to_nvmape(const struct pf_mape_portset *mape) +{ + nvlist_t *nvl; + *** 867 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed May 26 13:26: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 7D5F963DA90; Wed, 26 May 2021 13:26: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 4FqsCc251Pz3Chk; Wed, 26 May 2021 13:26: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 233A511C10; Wed, 26 May 2021 13:26: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 14QDQ4FV075509; Wed, 26 May 2021 13:26:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QDQ4iV075508; Wed, 26 May 2021 13:26:04 GMT (envelope-from git) Date: Wed, 26 May 2021 13:26:04 GMT Message-Id: <202105261326.14QDQ4iV075508@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: 9d0bc96ef8c0 - main - pf tests: Only log critical errors from scapy 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: 9d0bc96ef8c0288c05a627b3961edd2da046c5c9 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, 26 May 2021 13:26:04 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9d0bc96ef8c0288c05a627b3961edd2da046c5c9 commit 9d0bc96ef8c0288c05a627b3961edd2da046c5c9 Author: Kristof Provost AuthorDate: 2021-05-26 11:07:50 +0000 Commit: Kristof Provost CommitDate: 2021-05-26 11:18:47 +0000 pf tests: Only log critical errors from scapy See a26e895f3d803cc1f4ee1c2b33c61330998808b9. Silence these new tests as well. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/fragcommon.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/sys/netpfil/pf/fragcommon.py b/tests/sys/netpfil/pf/fragcommon.py index 2bcd3989b420..1ca3129e6057 100644 --- a/tests/sys/netpfil/pf/fragcommon.py +++ b/tests/sys/netpfil/pf/fragcommon.py @@ -27,6 +27,8 @@ import argparse import os +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys import time From owner-dev-commits-src-main@freebsd.org Wed May 26 13:39: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 0A83763DDD8; Wed, 26 May 2021 13:39: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 4FqsWf6vbYz3DD9; Wed, 26 May 2021 13:39: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 D521911AF8; Wed, 26 May 2021 13:39: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 14QDdwG3089676; Wed, 26 May 2021 13:39:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QDdwQ5089675; Wed, 26 May 2021 13:39:58 GMT (envelope-from git) Date: Wed, 26 May 2021 13:39:58 GMT Message-Id: <202105261339.14QDdwQ5089675@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: 4c599db71af5 - main - vmm: Let guests enable SMEP/SMAP if the host supports it 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: 4c599db71af56c28bb0388e73bd0570a3873c0ec 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, 26 May 2021 13:39:59 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4c599db71af56c28bb0388e73bd0570a3873c0ec commit 4c599db71af56c28bb0388e73bd0570a3873c0ec Author: Mark Johnston AuthorDate: 2021-05-26 13:34:52 +0000 Commit: Mark Johnston CommitDate: 2021-05-26 13:34:52 +0000 vmm: Let guests enable SMEP/SMAP if the host supports it Reviewed by: kib, grehan, jhb Tested by: grehan (AMD) MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30462 --- sys/amd64/vmm/x86.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c index a4a9c8203fc5..c43a3c870211 100644 --- a/sys/amd64/vmm/x86.c +++ b/sys/amd64/vmm/x86.c @@ -441,10 +441,12 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, uint64_t *rax, uint64_t *rbx, */ regs[1] &= (CPUID_STDEXT_FSGSBASE | CPUID_STDEXT_BMI1 | CPUID_STDEXT_HLE | - CPUID_STDEXT_AVX2 | CPUID_STDEXT_BMI2 | + CPUID_STDEXT_AVX2 | CPUID_STDEXT_SMEP | + CPUID_STDEXT_BMI2 | CPUID_STDEXT_ERMS | CPUID_STDEXT_RTM | CPUID_STDEXT_AVX512F | CPUID_STDEXT_RDSEED | + CPUID_STDEXT_SMAP | CPUID_STDEXT_AVX512PF | CPUID_STDEXT_AVX512ER | CPUID_STDEXT_AVX512CD | CPUID_STDEXT_SHA); From owner-dev-commits-src-main@freebsd.org Wed May 26 14:03: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 EC33463E328; Wed, 26 May 2021 14:03: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 4Fqt385zzTz3GMZ; Wed, 26 May 2021 14:03: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 B53F512397; Wed, 26 May 2021 14:03: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 14QE3ms4029628; Wed, 26 May 2021 14:03:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QE3mLC029627; Wed, 26 May 2021 14:03:48 GMT (envelope-from git) Date: Wed, 26 May 2021 14:03:48 GMT Message-Id: <202105261403.14QE3mLC029627@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: df8437a93dd5 - main - cxgbe: fix enabling lro & rxtimestamps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df8437a93dd5268e5bfd06411c01a5cbdb38c6ac 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, 26 May 2021 14:03:49 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=df8437a93dd5268e5bfd06411c01a5cbdb38c6ac commit df8437a93dd5268e5bfd06411c01a5cbdb38c6ac Author: Andrew Gallatin AuthorDate: 2021-05-26 13:54:26 +0000 Commit: Andrew Gallatin CommitDate: 2021-05-26 14:00:07 +0000 cxgbe: fix enabling lro & rxtimestamps A recent change caused iq flags, like LRO, to be set before init_iq(). However, init_iq() clears those flags, so they became effectively impossible to set. This change moves the initializion of these flags to after the call to init_iq(). This fixes LRO. Differential Revision: https://reviews.freebsd.org/D30460 Reviewed by: np, rrs Sponsored by: Netflix Fixes: 43bbae19483fbde0a91e61acad8a6e71e334c8b8 " --- sys/dev/cxgbe/t4_sge.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 4b685129193e..0b429c602a91 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -3938,12 +3938,7 @@ alloc_rxq(struct vi_info *vi, struct sge_rxq *rxq, int idx, int intr_idx, if (rc != 0) return (rc); MPASS(rxq->lro.ifp == ifp); /* also indicates LRO init'ed */ - - if (ifp->if_capenable & IFCAP_LRO) - rxq->iq.flags |= IQ_LRO_ENABLED; #endif - if (ifp->if_capenable & IFCAP_HWRXTSTMP) - rxq->iq.flags |= IQ_RX_TIMESTAMP; rxq->ifp = ifp; snprintf(name, sizeof(name), "%d", idx); @@ -3953,6 +3948,12 @@ alloc_rxq(struct vi_info *vi, struct sge_rxq *rxq, int idx, int intr_idx, init_iq(&rxq->iq, sc, vi->tmr_idx, vi->pktc_idx, vi->qsize_rxq, intr_idx, tnl_cong(vi->pi, cong_drop)); +#if defined(INET) || defined(INET6) + if (ifp->if_capenable & IFCAP_LRO) + rxq->iq.flags |= IQ_LRO_ENABLED; +#endif + if (ifp->if_capenable & IFCAP_HWRXTSTMP) + rxq->iq.flags |= IQ_RX_TIMESTAMP; snprintf(name, sizeof(name), "%s rxq%d-fl", device_get_nameunit(vi->dev), idx); init_fl(sc, &rxq->fl, vi->qsize_rxq / 8, maxp, name); From owner-dev-commits-src-main@freebsd.org Wed May 26 14:12: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 26C8763E3DE; Wed, 26 May 2021 14:12: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 4FqtFQ0X8Xz3HNt; Wed, 26 May 2021 14:12: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 EF456120DE; Wed, 26 May 2021 14:12: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 14QECfdE042703; Wed, 26 May 2021 14:12:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QECfax042702; Wed, 26 May 2021 14:12:41 GMT (envelope-from git) Date: Wed, 26 May 2021 14:12:41 GMT Message-Id: <202105261412.14QECfax042702@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: 3f2508b7f385 - main - elfctl: avoid touching file if no change made 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: 3f2508b7f3855102abed99b846e30e728ba3d04d 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, 26 May 2021 14:12:42 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3f2508b7f3855102abed99b846e30e728ba3d04d commit 3f2508b7f3855102abed99b846e30e728ba3d04d Author: Ed Maste AuthorDate: 2021-05-25 18:25:18 +0000 Commit: Ed Maste CommitDate: 2021-05-26 14:12:12 +0000 elfctl: avoid touching file if no change made Suggested by: brooks Reviewed by: brooks, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30452 --- usr.bin/elfctl/elfctl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c index 41660fc4acd5..ef7f915ded30 100644 --- a/usr.bin/elfctl/elfctl.c +++ b/usr.bin/elfctl/elfctl.c @@ -291,7 +291,7 @@ convert_to_feature_val(char *feature_str, uint32_t *feature_val) static bool edit_file_features(Elf *elf, int phcount, int fd, char *val, bool endian_swap) { - uint32_t features; + uint32_t features, prev_features; uint64_t off; if (!get_file_features(elf, phcount, fd, &features, &off, @@ -300,8 +300,12 @@ edit_file_features(Elf *elf, int phcount, int fd, char *val, bool endian_swap) return (false); } + prev_features = features; if (!convert_to_feature_val(val, &features)) return (false); + /* Avoid touching file if no change. */ + if (features == prev_features) + return (true); if (endian_swap) features = bswap32(features); From owner-dev-commits-src-main@freebsd.org Wed May 26 14:16: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 8969D63E798; Wed, 26 May 2021 14:16: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 4FqtLB32MCz3HVX; Wed, 26 May 2021 14:16: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 500FC12532; Wed, 26 May 2021 14:16: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 14QEGoEg043149; Wed, 26 May 2021 14:16:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QEGogC043148; Wed, 26 May 2021 14:16:50 GMT (envelope-from git) Date: Wed, 26 May 2021 14:16:50 GMT Message-Id: <202105261416.14QEGogC043148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: f1462ab0512c - main - tests/libalias: Factor out common primitives MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f1462ab0512c1a0e59f03a7a145df2889bed2997 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, 26 May 2021 14:16:50 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=f1462ab0512c1a0e59f03a7a145df2889bed2997 commit f1462ab0512c1a0e59f03a7a145df2889bed2997 Author: Lutz Donnerhacke AuthorDate: 2021-05-24 12:43:01 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-26 14:16:07 +0000 tests/libalias: Factor out common primitives Rework the tests to check the correct layer in a single test. Factor out tests for reuse in other modules. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30412 --- tests/sys/netinet/libalias/2_natout.c | 200 +++++++++------------------------- tests/sys/netinet/libalias/perf.c | 11 +- tests/sys/netinet/libalias/util.c | 14 ++- tests/sys/netinet/libalias/util.h | 77 ++++++++++++- 4 files changed, 144 insertions(+), 158 deletions(-) diff --git a/tests/sys/netinet/libalias/2_natout.c b/tests/sys/netinet/libalias/2_natout.c index 5b3e9a906bf5..2b6da8f597ed 100644 --- a/tests/sys/netinet/libalias/2_natout.c +++ b/tests/sys/netinet/libalias/2_natout.c @@ -38,63 +38,6 @@ #include "util.h" -/* common ip ranges */ -static struct in_addr masq = { htonl(0x01020304) }; -static struct in_addr pub = { htonl(0x0102dead) }; -static struct in_addr prv1 = { htonl(0x0a00dead) }; -static struct in_addr prv2 = { htonl(0xac10dead) }; -static struct in_addr prv3 = { htonl(0xc0a8dead) }; -static struct in_addr cgn = { htonl(0x6440dead) }; -static struct in_addr ext = { htonl(0x12345678) }; - -#define NAT_CHECK(pip, src, msq) do { \ - int res; \ - int len = ntohs(pip->ip_len); \ - struct in_addr dst = pip->ip_dst; \ - pip->ip_src = src; \ - res = LibAliasOut(la, pip, len); \ - ATF_CHECK_MSG(res == PKT_ALIAS_OK, \ - ">%d< not met PKT_ALIAS_OK", res); \ - ATF_CHECK(addr_eq(msq, pip->ip_src)); \ - ATF_CHECK(addr_eq(dst, pip->ip_dst)); \ -} while(0) - -#define NAT_FAIL(pip, src, dst) do { \ - int res; \ - int len = ntohs(pip->ip_len); \ - pip->ip_src = src; \ - pip->ip_dst = dst; \ - res = LibAliasOut(la, pip, len); \ - ATF_CHECK_MSG(res != PKT_ALIAS_OK), \ - ">%d< not met !PKT_ALIAS_OK", res); \ - ATF_CHECK(addr_eq(src, pip->ip_src)); \ - ATF_CHECK(addr_eq(dst, pip->ip_dst)); \ -} while(0) - -#define UNNAT_CHECK(pip, src, dst, rel) do { \ - int res; \ - int len = ntohs(pip->ip_len); \ - pip->ip_src = src; \ - pip->ip_dst = dst; \ - res = LibAliasIn(la, pip, len); \ - ATF_CHECK_MSG(res == PKT_ALIAS_OK, \ - ">%d< not met PKT_ALIAS_OK", res); \ - ATF_CHECK(addr_eq(src, pip->ip_src)); \ - ATF_CHECK(addr_eq(rel, pip->ip_dst)); \ -} while(0) - -#define UNNAT_FAIL(pip, src, dst) do { \ - int res; \ - int len = ntohs(pip->ip_len); \ - pip->ip_src = src; \ - pip->ip_dst = dst; \ - res = LibAliasIn(la, pip, len); \ - ATF_CHECK_MSG(res != PKT_ALIAS_OK, \ - ">%d< not met !PKT_ALIAS_OK", res); \ - ATF_CHECK(addr_eq(src, pip->ip_src)); \ - ATF_CHECK(addr_eq(dst, pip->ip_dst)); \ -} while(0) - ATF_TC_WITHOUT_HEAD(1_simplemasq); ATF_TC_BODY(1_simplemasq, dummy) { @@ -105,12 +48,12 @@ ATF_TC_BODY(1_simplemasq, dummy) LibAliasSetAddress(la, masq); LibAliasSetMode(la, 0, ~0); - pip = ip_packet(prv1, ext, 254, 64); - NAT_CHECK(pip, prv1, masq); - NAT_CHECK(pip, prv2, masq); - NAT_CHECK(pip, prv3, masq); - NAT_CHECK(pip, cgn, masq); - NAT_CHECK(pip, pub, masq); + pip = ip_packet(254, 64); + NAT_CHECK(pip, prv1, ext, masq); + NAT_CHECK(pip, prv2, ext, masq); + NAT_CHECK(pip, prv3, ext, masq); + NAT_CHECK(pip, cgn, ext, masq); + NAT_CHECK(pip, pub, ext, masq); free(pip); LibAliasUninit(la); @@ -126,12 +69,12 @@ ATF_TC_BODY(2_unregistered, dummy) LibAliasSetAddress(la, masq); LibAliasSetMode(la, PKT_ALIAS_UNREGISTERED_ONLY, ~0); - pip = ip_packet(prv1, ext, 254, 64); - NAT_CHECK(pip, prv1, masq); - NAT_CHECK(pip, prv2, masq); - NAT_CHECK(pip, prv3, masq); - NAT_CHECK(pip, cgn, cgn); - NAT_CHECK(pip, pub, pub); + pip = ip_packet(254, 64); + NAT_CHECK(pip, prv1, ext, masq); + NAT_CHECK(pip, prv2, ext, masq); + NAT_CHECK(pip, prv3, ext, masq); + NAT_CHECK(pip, cgn, ext, cgn); + NAT_CHECK(pip, pub, ext, pub); /* * State is only for new connections @@ -139,11 +82,11 @@ ATF_TC_BODY(2_unregistered, dummy) * the mode setting should be ignored */ LibAliasSetMode(la, 0, PKT_ALIAS_UNREGISTERED_ONLY); - NAT_CHECK(pip, prv1, masq); - NAT_CHECK(pip, prv2, masq); - NAT_CHECK(pip, prv3, masq); - NAT_CHECK(pip, cgn, cgn); - NAT_CHECK(pip, pub, pub); + NAT_CHECK(pip, prv1, ext, masq); + NAT_CHECK(pip, prv2, ext, masq); + NAT_CHECK(pip, prv3, ext, masq); + NAT_CHECK(pip, cgn, ext, cgn); + NAT_CHECK(pip, pub, ext, pub); free(pip); LibAliasUninit(la); @@ -159,12 +102,12 @@ ATF_TC_BODY(3_cgn, dummy) LibAliasSetAddress(la, masq); LibAliasSetMode(la, PKT_ALIAS_UNREGISTERED_CGN, ~0); - pip = ip_packet(prv1, ext, 254, 64); - NAT_CHECK(pip, prv1, masq); - NAT_CHECK(pip, prv2, masq); - NAT_CHECK(pip, prv3, masq); - NAT_CHECK(pip, cgn, masq); - NAT_CHECK(pip, pub, pub); + pip = ip_packet(254, 64); + NAT_CHECK(pip, prv1, ext, masq); + NAT_CHECK(pip, prv2, ext, masq); + NAT_CHECK(pip, prv3, ext, masq); + NAT_CHECK(pip, cgn, ext, masq); + NAT_CHECK(pip, pub, ext, pub); /* * State is only for new connections @@ -172,11 +115,11 @@ ATF_TC_BODY(3_cgn, dummy) * the mode setting should be ignored */ LibAliasSetMode(la, 0, PKT_ALIAS_UNREGISTERED_CGN); - NAT_CHECK(pip, prv1, masq); - NAT_CHECK(pip, prv2, masq); - NAT_CHECK(pip, prv3, masq); - NAT_CHECK(pip, cgn, masq); - NAT_CHECK(pip, pub, pub); + NAT_CHECK(pip, prv1, ext, masq); + NAT_CHECK(pip, prv2, ext, masq); + NAT_CHECK(pip, prv3, ext, masq); + NAT_CHECK(pip, cgn, ext, masq); + NAT_CHECK(pip, pub, ext, pub); free(pip); LibAliasUninit(la); @@ -197,41 +140,27 @@ ATF_TC_BODY(4_udp, dummy) LibAliasSetMode(la, 0, ~0); /* Query from prv1 */ - po = ip_packet(prv1, ext, 0, 64); - uo = set_udp(po, sport, dport); - NAT_CHECK(po, prv1, masq); - ATF_CHECK(uo->uh_dport == htons(dport)); - ATF_CHECK(addr_eq(po->ip_dst, ext)); + po = ip_packet(0, 64); + UDP_NAT_CHECK(po, uo, prv1, sport, ext, dport, masq); aport = ntohs(uo->uh_sport); /* should use a different external port */ ATF_CHECK(aport != sport); /* Response */ - pi = ip_packet(po->ip_dst, po->ip_src, 0, 64); - ui = set_udp(pi, ntohs(uo->uh_dport), ntohs(uo->uh_sport)); - UNNAT_CHECK(pi, ext, masq, prv1); - ATF_CHECK(ui->uh_sport == htons(dport)); - ATF_CHECK(ui->uh_dport == htons(sport)); + pi = ip_packet(0, 64); + UDP_UNNAT_CHECK(pi, ui, ext, dport, masq, aport, prv1, sport); /* Query from different source with same ports */ - uo = set_udp(po, sport, dport); - NAT_CHECK(po, prv2, masq); - ATF_CHECK(uo->uh_dport == htons(dport)); - ATF_CHECK(addr_eq(po->ip_dst, ext)); + UDP_NAT_CHECK(po, uo, prv2, sport, ext, dport, masq); /* should use a different external port */ ATF_CHECK(uo->uh_sport != htons(aport)); /* Response to prv2 */ ui->uh_dport = uo->uh_sport; - UNNAT_CHECK(pi, ext, masq, prv2); - ATF_CHECK(ui->uh_sport == htons(dport)); - ATF_CHECK(ui->uh_dport == htons(sport)); + UDP_UNNAT_CHECK(pi, ui, ext, dport, masq, htons(uo->uh_sport), prv2, sport); /* Response to prv1 again */ - ui->uh_dport = htons(aport); - UNNAT_CHECK(pi, ext, masq, prv1); - ATF_CHECK(ui->uh_sport == htons(dport)); - ATF_CHECK(ui->uh_dport == htons(sport)); + UDP_UNNAT_CHECK(pi, ui, ext, dport, masq, aport, prv1, sport); free(pi); free(po); @@ -253,20 +182,14 @@ ATF_TC_BODY(5_sameport, dummy) LibAliasSetMode(la, PKT_ALIAS_SAME_PORTS, ~0); /* Query from prv1 */ - p = ip_packet(prv1, ext, 0, 64); - u = set_udp(p, sport, dport); - NAT_CHECK(p, prv1, masq); - ATF_CHECK(u->uh_dport == htons(dport)); - ATF_CHECK(addr_eq(p->ip_dst, ext)); + p = ip_packet(0, 64); + UDP_NAT_CHECK(p, u, prv1, sport, ext, dport, masq); aport = ntohs(u->uh_sport); /* should use the same external port */ ATF_CHECK(aport == sport); /* Query from different source with same ports */ - u = set_udp(p, sport, dport); - NAT_CHECK(p, prv2, masq); - ATF_CHECK(u->uh_dport == htons(dport)); - ATF_CHECK(addr_eq(p->ip_dst, ext)); + UDP_NAT_CHECK(p, u, prv2, sport, ext, dport, masq); /* should use a different external port */ ATF_CHECK(u->uh_sport != htons(aport)); @@ -291,43 +214,30 @@ ATF_TC_BODY(6_cleartable, dummy) LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, PKT_ALIAS_DENY_INCOMING); /* Query from prv1 */ - po = ip_packet(prv1, ext, 0, 64); - uo = set_udp(po, sport, dport); - NAT_CHECK(po, prv1, masq); - ATF_CHECK(uo->uh_dport == htons(dport)); - ATF_CHECK(addr_eq(po->ip_dst, ext)); + po = ip_packet(0, 64); + UDP_NAT_CHECK(po, uo, prv1, sport, ext, dport, masq); aport = ntohs(uo->uh_sport); /* should use the same external port */ ATF_CHECK(aport == sport); /* Response */ - pi = ip_packet(po->ip_dst, po->ip_src, 0, 64); - ui = set_udp(pi, ntohs(uo->uh_dport), ntohs(uo->uh_sport)); - UNNAT_CHECK(pi, ext, masq, prv1); - ATF_CHECK(ui->uh_sport == htons(dport)); - ATF_CHECK(ui->uh_dport == htons(sport)); + pi = ip_packet(0, 64); + UDP_UNNAT_CHECK(po, uo, ext, dport, masq, aport, prv1, sport); /* clear table by keeping the address */ LibAliasSetAddress(la, ext); LibAliasSetAddress(la, masq); /* Response to prv1 again -> DENY_INCOMING */ - ui->uh_dport = htons(aport); - UNNAT_FAIL(pi, ext, masq); + UDP_UNNAT_FAIL(pi, ui, ext, dport, masq, aport); /* Query from different source with same ports */ - uo = set_udp(po, sport, dport); - NAT_CHECK(po, prv2, masq); - ATF_CHECK(uo->uh_dport == htons(dport)); - ATF_CHECK(addr_eq(po->ip_dst, ext)); + UDP_NAT_CHECK(po, uo, prv2, sport, ext, dport, masq); /* should use the same external port, because it's free */ ATF_CHECK(uo->uh_sport == htons(aport)); /* Response to prv2 */ - ui->uh_dport = uo->uh_sport; - UNNAT_CHECK(pi, ext, masq, prv2); - ATF_CHECK(ui->uh_sport == htons(dport)); - ATF_CHECK(ui->uh_dport == htons(sport)); + UDP_UNNAT_CHECK(po, uo, ext, dport, masq, htons(uo->uh_sport), prv2, sport); free(pi); free(po); @@ -351,8 +261,7 @@ ATF_TC_BODY(7_stress, dummy) ATF_REQUIRE(la != NULL); LibAliasSetAddress(la, masq); - p = ip_packet(prv1, ext, 0, 64); - u = set_udp(p, 0, 0); + p = ip_packet(0, 64); batch = calloc(batch_size, sizeof(*batch)); ATF_REQUIRE(batch != NULL); @@ -374,21 +283,20 @@ ATF_TC_BODY(7_stress, dummy) } for (i = 0; i < batch_size; i++) { - p->ip_dst = batch[i].dst; - u = set_udp(p, batch[i].sport, batch[i].dport); - NAT_CHECK(p, batch[i].src, masq); - ATF_CHECK(u->uh_dport == htons(batch[i].dport)); - ATF_CHECK(addr_eq(p->ip_dst, batch[i].dst)); + UDP_NAT_CHECK(p, u, + batch[i].src, batch[i].sport, + batch[i].dst, batch[i].dport, + masq); batch[i].aport = htons(u->uh_sport); } qsort(batch, batch_size, sizeof(*batch), randcmp); for (i = 0; i < batch_size; i++) { - u = set_udp(p, batch[i].dport, batch[i].aport); - UNNAT_CHECK(p, batch[i].dst, masq, batch[i].src); - ATF_CHECK(u->uh_dport == htons(batch[i].sport)); - ATF_CHECK(u->uh_sport == htons(batch[i].dport)); + UDP_UNNAT_CHECK(p, u, + batch[i].dst, batch[i].dport, + masq, batch[i].aport, + batch[i].src, batch[i].sport); } } diff --git a/tests/sys/netinet/libalias/perf.c b/tests/sys/netinet/libalias/perf.c index 365b8f2e9fcc..a98912278b94 100644 --- a/tests/sys/netinet/libalias/perf.c +++ b/tests/sys/netinet/libalias/perf.c @@ -38,11 +38,6 @@ #include "util.h" #include -/* common ip ranges */ -static struct in_addr masq = { htonl(0x01020304) }; -static struct in_addr prv = { htonl(0x0a000000) }; -static struct in_addr ext = { htonl(0x12000000) }; - #define timevalcmp(tv, uv, cmp) \ (((tv).tv_sec == (uv).tv_sec) \ ? ((tv).tv_usec cmp (uv).tv_usec) \ @@ -88,10 +83,10 @@ int main(int argc, char ** argv) LibAliasSetAddress(la, masq); LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, PKT_ALIAS_DENY_INCOMING); - prv.s_addr &= htonl(0xffff0000); + prv1.s_addr &= htonl(0xffff0000); ext.s_addr &= htonl(0xffff0000); - p = ip_packet(prv, ext, 0, 64); + p = ip_packet(0, 64); u = set_udp(p, 0, 0); if (NULL == (batch = calloc(batch_size, sizeof(*batch)))) { @@ -112,7 +107,7 @@ int main(int argc, char ** argv) gettimeofday(&start, NULL); printf("%5.1f ", max_seconds - timevaldiff(timeout, start)/1000000.0f); for (cnt = i = 0; i < batch_size; i++, cnt++) { - batch[i].src.s_addr = prv.s_addr | htonl(rand_range(0, 0xffff)); + batch[i].src.s_addr = prv1.s_addr | htonl(rand_range(0, 0xffff)); batch[i].dst.s_addr = ext.s_addr | htonl(rand_range(0, 0xffff)); batch[i].sport = rand_range(1000, 60000); batch[i].dport = rand_range(1000, 60000); diff --git a/tests/sys/netinet/libalias/util.c b/tests/sys/netinet/libalias/util.c index df2e320a4eba..681c3b20ee41 100644 --- a/tests/sys/netinet/libalias/util.c +++ b/tests/sys/netinet/libalias/util.c @@ -38,6 +38,16 @@ #include "util.h" +/* common ip ranges */ +struct in_addr masq = { htonl(0x01020304) }; +struct in_addr pub = { htonl(0x0102dead) }; +struct in_addr prv1 = { htonl(0x0a00dead) }; +struct in_addr prv2 = { htonl(0xac10dead) }; +struct in_addr prv3 = { htonl(0xc0a8dead) }; +struct in_addr cgn = { htonl(0x6440dead) }; +struct in_addr ext = { htonl(0x12345678) }; +struct in_addr ANY_ADDR = { 0 }; + #define REQUIRE(x) do { \ if (!(x)) { \ fprintf(stderr, "Failed in %s %s:%d.\n",\ @@ -78,7 +88,7 @@ hexdump(void *p, size_t len) } struct ip * -ip_packet(struct in_addr src, struct in_addr dst, u_char protocol, size_t len) +ip_packet(u_char protocol, size_t len) { struct ip * p; @@ -91,8 +101,6 @@ ip_packet(struct in_addr src, struct in_addr dst, u_char protocol, size_t len) p->ip_hl = sizeof(*p)/4; p->ip_len = htons(len); p->ip_ttl = IPDEFTTL; - p->ip_src = src; - p->ip_dst = dst; p->ip_p = protocol; REQUIRE(p->ip_hl == 5); diff --git a/tests/sys/netinet/libalias/util.h b/tests/sys/netinet/libalias/util.h index f441aea49cfb..81d71049b57f 100644 --- a/tests/sys/netinet/libalias/util.h +++ b/tests/sys/netinet/libalias/util.h @@ -40,9 +40,12 @@ #ifndef _UTIL_H #define _UTIL_H +/* common ip ranges */ +extern struct in_addr masq, pub, prv1, prv2, prv3, cgn, ext, ANY_ADDR; + int randcmp(const void *a, const void *b); void hexdump(void *p, size_t len); -struct ip * ip_packet(struct in_addr src, struct in_addr dst, u_char protocol, size_t len); +struct ip * ip_packet(u_char protocol, size_t len); struct udphdr * set_udp(struct ip *p, u_short sport, u_short dport); inline int @@ -59,4 +62,76 @@ rand_range(int min, int max) return min + rand()%(max - min); } +#define NAT_CHECK(pip, src, dst, msq) do { \ + int res; \ + int len = ntohs(pip->ip_len); \ + pip->ip_src = src; \ + pip->ip_dst = dst; \ + res = LibAliasOut(la, pip, len); \ + ATF_CHECK_MSG(res == PKT_ALIAS_OK, \ + ">%d< not met PKT_ALIAS_OK", res); \ + ATF_CHECK(addr_eq(msq, pip->ip_src)); \ + ATF_CHECK(addr_eq(dst, pip->ip_dst)); \ +} while(0) + +#define NAT_FAIL(pip, src, dst) do { \ + int res; \ + int len = ntohs(pip->ip_len); \ + pip->ip_src = src; \ + pip->ip_dst = dst; \ + res = LibAliasOut(la, pip, len); \ + ATF_CHECK_MSG(res != PKT_ALIAS_OK), \ + ">%d< not met !PKT_ALIAS_OK", res); \ + ATF_CHECK(addr_eq(src, pip->ip_src)); \ + ATF_CHECK(addr_eq(dst, pip->ip_dst)); \ +} while(0) + +#define UNNAT_CHECK(pip, src, dst, rel) do { \ + int res; \ + int len = ntohs(pip->ip_len); \ + pip->ip_src = src; \ + pip->ip_dst = dst; \ + res = LibAliasIn(la, pip, len); \ + ATF_CHECK_MSG(res == PKT_ALIAS_OK, \ + ">%d< not met PKT_ALIAS_OK", res); \ + ATF_CHECK(addr_eq(src, pip->ip_src)); \ + ATF_CHECK(addr_eq(rel, pip->ip_dst)); \ +} while(0) + +#define UNNAT_FAIL(pip, src, dst) do { \ + int res; \ + int len = ntohs(pip->ip_len); \ + pip->ip_src = src; \ + pip->ip_dst = dst; \ + res = LibAliasIn(la, pip, len); \ + ATF_CHECK_MSG(res != PKT_ALIAS_OK, \ + ">%d< not met !PKT_ALIAS_OK", res); \ + ATF_CHECK(addr_eq(src, pip->ip_src)); \ + ATF_CHECK(addr_eq(dst, pip->ip_dst)); \ +} while(0) + +#define UDP_NAT_CHECK(p, u, si, sp, di, dp, mi) do { \ + u = set_udp(p, (sp), (dp)); \ + NAT_CHECK(p, (si), (di), (mi)); \ + ATF_CHECK(u->uh_dport == htons(dp)); \ +} while(0) + +#define UDP_NAT_FAIL(p, u, si, sp, di, dp) do { \ + u = set_udp(p, (sp), (dp)); \ + NAT_FAIL(p, (si), (mi)); \ +} while(0) + +#define UDP_UNNAT_CHECK(p, u, si, sp, mi, mp, di, dp) \ +do { \ + u = set_udp(p, (sp), (mp)); \ + UNNAT_CHECK(p, (si), (mi), (di)); \ + ATF_CHECK(u->uh_sport == htons(sp)); \ + ATF_CHECK(u->uh_dport == htons(dp)); \ +} while(0) + +#define UDP_UNNAT_FAIL(p, u, si, sp, mi, mp) do { \ + u = set_udp(p, (sp), (mp)); \ + UNNAT_FAIL(p, (si), (mi)); \ +} while(0) + #endif /* _UTIL_H */ From owner-dev-commits-src-main@freebsd.org Wed May 26 14:22: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 9AA0363EC17; Wed, 26 May 2021 14:22: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 4FqtSQ412Qz3JBp; Wed, 26 May 2021 14:22: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 7262E12733; Wed, 26 May 2021 14:22: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 14QEMEt6055722; Wed, 26 May 2021 14:22:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QEMENo055721; Wed, 26 May 2021 14:22:14 GMT (envelope-from git) Date: Wed, 26 May 2021 14:22:14 GMT Message-Id: <202105261422.14QEMENo055721@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 755bab6d55e6 - main - tests/libalias: Test LibAliasIn on redirection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 755bab6d55e6e2df168f352f3e2fbdea87002ed8 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, 26 May 2021 14:22:14 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=755bab6d55e6e2df168f352f3e2fbdea87002ed8 commit 755bab6d55e6e2df168f352f3e2fbdea87002ed8 Author: Lutz Donnerhacke AuthorDate: 2021-05-23 20:39:30 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-26 14:19:24 +0000 tests/libalias: Test LibAliasIn on redirection Extend the test suite for libalias(3) to incoming connections. Test the various types of redirections. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30408 --- tests/sys/netinet/libalias/3_natin.c | 381 +++++++++++++++++++++++++++++++++++ tests/sys/netinet/libalias/Makefile | 2 + 2 files changed, 383 insertions(+) diff --git a/tests/sys/netinet/libalias/3_natin.c b/tests/sys/netinet/libalias/3_natin.c new file mode 100644 index 000000000000..e8e5257e4baa --- /dev/null +++ b/tests/sys/netinet/libalias/3_natin.c @@ -0,0 +1,381 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2021 Lutz Donnerhacke + * + * 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. + * 3. Neither the name of the copyright holder 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. + */ +#include +#include +#include +#include + +#include "util.h" + +ATF_TC_WITHOUT_HEAD(1_portforward); +ATF_TC_BODY(1_portforward, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct alias_link *pf1, *pf2, *pf3, *pf4; + struct ip *p; + struct udphdr *u; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + LibAliasSetMode(la, PKT_ALIAS_RESET_ON_ADDR_CHANGE, ~0); + LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, PKT_ALIAS_DENY_INCOMING); + + /* + * Fully specified + */ + pf1 = LibAliasRedirectPort(la, prv1, ntohs(0x1234), ext, ntohs(0x5678), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf1 != NULL); + + p = ip_packet(0, 64); + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv1, 0x1234); + /* try again */ + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv1, 0x1234); + /* different source */ + UDP_UNNAT_FAIL(p, u, pub, 0x5678, masq, 0xabcd); + UDP_UNNAT_FAIL(p, u, ext, 0xdead, masq, 0xabcd); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* delete and try again */ + LibAliasRedirectDelete(la, pf1); + UDP_UNNAT_FAIL(p, u, ext, 0x5678, masq, 0xabcd); + + /* + * Any external port + */ + pf2 = LibAliasRedirectPort(la, prv2, ntohs(0x1234), ext, ntohs(0), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf2 != NULL); + + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv2, 0x1234); + /* try again */ + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv2, 0x1234); + /* different source */ + UDP_UNNAT_FAIL(p, u, pub, 0x5678, masq, 0xabcd); + UDP_UNNAT_CHECK(p, u, ext, 0xdead, masq, 0xabcd, prv2, 0x1234); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* delete and try again */ + LibAliasRedirectDelete(la, pf2); + UDP_UNNAT_FAIL(p, u, ext, 0x5678, masq, 0xabcd); + + /* + * Any external host + */ + pf3 = LibAliasRedirectPort(la, prv3, ntohs(0x1234), ANY_ADDR, ntohs(0x5678), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf3 != NULL); + + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv3, 0x1234); + /* try again */ + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv3, 0x1234); + /* different source */ + UDP_UNNAT_CHECK(p, u, pub, 0x5678, masq, 0xabcd, prv3, 0x1234); + UDP_UNNAT_FAIL(p, u, ext, 0xdead, masq, 0xabcd); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* delete and try again */ + LibAliasRedirectDelete(la, pf2); + UDP_UNNAT_FAIL(p, u, ext, 0x5678, masq, 0xabcd); + + /* + * Any external host, any port + */ + pf4 = LibAliasRedirectPort(la, cgn, ntohs(0x1234), ANY_ADDR, ntohs(0), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf4 != NULL); + + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, cgn, 0x1234); + /* try again */ + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, cgn, 0x1234); + /* different source */ + UDP_UNNAT_CHECK(p, u, pub, 0x5678, masq, 0xabcd, cgn, 0x1234); + UDP_UNNAT_CHECK(p, u, ext, 0xdead, masq, 0xabcd, cgn, 0x1234); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* delete and try again */ + LibAliasRedirectDelete(la, pf2); + UDP_UNNAT_FAIL(p, u, ext, 0x5678, masq, 0xabcd); + + free(p); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(2_portoverlap); +ATF_TC_BODY(2_portoverlap, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct alias_link *pf1, *pf2, *pf3, *pf4; + struct ip *p; + struct udphdr *u; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + LibAliasSetMode(la, PKT_ALIAS_RESET_ON_ADDR_CHANGE, ~0); + LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, PKT_ALIAS_DENY_INCOMING); + + /* + * Fully specified + */ + pf1 = LibAliasRedirectPort(la, prv2, ntohs(0x1234), ext, ntohs(0x5678), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf1 != NULL); + + p = ip_packet(0, 64); + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv2, 0x1234); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* + * Fully specified (override) + */ + pf1 = LibAliasRedirectPort(la, prv1, ntohs(0x1234), ext, ntohs(0x5678), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf1 != NULL); + + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv1, 0x1234); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* + * Any external port + */ + pf2 = LibAliasRedirectPort(la, prv2, ntohs(0x1234), ext, ntohs(0), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf2 != NULL); + + UDP_UNNAT_CHECK(p, u, ext, 0x5679, masq, 0xabcd, prv2, 0x1234); + /* more specific rule wins */ + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv1, 0x1234); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* + * Any external host + */ + pf3 = LibAliasRedirectPort(la, prv3, ntohs(0x1234), ANY_ADDR, ntohs(0x5678), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf3 != NULL); + + UDP_UNNAT_CHECK(p, u, pub, 0x5678, masq, 0xabcd, prv3, 0x1234); + /* more specific rule wins */ + UDP_UNNAT_CHECK(p, u, ext, 0x5679, masq, 0xabcd, prv2, 0x1234); + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv1, 0x1234); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* + * Any external host, any port + */ + pf4 = LibAliasRedirectPort(la, cgn, ntohs(0x1234), ANY_ADDR, ntohs(0), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf4 != NULL); + + UDP_UNNAT_CHECK(p, u, prv1, 0x5679, masq, 0xabcd, cgn, 0x1234); + /* more specific rule wins */ + UDP_UNNAT_CHECK(p, u, pub, 0x5678, masq, 0xabcd, prv3, 0x1234); + UDP_UNNAT_CHECK(p, u, ext, 0x5679, masq, 0xabcd, prv2, 0x1234); + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv1, 0x1234); + + free(p); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(3_redirectany); +ATF_TC_BODY(3_redirectany, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct alias_link *pf; + struct ip *p; + struct udphdr *u; + + ATF_REQUIRE(la != NULL); + LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, ~0); + p = ip_packet(0, 64); + + pf = LibAliasRedirectPort(la, prv1, ntohs(0x1234), ANY_ADDR, 0, ANY_ADDR, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf != NULL); + + LibAliasSetAddress(la, masq); + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv1, 0x1234); + UDP_UNNAT_FAIL(p, u, pub, 0x5678, pub, 0xabcd); + + LibAliasSetAddress(la, pub); + UDP_UNNAT_CHECK(p, u, pub, 0x5679, pub, 0xabcd, prv1, 0x1234); + UDP_UNNAT_FAIL(p, u, ext, 0x5679, masq, 0xabcd); + + free(p); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(4_redirectaddr); +ATF_TC_BODY(4_redirectaddr, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct alias_link *pf1, *pf2; + struct ip *p; + + ATF_REQUIRE(la != NULL); + LibAliasSetAddress(la, masq); + pf1 = LibAliasRedirectAddr(la, prv1, pub); + ATF_REQUIRE(pf1 != NULL); + + p = ip_packet(254, 64); + UNNAT_CHECK(p, ext, pub, prv1); + UNNAT_CHECK(p, ext, masq, masq); + + pf2 = LibAliasRedirectAddr(la, prv2, pub); + ATF_REQUIRE(pf2 != NULL); + UNNAT_CHECK(p, ext, pub, prv1); + p->ip_p = 253; /* new flows */ + UNNAT_CHECK(p, ext, pub, prv2); + UNNAT_CHECK(p, ext, masq, masq); + + p->ip_p = 252; /* new flows */ + NAT_CHECK(p, prv1, ext, pub); + NAT_CHECK(p, prv2, ext, pub); + NAT_CHECK(p, prv3, ext, masq); + + LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, ~0); + p->ip_p = 251; /* new flows */ + UNNAT_FAIL(p, ext, pub); + UNNAT_FAIL(p, ext, masq); + + /* unhide older version */ + LibAliasRedirectDelete(la, pf2); + LibAliasSetMode(la, 0, ~0); + p->ip_p = 250; /* new flows */ + UNNAT_CHECK(p, ext, pub, prv1); + + p->ip_p = 249; /* new flows */ + NAT_CHECK(p, prv1, ext, pub); + NAT_CHECK(p, prv2, ext, masq); + NAT_CHECK(p, prv3, ext, masq); + + free(p); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(5_lsnat); +ATF_TC_BODY(5_lsnat, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct alias_link *pf; + struct ip *p; + struct udphdr *u; + + ATF_REQUIRE(la != NULL); + LibAliasSetMode(la, 0, ~0); + p = ip_packet(0, 64); + + pf = LibAliasRedirectPort(la, cgn, ntohs(0xdead), ANY_ADDR, 0, masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf != NULL); + + ATF_REQUIRE(0 == LibAliasAddServer(la, pf, prv1, ntohs(0x1234))); + ATF_REQUIRE(0 == LibAliasAddServer(la, pf, prv2, ntohs(0x2345))); + ATF_REQUIRE(0 == LibAliasAddServer(la, pf, prv3, ntohs(0x3456))); + + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv3, 0x3456); + UDP_UNNAT_CHECK(p, u, ext, 0x5679, masq, 0xabcd, prv2, 0x2345); + UDP_UNNAT_CHECK(p, u, ext, 0x567a, masq, 0xabcd, prv1, 0x1234); + UDP_UNNAT_CHECK(p, u, ext, 0x567b, masq, 0xabcd, prv3, 0x3456); + UDP_UNNAT_CHECK(p, u, ext, 0x567c, masq, 0xabcd, prv2, 0x2345); + UDP_UNNAT_CHECK(p, u, ext, 0x567d, masq, 0xabcd, prv1, 0x1234); + + free(p); + LibAliasUninit(la); +} + +ATF_TC_WITHOUT_HEAD(6_oneshot); +ATF_TC_BODY(6_oneshot, dummy) +{ + struct libalias *la = LibAliasInit(NULL); + struct alias_link *pf; + struct ip *p; + struct udphdr *u; + + ATF_REQUIRE(la != NULL); + LibAliasSetMode(la, 0, ~0); + LibAliasSetMode(la, PKT_ALIAS_RESET_ON_ADDR_CHANGE, ~0); + LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, PKT_ALIAS_DENY_INCOMING); + + pf = LibAliasRedirectPort(la, prv1, ntohs(0x1234), ANY_ADDR, 0, masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf != NULL); + /* only for fully specified links */ + ATF_CHECK(-1 == LibAliasRedirectDynamic(la, pf)); + LibAliasRedirectDelete(la, pf); + + pf = LibAliasRedirectPort(la, prv1, ntohs(0x1234), ext, ntohs(0x5678), masq, ntohs(0xabcd), IPPROTO_UDP); + ATF_REQUIRE(pf != NULL); + ATF_CHECK(0 == LibAliasRedirectDynamic(la, pf)); + + p = ip_packet(0, 64); + UDP_UNNAT_CHECK(p, u, ext, 0x5678, masq, 0xabcd, prv1, 0x1234); + + /* clear table by keeping the address */ + LibAliasSetAddress(la, ext); + LibAliasSetAddress(la, masq); + + /* does not work anymore */ + UDP_UNNAT_FAIL(p, u, ext, 0x5678, masq, 0xabcd); + + free(p); + LibAliasUninit(la); +} + +ATF_TP_ADD_TCS(natin) +{ + /* Use "dd if=/dev/random bs=2 count=1 | od -x" to reproduce */ + srand(0xe859); + + ATF_TP_ADD_TC(natin, 1_portforward); + ATF_TP_ADD_TC(natin, 2_portoverlap); + ATF_TP_ADD_TC(natin, 3_redirectany); + ATF_TP_ADD_TC(natin, 4_redirectaddr); + ATF_TP_ADD_TC(natin, 5_lsnat); + ATF_TP_ADD_TC(natin, 6_oneshot); + + return atf_no_error(); +} diff --git a/tests/sys/netinet/libalias/Makefile b/tests/sys/netinet/libalias/Makefile index 6ee2fc0e0e1f..e5ed88f52fcd 100644 --- a/tests/sys/netinet/libalias/Makefile +++ b/tests/sys/netinet/libalias/Makefile @@ -7,6 +7,7 @@ BINDIR= ${TESTSDIR} ATF_TESTS_C+= 1_instance \ 2_natout \ + 3_natin \ PROGS+= perf @@ -14,6 +15,7 @@ LIBADD+= alias SRCS.1_instance=1_instance.c util.c SRCS.2_natout= 2_natout.c util.c +SRCS.3_natin= 3_natin.c util.c SRCS.perf= perf.c util.c .include From owner-dev-commits-src-main@freebsd.org Wed May 26 14:29: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 A7DCD63EC3C; Wed, 26 May 2021 14:29: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 4Fqtd54Qgtz3HyX; Wed, 26 May 2021 14:29: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 802DA127C1; Wed, 26 May 2021 14:29: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 14QETjiG056323; Wed, 26 May 2021 14:29:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QETjAX056322; Wed, 26 May 2021 14:29:45 GMT (envelope-from git) Date: Wed, 26 May 2021 14:29:45 GMT Message-Id: <202105261429.14QETjAX056322@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 6e87898a2c7e - main - tests/libalias: Improve testing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e87898a2c7e99937656a0c12d03333a43a10c5e 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, 26 May 2021 14:29:45 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=6e87898a2c7e99937656a0c12d03333a43a10c5e commit 6e87898a2c7e99937656a0c12d03333a43a10c5e Author: Lutz Donnerhacke AuthorDate: 2021-05-23 17:48:13 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-26 14:26:44 +0000 tests/libalias: Improve testing gettimeofday(3) is almost as expensive as the calls to libalias. So the call frequency for this call is reduced by a factor of 1000 in order to neglect it's influence. Using NAT entries became more realistic: A communication of a random length of up to 150 packets (10% outgoing, 90% incoming) is applied for each entry. Precision of the execution time is raised to see the trends better. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30405 --- tests/sys/netinet/libalias/perf.c | 136 ++++++++++++++++++++++++-------------- 1 file changed, 88 insertions(+), 48 deletions(-) diff --git a/tests/sys/netinet/libalias/perf.c b/tests/sys/netinet/libalias/perf.c index a98912278b94..4bf29ed11dce 100644 --- a/tests/sys/netinet/libalias/perf.c +++ b/tests/sys/netinet/libalias/perf.c @@ -47,6 +47,15 @@ (((n).tv_sec - (o).tv_sec)*1000000l + \ ((n).tv_usec - (o).tv_usec)) +#define check_timeout() do { \ + if (check_timeout_cnt++ > 1000) { \ + check_timeout_cnt = 0; \ + gettimeofday(&now, NULL); \ + if (timevalcmp(now, timeout, >=)) \ + goto out; \ + } } while(0) + + int main(int argc, char ** argv) { struct libalias *la; @@ -59,8 +68,9 @@ int main(int argc, char ** argv) } *batch; struct { unsigned long ok, fail; - } nat, unnat, random, attack; - int max_seconds, batch_size, random_size, attack_length, round, cnt; + } nat, usenat, unnat, random, attack; + int max_seconds, batch_size, random_size, attack_length, round; + int check_timeout_cnt = 0; if(argc != 5 || 0 > (max_seconds = atoi(argv[1])) || @@ -76,6 +86,7 @@ int main(int argc, char ** argv) } bzero(&nat, sizeof(nat)); + bzero(&usenat, sizeof(usenat)); bzero(&unnat, sizeof(unnat)); bzero(&random, sizeof(random)); bzero(&attack, sizeof(attack)); @@ -97,15 +108,15 @@ int main(int argc, char ** argv) gettimeofday(&timeout, NULL); timeout.tv_sec += max_seconds; - printf("RND SECND NAT RND ATT UNA\n"); + printf("RND SECOND newNAT RANDOM ATTACK useNAT\n"); for (round = 0; ; round++) { - int i, res; + int i, res, cnt; struct timeval now, start; printf("%3d ", round+1); gettimeofday(&start, NULL); - printf("%5.1f ", max_seconds - timevaldiff(timeout, start)/1000000.0f); + printf("%6.1f ", max_seconds - timevaldiff(timeout, start)/1000000.0f); for (cnt = i = 0; i < batch_size; i++, cnt++) { batch[i].src.s_addr = prv1.s_addr | htonl(rand_range(0, 0xffff)); batch[i].dst.s_addr = ext.s_addr | htonl(rand_range(0, 0xffff)); @@ -127,12 +138,11 @@ int main(int argc, char ** argv) else nat.fail++; - gettimeofday(&now, NULL); - if(timevalcmp(now, timeout, >=)) - goto out; + check_timeout(); } + gettimeofday(&now, NULL); if (cnt > 0) - printf("%3.0f ", timevaldiff(now, start) / cnt); + printf("%6.2f ", timevaldiff(now, start) / cnt); start = now; for (cnt = i = 0; i < random_size; i++, cnt++) { @@ -148,12 +158,11 @@ int main(int argc, char ** argv) else random.fail++; - gettimeofday(&now, NULL); - if(timevalcmp(now, timeout, >=)) - goto out; + check_timeout(); } + gettimeofday(&now, NULL); if (cnt > 0) - printf("%3.0f ", timevaldiff(now, start) / cnt); + printf("%6.2f ", timevaldiff(now, start) / cnt); start = now; p->ip_src.s_addr = ext.s_addr & htonl(0xfff00000); @@ -168,39 +177,65 @@ int main(int argc, char ** argv) else attack.fail++; - gettimeofday(&now, NULL); - if(timevalcmp(now, timeout, >=)) - goto out; + check_timeout(); } + gettimeofday(&now, NULL); if (cnt > 0) - printf("%3.0f ", timevaldiff(now, start) / cnt); + printf("%6.2f ", timevaldiff(now, start) / cnt); qsort(batch, batch_size, sizeof(*batch), randcmp); gettimeofday(&start, NULL); - for (cnt = i = 0; i < batch_size; i++, cnt++) { - p->ip_src = batch[i].dst; - p->ip_dst = masq; - u = set_udp(p, batch[i].dport, batch[i].aport); + for (cnt = i = 0; i < batch_size; i++) { + int j; - res = LibAliasIn(la, p, 64); - batch[i].aport = htons(u->uh_sport); + /* random communication length */ + for(j = rand_range(1, 150); j-- > 0; cnt++) { + int k; - if (res == PKT_ALIAS_OK && - u->uh_sport == htons(batch[i].dport) && - u->uh_dport == htons(batch[i].sport) && - addr_eq(p->ip_dst, batch[i].src) && - addr_eq(p->ip_src, batch[i].dst)) - unnat.ok++; - else - unnat.fail++; + /* a random flow out of rolling window */ + k = rand_range(i, i + 25); + if (k >= batch_size) + k = i; + + /* 10% outgoing, 90% incoming */ + if (rand_range(0, 100) > 10) { + p->ip_src = batch[k].dst; + p->ip_dst = masq; + u = set_udp(p, batch[k].dport, batch[k].aport); - gettimeofday(&now, NULL); - if(timevalcmp(now, timeout, >=)) - goto out; + res = LibAliasIn(la, p, 64); + if (res == PKT_ALIAS_OK && + u->uh_sport == htons(batch[k].dport) && + u->uh_dport == htons(batch[k].sport) && + addr_eq(p->ip_dst, batch[k].src) && + addr_eq(p->ip_src, batch[k].dst)) + unnat.ok++; + else + unnat.fail++; + } else { + p->ip_src = batch[k].src; + p->ip_dst = batch[k].dst; + u = set_udp(p, batch[k].sport, batch[k].dport); + + res = LibAliasOut(la, p, 64); + if (res == PKT_ALIAS_OK && + u->uh_sport == htons(batch[k].aport) && + u->uh_dport == htons(batch[k].dport) && + addr_eq(p->ip_dst, batch[k].dst) && + addr_eq(p->ip_src, masq)) + usenat.ok++; + else + usenat.fail++; + } + check_timeout(); + } } + gettimeofday(&now, NULL); if (cnt > 0) - printf("%3.0f\n", timevaldiff(now, start) / cnt); + printf("%6.2f ", timevaldiff(now, start) / cnt); + + printf("\n"); } out: printf("\n\n"); @@ -209,18 +244,23 @@ out: LibAliasUninit(la); printf("Results\n"); - printf(" Rounds : %7u\n", round); - printf(" NAT ok : %7lu\n", nat.ok); - printf(" NAT fail: %7lu\n", nat.fail); - printf(" UNNAT ok : %7lu\n", unnat.ok); - printf(" UNNAT fail: %7lu\n", unnat.fail); - printf("RANDOM ok : %7lu\n", random.ok); - printf("RANDOM fail: %7lu\n", random.fail); - printf("ATTACK ok : %7lu\n", attack.ok); - printf("ATTACK fail: %7lu\n", attack.fail); - printf(" -------------------\n"); - printf(" Total: %7lu\n", - nat.ok + nat.fail + unnat.ok + unnat.fail + - random.ok + random.fail + attack.ok + attack.fail); + printf(" Rounds : %9u\n", round); + printf("newNAT ok : %9lu\n", nat.ok); + printf("newNAT fail: %9lu\n", nat.fail); + printf("useNAT ok : %9lu (out)\n", usenat.ok); + printf("useNAT fail: %9lu (out)\n", usenat.fail); + printf("useNAT ok : %9lu (in)\n", unnat.ok); + printf("useNAT fail: %9lu (in)\n", unnat.fail); + printf("RANDOM ok : %9lu\n", random.ok); + printf("RANDOM fail: %9lu\n", random.fail); + printf("ATTACK ok : %9lu\n", attack.ok); + printf("ATTACK fail: %9lu\n", attack.fail); + printf(" ---------\n"); + printf(" Total: %9lu\n", + nat.ok + nat.fail + + unnat.ok + unnat.fail + + usenat.ok + usenat.fail + + random.ok + random.fail + + attack.ok + attack.fail); return (0); } From owner-dev-commits-src-main@freebsd.org Wed May 26 14:35: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 107E363EF05; Wed, 26 May 2021 14:35: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 4Fqtlg6ytCz3Jrt; Wed, 26 May 2021 14:35: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 D71C912775; Wed, 26 May 2021 14:35: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 14QEZR1e068954; Wed, 26 May 2021 14:35:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QEZRrO068953; Wed, 26 May 2021 14:35:27 GMT (envelope-from git) Date: Wed, 26 May 2021 14:35:27 GMT Message-Id: <202105261435.14QEZRrO068953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: d62e1ecba07b - main - tests/libalias: Add port forwardings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d62e1ecba07b2acee37e019778087f0f55d977d1 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, 26 May 2021 14:35:28 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=d62e1ecba07b2acee37e019778087f0f55d977d1 commit d62e1ecba07b2acee37e019778087f0f55d977d1 Author: Lutz Donnerhacke AuthorDate: 2021-05-24 21:31:09 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-26 14:34:22 +0000 tests/libalias: Add port forwardings Add port forwardings to the performance tests. This will cause random incoming packets to match the random port forwardings opends beforehand. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30443 --- tests/sys/netinet/libalias/perf.c | 62 +++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/tests/sys/netinet/libalias/perf.c b/tests/sys/netinet/libalias/perf.c index 4bf29ed11dce..e8de1e715013 100644 --- a/tests/sys/netinet/libalias/perf.c +++ b/tests/sys/netinet/libalias/perf.c @@ -55,6 +55,11 @@ goto out; \ } } while(0) +static void +usage() { + printf("Usage: perf [max_seconds [batch_size [random_size [attack_size [redir_size]]]]]\n"); + exit(1); +} int main(int argc, char ** argv) { @@ -69,17 +74,31 @@ int main(int argc, char ** argv) struct { unsigned long ok, fail; } nat, usenat, unnat, random, attack; - int max_seconds, batch_size, random_size, attack_length, round; - int check_timeout_cnt = 0; - - if(argc != 5 || - 0 > (max_seconds = atoi(argv[1])) || - 0 >= (batch_size = atoi(argv[2])) || - 0 >= (random_size = atoi(argv[3])) || - 0 >= (attack_length = atoi(argv[4]))) { - printf("Usage: %s max_seconds batch_size random_size attack_length\n", argv[0]); - return 1; + int i, round, check_timeout_cnt = 0; + int max_seconds = 90, batch_size = 2000, + random_size = 1000, attack_size = 1000, + redir_size = 2000; + + if (argc >= 2) { + char * end; + + max_seconds = strtol(argv[1], &end, 10); + if (max_seconds < 2 || end[0] != '\0') + usage(); } + if (argc > 2 && (batch_size = atoi(argv[2])) < 0) usage(); + if (argc > 3 && (random_size = atoi(argv[3])) < 0) usage(); + if (argc > 4 && (attack_size = atoi(argv[4])) < 0) usage(); + if (argc > 5 && (redir_size = atoi(argv[5])) < 0) usage(); + + printf("Running perfomance test with parameters:\n"); + printf(" Maximum Runtime (max_seconds) = %d\n", max_seconds); + printf(" Amount of valid connections (batch_size) = %d\n", batch_size); + printf(" Amount of random, incoming packets (batch_size) = %d\n", random_size); + printf(" Repeat count of a random, incoming packet (attack_size) = %d\n", attack_size); + printf(" Amount of open port forwardings (redir_size) = %d\n", redir_size); + printf("\n"); + if (NULL == (la = LibAliasInit(NULL))) { perror("LibAliasInit"); return -1; @@ -92,11 +111,20 @@ int main(int argc, char ** argv) bzero(&attack, sizeof(attack)); LibAliasSetAddress(la, masq); - LibAliasSetMode(la, PKT_ALIAS_DENY_INCOMING, PKT_ALIAS_DENY_INCOMING); + LibAliasSetMode(la, PKT_ALIAS_SAME_PORTS | PKT_ALIAS_DENY_INCOMING, ~0); prv1.s_addr &= htonl(0xffff0000); ext.s_addr &= htonl(0xffff0000); + for (i = 0; i < redir_size; i++) { + int aport = htons(rand_range(1000, 2000)); + int sport = htons(rand_range(1000, 2000)); + + prv2.s_addr &= htonl(0xffff0000); + prv2.s_addr |= rand_range(0, 0xffff); + LibAliasRedirectPort(la, prv2, sport, ANY_ADDR, 0, masq, aport, IPPROTO_UDP); + } + p = ip_packet(0, 64); u = set_udp(p, 0, 0); @@ -110,7 +138,7 @@ int main(int argc, char ** argv) printf("RND SECOND newNAT RANDOM ATTACK useNAT\n"); for (round = 0; ; round++) { - int i, res, cnt; + int res, cnt; struct timeval now, start; printf("%3d ", round+1); @@ -143,6 +171,8 @@ int main(int argc, char ** argv) gettimeofday(&now, NULL); if (cnt > 0) printf("%6.2f ", timevaldiff(now, start) / cnt); + else + printf("------ "); start = now; for (cnt = i = 0; i < random_size; i++, cnt++) { @@ -163,13 +193,15 @@ int main(int argc, char ** argv) gettimeofday(&now, NULL); if (cnt > 0) printf("%6.2f ", timevaldiff(now, start) / cnt); + else + printf("------ "); start = now; p->ip_src.s_addr = ext.s_addr & htonl(0xfff00000); p->ip_src.s_addr |= htonl(rand_range(0, 0xffff)); p->ip_dst = masq; u = set_udp(p, rand_range(1, 0xffff), rand_range(1, 0xffff)); - for (cnt = i = 0; i < attack_length; i++, cnt++) { + for (cnt = i = 0; i < attack_size; i++, cnt++) { res = LibAliasIn(la, p, 64); if (res == PKT_ALIAS_OK) @@ -182,6 +214,8 @@ int main(int argc, char ** argv) gettimeofday(&now, NULL); if (cnt > 0) printf("%6.2f ", timevaldiff(now, start) / cnt); + else + printf("------ "); qsort(batch, batch_size, sizeof(*batch), randcmp); @@ -234,6 +268,8 @@ int main(int argc, char ** argv) gettimeofday(&now, NULL); if (cnt > 0) printf("%6.2f ", timevaldiff(now, start) / cnt); + else + printf("------ "); printf("\n"); } From owner-dev-commits-src-main@freebsd.org Wed May 26 14:49: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 7FC9C63F1EF; Wed, 26 May 2021 14:49: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 4Fqv4B2nPRz3Kwh; Wed, 26 May 2021 14:49:46 +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 3104D12E86; Wed, 26 May 2021 14:49:46 +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 14QEnkxv082951; Wed, 26 May 2021 14:49:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QEnkq0082950; Wed, 26 May 2021 14:49:46 GMT (envelope-from git) Date: Wed, 26 May 2021 14:49:46 GMT Message-Id: <202105261449.14QEnkq0082950@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: 71776d67198f - main - oce: Fix handling of m_pullup() errors in oce_tso_setup() 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: 71776d67198fadd7d96937c9bdd22063636b132b 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, 26 May 2021 14:49:46 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=71776d67198fadd7d96937c9bdd22063636b132b commit 71776d67198fadd7d96937c9bdd22063636b132b Author: Mark Johnston AuthorDate: 2021-05-26 13:49:49 +0000 Commit: Mark Johnston CommitDate: 2021-05-26 14:42:36 +0000 oce: Fix handling of m_pullup() errors in oce_tso_setup() m_pullup() frees the input mbuf chain upon a failure. Set *mpp to NULL in this case to ensure that the caller does not free the chain again. PR: 224928 Submitted by: Lv Yunlong (original version) MFC after: 1 week --- sys/dev/oce/oce_if.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c index 7c9b71089081..271c35015a9f 100644 --- a/sys/dev/oce/oce_if.c +++ b/sys/dev/oce/oce_if.c @@ -1330,11 +1330,8 @@ oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp) } m = m_pullup(m, total_len); - if (!m) - return NULL; *mpp = m; return m; - } #endif /* INET6 || INET */ From owner-dev-commits-src-main@freebsd.org Wed May 26 14:49: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 B39B263F1F3; Wed, 26 May 2021 14:49: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 4Fqv4C346wz3Kwj; Wed, 26 May 2021 14:49: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 47ABD12E27; Wed, 26 May 2021 14:49: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 14QEnlK8082972; Wed, 26 May 2021 14:49:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QEnlQr082971; Wed, 26 May 2021 14:49:47 GMT (envelope-from git) Date: Wed, 26 May 2021 14:49:47 GMT Message-Id: <202105261449.14QEnlQr082971@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: 771e95d2e2ee - main - netsmb: Avoid a read-after-free in smb_t2_request_int() 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: 771e95d2e2ee1b60539f1273c62837b48249590a 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, 26 May 2021 14:49:47 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=771e95d2e2ee1b60539f1273c62837b48249590a commit 771e95d2e2ee1b60539f1273c62837b48249590a Author: Mark Johnston AuthorDate: 2021-05-26 13:57:38 +0000 Commit: Mark Johnston CommitDate: 2021-05-26 14:45:40 +0000 netsmb: Avoid a read-after-free in smb_t2_request_int() Defer freeing the request structure until we've decided whether the request should be retried. PR: 255881 MFC after: 1 week --- sys/netsmb/smb_rq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netsmb/smb_rq.c b/sys/netsmb/smb_rq.c index 57bf053034ad..c5d5d0f85742 100644 --- a/sys/netsmb/smb_rq.c +++ b/sys/netsmb/smb_rq.c @@ -737,13 +737,13 @@ smb_t2_request_int(struct smb_t2rq *t2p) bad: smb_iod_removerq(rqp); freerq: - smb_rq_done(rqp); if (error) { if (rqp->sr_flags & SMBR_RESTART) t2p->t2_flags |= SMBT2_RESTART; md_done(&t2p->t2_rparam); md_done(&t2p->t2_rdata); } + smb_rq_done(rqp); return error; } From owner-dev-commits-src-main@freebsd.org Wed May 26 14:49: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 7A41D63F270; Wed, 26 May 2021 14:49: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 4Fqv4F0NMhz3Kyp; Wed, 26 May 2021 14:49: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 758AE12B35; Wed, 26 May 2021 14:49: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 14QEnmVZ082993; Wed, 26 May 2021 14:49:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QEnmqj082992; Wed, 26 May 2021 14:49:48 GMT (envelope-from git) Date: Wed, 26 May 2021 14:49:48 GMT Message-Id: <202105261449.14QEnmqj082992@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: 16f8f89c5c1f - main - cxgb: Avoid a read-after-free in get_packet() when cxgb_debug is on 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: 16f8f89c5c1f324a15a7e0607f03f041a230a572 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, 26 May 2021 14:49:49 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=16f8f89c5c1f324a15a7e0607f03f041a230a572 commit 16f8f89c5c1f324a15a7e0607f03f041a230a572 Author: Mark Johnston AuthorDate: 2021-05-26 14:02:19 +0000 Commit: Mark Johnston CommitDate: 2021-05-26 14:45:40 +0000 cxgb: Avoid a read-after-free in get_packet() when cxgb_debug is on PR: 224927 MFC after: 1 week --- sys/dev/cxgb/cxgb_sge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index f13d2f03180c..00b67880fcc8 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -2773,6 +2773,7 @@ get_packet(adapter_t *adap, unsigned int drop_thres, struct sge_qset *qs, if (mh->mh_tail == NULL) { log(LOG_ERR, "discarding intermediate descriptor entry\n"); m_freem(m); + m = NULL; break; } mh->mh_tail->m_next = m; @@ -2780,7 +2781,7 @@ get_packet(adapter_t *adap, unsigned int drop_thres, struct sge_qset *qs, mh->mh_head->m_pkthdr.len += len; break; } - if (cxgb_debug) + if (cxgb_debug && m != NULL) printf("len=%d pktlen=%d\n", m->m_len, m->m_pkthdr.len); done: if (++fl->cidx == fl->size) From owner-dev-commits-src-main@freebsd.org Wed May 26 14:49: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 99D4563F27A; Wed, 26 May 2021 14:49: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 4Fqv4G31CPz3LBk; Wed, 26 May 2021 14:49: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 8E9A612C45; Wed, 26 May 2021 14:49: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 14QEnniN083021; Wed, 26 May 2021 14:49:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QEnnnF083020; Wed, 26 May 2021 14:49:49 GMT (envelope-from git) Date: Wed, 26 May 2021 14:49:49 GMT Message-Id: <202105261449.14QEnnnF083020@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: ba5bc6e8f9cb - main - rpcsec_gss: Use a designated initializer for rpc_gss_ops 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: ba5bc6e8f9cb9c523d09599d7290a6d75ec9fd8b 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, 26 May 2021 14:49:50 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ba5bc6e8f9cb9c523d09599d7290a6d75ec9fd8b commit ba5bc6e8f9cb9c523d09599d7290a6d75ec9fd8b Author: Mark Johnston AuthorDate: 2021-05-26 14:14:35 +0000 Commit: Mark Johnston CommitDate: 2021-05-26 14:45:40 +0000 rpcsec_gss: Use a designated initializer for rpc_gss_ops No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/rpc/rpcsec_gss/rpcsec_gss.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/rpc/rpcsec_gss/rpcsec_gss.c b/sys/rpc/rpcsec_gss/rpcsec_gss.c index 2eef1544b61a..b384a8347ef5 100644 --- a/sys/rpc/rpcsec_gss/rpcsec_gss.c +++ b/sys/rpc/rpcsec_gss/rpcsec_gss.c @@ -98,11 +98,11 @@ static void rpc_gss_destroy(AUTH *); static void rpc_gss_destroy_context(AUTH *, bool_t); static struct auth_ops rpc_gss_ops = { - rpc_gss_nextverf, - rpc_gss_marshal, - rpc_gss_validate, - rpc_gss_refresh, - rpc_gss_destroy, + .ah_nextverf = rpc_gss_nextverf, + .ah_marshal = rpc_gss_marshal, + .ah_validate = rpc_gss_validate, + .ah_refresh = rpc_gss_refresh, + .ah_destroy = rpc_gss_destroy, }; enum rpcsec_gss_state { From owner-dev-commits-src-main@freebsd.org Wed May 26 14:49: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 4A28963F5BA; Wed, 26 May 2021 14:49: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 4Fqv4H14cyz3L6S; Wed, 26 May 2021 14:49: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 B128312AC1; Wed, 26 May 2021 14:49: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 14QEnoq0083042; Wed, 26 May 2021 14:49:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QEnoCf083041; Wed, 26 May 2021 14:49:50 GMT (envelope-from git) Date: Wed, 26 May 2021 14:49:50 GMT Message-Id: <202105261449.14QEnoCf083041@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: 27130028a583 - main - ktls.4: Mention mb_use_ext_pgs in the "sysctl nodes" section 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: 27130028a583273071a14a3256f8ea0a131f2dd4 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, 26 May 2021 14:49:53 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=27130028a583273071a14a3256f8ea0a131f2dd4 commit 27130028a583273071a14a3256f8ea0a131f2dd4 Author: Mark Johnston AuthorDate: 2021-05-26 14:20:37 +0000 Commit: Mark Johnston CommitDate: 2021-05-26 14:49:30 +0000 ktls.4: Mention mb_use_ext_pgs in the "sysctl nodes" section Reviewed by: rmacklem, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30403 --- share/man/man4/ktls.4 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ktls.4 b/share/man/man4/ktls.4 index 9f01b1e8b1a5..e1e219a12603 100644 --- a/share/man/man4/ktls.4 +++ b/share/man/man4/ktls.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2021 +.Dd May 26, 2021 .Dt KTLS 4 .Os .Sh NAME @@ -199,6 +199,11 @@ A tree of nodes containing statistics for TLS sessions using .It Va kern.ipc.tls.stats A tree of nodes containing various kernel TLS statistics. .El +.Pp +The +.Va kern.ipc.mb_use_ext_pgs +sysctl controls whether the kernel may use unmapped mbufs. +They are required for TLS transmit. .Ss Backends The base system includes a software backend for the .Dv TCP_TLS_MODE_SW From owner-dev-commits-src-main@freebsd.org Wed May 26 14:49: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 BEC4763F633; Wed, 26 May 2021 14:49: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 4Fqv4J0mwDz3L8P; Wed, 26 May 2021 14:49: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 D755012CB0; Wed, 26 May 2021 14:49: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 14QEnpnI083063; Wed, 26 May 2021 14:49:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QEnpYJ083062; Wed, 26 May 2021 14:49:51 GMT (envelope-from git) Date: Wed, 26 May 2021 14:49:51 GMT Message-Id: <202105261449.14QEnpYJ083062@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: 4cf332752890 - main - acpi: Add missing error handling to acpi_pci_link_route_irqs() 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: 4cf33275289088e3b0a913a44b5cd549e348094d 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, 26 May 2021 14:49:52 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4cf33275289088e3b0a913a44b5cd549e348094d commit 4cf33275289088e3b0a913a44b5cd549e348094d Author: Mark Johnston AuthorDate: 2021-05-26 14:34:39 +0000 Commit: Mark Johnston CommitDate: 2021-05-26 14:49:30 +0000 acpi: Add missing error handling to acpi_pci_link_route_irqs() Otherwise the resouce buffer may have been freed when AcpiSetCurrentResources() is called, leading to a use-after-free. PR: 255862 Submitted by: Lv Yunlong (original version) MFC after: 1 week --- sys/dev/acpica/acpi_pci_link.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/acpica/acpi_pci_link.c b/sys/dev/acpica/acpi_pci_link.c index ecc4f26d3fb4..3dab2807bd92 100644 --- a/sys/dev/acpica/acpi_pci_link.c +++ b/sys/dev/acpica/acpi_pci_link.c @@ -843,8 +843,10 @@ acpi_pci_link_srs_from_links(struct acpi_pci_link_softc *sc, device_printf(sc->pl_dev, "Unable to build resources: %s\n", AcpiFormatException(status)); - if (srsbuf->Pointer != NULL) + if (srsbuf->Pointer != NULL) { AcpiOsFree(srsbuf->Pointer); + srsbuf->Pointer = NULL; + } return (status); } } @@ -867,6 +869,8 @@ acpi_pci_link_route_irqs(device_t dev) status = acpi_pci_link_srs_from_links(sc, &srsbuf); else status = acpi_pci_link_srs_from_crs(sc, &srsbuf); + if (ACPI_FAILURE(status)) + return (status); /* Write out new resources via _SRS. */ status = AcpiSetCurrentResources(acpi_get_handle(dev), &srsbuf); From owner-dev-commits-src-main@freebsd.org Wed May 26 17:40: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 ED1D4641D02; Wed, 26 May 2021 17:40: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 4Fqyrw6Mlpz3tTv; Wed, 26 May 2021 17:40:16 +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 BE91B152CD; Wed, 26 May 2021 17:40: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 14QHeGFk015458; Wed, 26 May 2021 17:40:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QHeGMG015452; Wed, 26 May 2021 17:40:16 GMT (envelope-from git) Date: Wed, 26 May 2021 17:40:16 GMT Message-Id: <202105261740.14QHeGMG015452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: fef99da69f98 - main - tests/libalias: Add missing prototype to fix build error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fef99da69f983566de3cb8ad4a1b8decc31348ce 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, 26 May 2021 17:40:17 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=fef99da69f983566de3cb8ad4a1b8decc31348ce commit fef99da69f983566de3cb8ad4a1b8decc31348ce Author: Lutz Donnerhacke AuthorDate: 2021-05-26 17:39:06 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-26 17:39:06 +0000 tests/libalias: Add missing prototype to fix build error --- tests/sys/netinet/libalias/perf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/sys/netinet/libalias/perf.c b/tests/sys/netinet/libalias/perf.c index e8de1e715013..b9e95a25b617 100644 --- a/tests/sys/netinet/libalias/perf.c +++ b/tests/sys/netinet/libalias/perf.c @@ -38,6 +38,8 @@ #include "util.h" #include +static void usage(void); + #define timevalcmp(tv, uv, cmp) \ (((tv).tv_sec == (uv).tv_sec) \ ? ((tv).tv_usec cmp (uv).tv_usec) \ From owner-dev-commits-src-main@freebsd.org Wed May 26 18:16: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 0D435642782; Wed, 26 May 2021 18:16: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 4Fqzg36y5pz4RTs; Wed, 26 May 2021 18:16: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 D6B09159A4; Wed, 26 May 2021 18:16: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 14QIGlhs063850; Wed, 26 May 2021 18:16:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QIGlYO063849; Wed, 26 May 2021 18:16:47 GMT (envelope-from git) Date: Wed, 26 May 2021 18:16:47 GMT Message-Id: <202105261816.14QIGlYO063849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: c358f1857f0c - main - tcp: Use local CC data only in the correct context MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c358f1857f0c749ad166fb9e9bef04f4033f3a72 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, 26 May 2021 18:16:48 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=c358f1857f0c749ad166fb9e9bef04f4033f3a72 commit c358f1857f0c749ad166fb9e9bef04f4033f3a72 Author: Richard Scheffenegger AuthorDate: 2021-05-26 17:45:06 +0000 Commit: Richard Scheffenegger CommitDate: 2021-05-26 18:15:53 +0000 tcp: Use local CC data only in the correct context Most CC algos do use local data, and when calling newreno_cong_signal from there, the latter misinterprets the data as its own struct, leading to incorrect behavior. Reported by: chengc_netapp.com Reviewed By: chengc_netapp.com, tuexen, #transport MFC after: 3 days Sponsored By: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D30470 --- sys/netinet/cc/cc_newreno.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c index 5f91ad8d1e7b..8f8ca953169e 100644 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -239,7 +239,12 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) cwin = CCV(ccv, snd_cwnd); mss = tcp_fixed_maxseg(ccv->ccvc.tcp); - nreno = ccv->cc_data; + /* + * Other TCP congestion controls use newreno_cong_signal(), but + * with their own private cc_data. Make sure the cc_data is used + * correctly. + */ + nreno = (CC_ALGO(ccv->ccvc.tcp) == &newreno_cc_algo) ? ccv->cc_data : NULL; beta = (nreno == NULL) ? V_newreno_beta : nreno->beta; beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; @@ -336,6 +341,9 @@ newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) if (sopt->sopt_valsize != sizeof(struct cc_newreno_opts)) return (EMSGSIZE); + if (CC_ALGO(ccv->ccvc.tcp) != &newreno_cc_algo) + return (ENOPROTOOPT); + nreno = ccv->cc_data; opt = buf; From owner-dev-commits-src-main@freebsd.org Wed May 26 18:43: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 7535F642D46; Wed, 26 May 2021 18:43: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 4Fr0FX2fjmz4SgS; Wed, 26 May 2021 18:43: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 4332816186; Wed, 26 May 2021 18:43: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 14QIhCY2003011; Wed, 26 May 2021 18:43:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QIhCMV003010; Wed, 26 May 2021 18:43:12 GMT (envelope-from git) Date: Wed, 26 May 2021 18:43:12 GMT Message-Id: <202105261843.14QIhCMV003010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 198566e04a1d - main - hwpmc: Move 4 bits of mode to extend class size to 8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 198566e04a1d6cf92a7152d8f7acd441b4498f34 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, 26 May 2021 18:43:12 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=198566e04a1d6cf92a7152d8f7acd441b4498f34 commit 198566e04a1d6cf92a7152d8f7acd441b4498f34 Author: Aleksandr Rybalko AuthorDate: 2021-05-26 18:39:00 +0000 Commit: Allan Jude CommitDate: 2021-05-26 18:40:58 +0000 hwpmc: Move 4 bits of mode to extend class size to 8 Since r289025 we have had at least 5 bits class size. Before that it was even 16 bits, but macro handling conversion between pmcid and set of CPU, MODE, CLASS, ROWINDEX still use 4 bits class size and 8 bits mode size. This breaks some libpmc API methods, like pmc_capabilities. Since we only have 4 modes and MODE field is a number (not a bitfield) this patch moves 4 bits of mode to extend the CLASS field. Reviewed by: mhorne, emaste Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D30047 --- sys/sys/pmc.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h index 9328a7bdfa05..7491a43023f3 100644 --- a/sys/sys/pmc.h +++ b/sys/sys/pmc.h @@ -404,7 +404,7 @@ typedef uint64_t pmc_value_t; * | CPU | PMC MODE | CLASS | ROW INDEX | * +-----------------------+-------+-----------+ * - * where CPU is 12 bits, MODE 8, CLASS 4, and ROW INDEX 8 Field 'CPU' + * where CPU is 12 bits, MODE 4, CLASS 8, and ROW INDEX 8 Field 'CPU' * is set to the requested CPU for system-wide PMCs or PMC_CPU_ANY for * process-mode PMCs. Field 'PMC MODE' is the allocated PMC mode. * Field 'PMC CLASS' is the class of the PMC. Field 'ROW INDEX' is the @@ -415,12 +415,12 @@ typedef uint64_t pmc_value_t; */ #define PMC_ID_TO_ROWINDEX(ID) ((ID) & 0xFF) -#define PMC_ID_TO_CLASS(ID) (((ID) & 0xF00) >> 8) -#define PMC_ID_TO_MODE(ID) (((ID) & 0xFF000) >> 12) +#define PMC_ID_TO_CLASS(ID) (((ID) & 0xFF00) >> 8) +#define PMC_ID_TO_MODE(ID) (((ID) & 0xF0000) >> 16) #define PMC_ID_TO_CPU(ID) (((ID) & 0xFFF00000) >> 20) #define PMC_ID_MAKE_ID(CPU,MODE,CLASS,ROWINDEX) \ - ((((CPU) & 0xFFF) << 20) | (((MODE) & 0xFF) << 12) | \ - (((CLASS) & 0xF) << 8) | ((ROWINDEX) & 0xFF)) + ((((CPU) & 0xFFF) << 20) | (((MODE) & 0xF) << 16) | \ + (((CLASS) & 0xFF) << 8) | ((ROWINDEX) & 0xFF)) /* * Data structures for system calls supported by the pmc driver. From owner-dev-commits-src-main@freebsd.org Wed May 26 18: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 73B47642DDE; Wed, 26 May 2021 18:45:57 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) (using TLSv1.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 4Fr0Jh05Yjz4SSN; Wed, 26 May 2021 18:45:55 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id 5261933EB8; Wed, 26 May 2021 14:45:49 -0400 (EDT) Received: from [192.168.1.5] (77.118.221.112.wireless.dyn.drei.com [77.118.221.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id 5EA2533EB7; Wed, 26 May 2021 14:45:48 -0400 (EDT) Date: Wed, 26 May 2021 20:45:39 +0200 (CEST) From: Gerald Pfeifer To: Mark Johnston cc: dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: [Bug 224927] lang/gcc48 lang/gcc49 lang/gcc5: Fix build with clang 6.0.0 In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4Fr0Jh05Yjz4SSN X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of gerald@pfeifer.com designates 209.68.5.143 as permitted sender) smtp.mailfrom=gerald@pfeifer.com X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[gerald]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+a:hamza.pair.com]; DMARC_NA(0.00)[pfeifer.com]; MID_RHS_MATCH_FROM(0.00)[]; SPAMHAUS_ZRD(0.00)[209.68.5.143:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.68.5.143:from]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7859, ipnet:209.68.0.0/18, country:US]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] 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, 26 May 2021 18:45:57 -0000 On Wed, 26 May 2021, bugzilla-noreply@freebsd.org wrote: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224927 > > --- Comment #8 from commit-hook@FreeBSD.org --- > A commit in branch main references this bug: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=16f8f89c5c1f324a15a7e0607f03f041a230a572 > > commit 16f8f89c5c1f324a15a7e0607f03f041a230a572 > Author: Mark Johnston > AuthorDate: 2021-05-26 14:02:19 +0000 > Commit: Mark Johnston > CommitDate: 2021-05-26 14:45:40 +0000 > > cxgb: Avoid a read-after-free in get_packet() when cxgb_debug is on > > PR: 224927 > MFC after: 1 week > > sys/dev/cxgb/cxgb_sge.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Hmm - lang/gcc49 and lang/gcc5 haven't been in the ports tree for some quarters. How did they make the subject line of this commit? ;-) The bug report also seems quite unrelated to a device driver? Gerald From owner-dev-commits-src-main@freebsd.org Wed May 26 18:56: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 B9702642C4D; Wed, 26 May 2021 18:56:04 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) (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 4Fr0XN4Jhmz4TMv; Wed, 26 May 2021 18:56:04 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qv1-xf30.google.com with SMTP id 5so1327807qvk.0; Wed, 26 May 2021 11:56:04 -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=pA2c5wGTJpMqhoNivn0Tb3YxNU8+Gpli1MEJXHEsRVI=; b=gBhJuWXyuDsvQlEa5IxIbcFljT+5R+3nuQ0VPIqaWipbt0FFl6k7lKfOEN5bgBJcPR XDA/5jRKdRjYLvYaau5g8/28bj6QGVDxs8x8jY+mMELmoS/BER+Yd6OcAHaVb5+1ZVtR A5ToHds9+xGBa62qnRfpPAH52LWbaECE2mtI0VNKW7ljKRaHjkpOAMvkxgcqxw5vz9uK 0FDzCBhuSGPO9sz/ip52xy9oFtYqD5OkgYE4icCqs8TDBsyPBOkWyF/VjLcfx8zWztEX ELvBlP9V0fNUfFxFT0bfq4TutqvQyVYD5rXMk0jMt9QgNap2WKVk2AUKneNQuptZ/lPg Qipg== 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=pA2c5wGTJpMqhoNivn0Tb3YxNU8+Gpli1MEJXHEsRVI=; b=Ef/3WIDCBiLUlRV3jwDQjAPq+NBdl2BnRDDXRv1Wr5etmHEHaQN2UKJsAYv8szJpqr 2SyJxuh/UVxvZzYWIT0u6Q5/iO6h40/H9p8KvF1OQRigvHgCXwtKoe86U+rOyy2g8DRO 1vgkQpZfv0q9jbPL3vzKtQVeeucL6KMysdbRd2Ak9mDWxVQiKL2pnXix+h3MzK9yyIEZ bCYd+3gnK/s91gpsAFu5QmEFNsX3nbMF/TnNz1g9eFdeO2P8WyPzmroeD/ilIpPOMoHe eFcPI0pERijlYNEfWU0HDWb1O1GWcSC9NOIk4BFpAfA7ApDtg7561v1YHzTbojzIHruJ PSDw== X-Gm-Message-State: AOAM530JHsffGGzz9c2yp8Gbr/cXrwUhMfWUYeopExEN5A0xTvO2jgtl rGjFmij45MDFNVVzSmlU7dHp2mmW9dY= X-Google-Smtp-Source: ABdhPJxctocPKwbPMSu5TVvxL2PMCp2W3xi9mDxxBfLCmWTBDkxg2WvKUp+YANchyGx9wyl6PIc5AQ== X-Received: by 2002:a0c:fb52:: with SMTP id b18mr45271578qvq.8.1622055363464; Wed, 26 May 2021 11:56:03 -0700 (PDT) Received: from nuc ([142.126.172.178]) by smtp.gmail.com with ESMTPSA id t12sm2071038qti.22.2021.05.26.11.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 11:56:02 -0700 (PDT) Sender: Mark Johnston Date: Wed, 26 May 2021 14:56:03 -0400 From: Mark Johnston To: Gerald Pfeifer Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, src-committers@freebsd.org Subject: Re: [Bug 224927] lang/gcc48 lang/gcc49 lang/gcc5: Fix build with clang 6.0.0 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4Fr0XN4Jhmz4TMv 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, 26 May 2021 18:56:04 -0000 On Wed, May 26, 2021 at 08:45:39PM +0200, Gerald Pfeifer wrote: > On Wed, 26 May 2021, bugzilla-noreply@freebsd.org wrote: > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224927 > > > > --- Comment #8 from commit-hook@FreeBSD.org --- > > A commit in branch main references this bug: > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=16f8f89c5c1f324a15a7e0607f03f041a230a572 > > > > commit 16f8f89c5c1f324a15a7e0607f03f041a230a572 > > Author: Mark Johnston > > AuthorDate: 2021-05-26 14:02:19 +0000 > > Commit: Mark Johnston > > CommitDate: 2021-05-26 14:45:40 +0000 > > > > cxgb: Avoid a read-after-free in get_packet() when cxgb_debug is on > > > > PR: 224927 > > MFC after: 1 week > > > > sys/dev/cxgb/cxgb_sge.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > Hmm - lang/gcc49 and lang/gcc5 haven't been in the ports tree for > some quarters. How did they make the subject line of this commit? ;-) > > The bug report also seems quite unrelated to a device driver? Sorry, of course that's the wrong PR, it should be 255863. I'm not sure how I screwed that up. From owner-dev-commits-src-main@freebsd.org Wed May 26 20: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 4A8436454CC; Wed, 26 May 2021 20: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 4Fr21T1QxJz4cVv; Wed, 26 May 2021 20: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 1942516BEF; Wed, 26 May 2021 20:02: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 14QK2roW013739; Wed, 26 May 2021 20:02:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QK2q6s013738; Wed, 26 May 2021 20:02:52 GMT (envelope-from git) Date: Wed, 26 May 2021 20:02:52 GMT Message-Id: <202105262002.14QK2q6s013738@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: f4c460dacdda - main - tests/libalias: Fix build error due to wrong prototype MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4c460dacdda5c6e1896a0c51d6096c4f3417b32 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, 26 May 2021 20:02:53 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=f4c460dacdda5c6e1896a0c51d6096c4f3417b32 commit f4c460dacdda5c6e1896a0c51d6096c4f3417b32 Author: Lutz Donnerhacke AuthorDate: 2021-05-26 19:59:12 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-26 19:59:12 +0000 tests/libalias: Fix build error due to wrong prototype --- tests/sys/netinet/libalias/perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/netinet/libalias/perf.c b/tests/sys/netinet/libalias/perf.c index b9e95a25b617..3c0b0d593f4c 100644 --- a/tests/sys/netinet/libalias/perf.c +++ b/tests/sys/netinet/libalias/perf.c @@ -58,7 +58,7 @@ static void usage(void); } } while(0) static void -usage() { +usage(void) { printf("Usage: perf [max_seconds [batch_size [random_size [attack_size [redir_size]]]]]\n"); exit(1); } From owner-dev-commits-src-main@freebsd.org Wed May 26 20:07: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 50DCE645616; Wed, 26 May 2021 20:07:33 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (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 4Fr26s0Drmz4cfl; Wed, 26 May 2021 20:07:32 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 14QK7D31024958 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 26 May 2021 22:07:13 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 14QK7CMc017069; Wed, 26 May 2021 22:07:12 +0200 Date: Wed, 26 May 2021 22:07:12 +0200 From: Lutz Donnerhacke To: Lutz Donnerhacke Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: f4c460dacdda - main - tests/libalias: Fix build error due to wrong prototype Message-ID: <20210526200712.GA17000@belenus.iks-jena.de> References: <202105262002.14QK2q6s013738@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202105262002.14QK2q6s013738@gitrepo.freebsd.org> X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4Fr26s0Drmz4cfl 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, 26 May 2021 20:07:33 -0000 On Wed, May 26, 2021 at 08:02:52PM +0000, Lutz Donnerhacke wrote: > tests/libalias: Fix build error due to wrong prototype I don't know, how to test it beforehand. Jenkins is using a much more stricter set of options, than the normal kernel build. From owner-dev-commits-src-main@freebsd.org Wed May 26 20:37: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 70D62645A9D; Wed, 26 May 2021 20:37: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 4Fr2n62mzdz4ghL; Wed, 26 May 2021 20:37: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 4816E1781A; Wed, 26 May 2021 20:37: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 14QKbEiU054025; Wed, 26 May 2021 20:37:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QKbEJp054024; Wed, 26 May 2021 20:37:14 GMT (envelope-from git) Date: Wed, 26 May 2021 20:37:14 GMT Message-Id: <202105262037.14QKbEJp054024@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: 8d5c7813061d - main - libradius: Fix input validation bugs 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: 8d5c7813061dfa0b187500dfe3aeea7a28181c13 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, 26 May 2021 20:37:14 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8d5c7813061dfa0b187500dfe3aeea7a28181c13 commit 8d5c7813061dfa0b187500dfe3aeea7a28181c13 Author: Mark Johnston AuthorDate: 2021-05-25 17:59:09 +0000 Commit: Mark Johnston CommitDate: 2021-05-26 20:30:23 +0000 libradius: Fix input validation bugs Approved by: so Security: FreeBSD-SA-21:12.libradius Security: CVE-2021-29629 MFC after: now Sponsored by: The FreeBSD Foundation --- lib/libradius/radlib.c | 54 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/lib/libradius/radlib.c b/lib/libradius/radlib.c index e01c486a1ba6..18aee8b53024 100644 --- a/lib/libradius/radlib.c +++ b/lib/libradius/radlib.c @@ -187,7 +187,7 @@ is_valid_response(struct rad_handle *h, int srv, MD5_CTX ctx; unsigned char md5[MD5_DIGEST_LENGTH]; const struct rad_server *srvp; - int len; + int alen, len; #ifdef WITH_SSL HMAC_CTX *hctx; u_char resp[MSGSIZE], md[EVP_MAX_MD_SIZE]; @@ -206,8 +206,8 @@ is_valid_response(struct rad_handle *h, int srv, /* Check the message length */ if (h->in_len < POS_ATTRS) return 0; - len = h->in[POS_LENGTH] << 8 | h->in[POS_LENGTH+1]; - if (len > h->in_len) + len = (h->in[POS_LENGTH] << 8) | h->in[POS_LENGTH + 1]; + if (len < POS_ATTRS || len > h->in_len) return 0; /* Check the response authenticator */ @@ -233,9 +233,16 @@ is_valid_response(struct rad_handle *h, int srv, /* Search and verify the Message-Authenticator */ hctx = HMAC_CTX_new(); while (pos < len - 2) { - if (h->in[pos] == RAD_MESSAGE_AUTHENTIC) { - /* zero fill the Message-Authenticator */ + if (h->in[pos + 1] != MD5_DIGEST_LENGTH + 2) { + HMAC_CTX_free(hctx); + return 0; + } + if (len - pos < MD5_DIGEST_LENGTH + 2) { + HMAC_CTX_free(hctx); + return 0; + } + memset(&resp[pos + 2], 0, MD5_DIGEST_LENGTH); HMAC_Init_ex(hctx, srvp->secret, @@ -255,7 +262,12 @@ is_valid_response(struct rad_handle *h, int srv, } break; } - pos += h->in[pos + 1]; + alen = h->in[pos + 1]; + if (alen < 2) { + HMAC_CTX_free(hctx); + return 0; + } + pos += alen; } HMAC_CTX_free(hctx); } @@ -272,7 +284,7 @@ is_valid_request(struct rad_handle *h) MD5_CTX ctx; unsigned char md5[MD5_DIGEST_LENGTH]; const struct rad_server *srvp; - int len; + int alen, len; #ifdef WITH_SSL HMAC_CTX *hctx; u_char resp[MSGSIZE], md[EVP_MAX_MD_SIZE]; @@ -285,8 +297,8 @@ is_valid_request(struct rad_handle *h) /* Check the message length */ if (h->in_len < POS_ATTRS) return (0); - len = h->in[POS_LENGTH] << 8 | h->in[POS_LENGTH+1]; - if (len > h->in_len) + len = (h->in[POS_LENGTH] << 8) | h->in[POS_LENGTH + 1]; + if (len < POS_ATTRS || len > h->in_len) return (0); if (h->in[POS_CODE] != RAD_ACCESS_REQUEST) { @@ -307,7 +319,18 @@ is_valid_request(struct rad_handle *h) pos = POS_ATTRS; hctx = HMAC_CTX_new(); while (pos < len - 2) { + alen = h->in[pos + 1]; + if (alen < 2) + return (0); if (h->in[pos] == RAD_MESSAGE_AUTHENTIC) { + if (len - pos < MD5_DIGEST_LENGTH + 2) { + HMAC_CTX_free(hctx); + return (0); + } + if (alen < MD5_DIGEST_LENGTH + 2) { + HMAC_CTX_free(hctx); + return (0); + } memcpy(resp, h->in, MSGSIZE); /* zero fill the Request-Authenticator */ if (h->in[POS_CODE] != RAD_ACCESS_REQUEST) @@ -327,7 +350,7 @@ is_valid_request(struct rad_handle *h) } break; } - pos += h->in[pos + 1]; + pos += alen; } HMAC_CTX_free(hctx); #endif @@ -929,9 +952,9 @@ rad_cvt_string(const void *data, size_t len) * returns -1. */ int -rad_get_attr(struct rad_handle *h, const void **value, size_t *len) +rad_get_attr(struct rad_handle *h, const void **value, size_t *lenp) { - int type; + int len, type; if (h->in_pos >= h->in_len) return 0; @@ -940,13 +963,14 @@ rad_get_attr(struct rad_handle *h, const void **value, size_t *len) return -1; } type = h->in[h->in_pos++]; - *len = h->in[h->in_pos++] - 2; - if (h->in_pos + (int)*len > h->in_len) { + len = h->in[h->in_pos++]; + if (len < 2 || h->in_pos + len > h->in_len) { generr(h, "Malformed attribute in response"); return -1; } + *lenp = len; *value = &h->in[h->in_pos]; - h->in_pos += *len; + h->in_pos += len; return type; } From owner-dev-commits-src-main@freebsd.org Thu May 27 05:44: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 E8F6C6332B1; Thu, 27 May 2021 05:44: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 4FrGwF2bMwz3qmF; Thu, 27 May 2021 05:44: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 40C551ED09; Thu, 27 May 2021 05:44: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 14R5iD98085065; Thu, 27 May 2021 05:44:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14R5iD8k085064; Thu, 27 May 2021 05:44:13 GMT (envelope-from git) Date: Thu, 27 May 2021 05:44:13 GMT Message-Id: <202105270544.14R5iD8k085064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 740d722def71 - main - cxgbe(4): Use correct argument in call to hashdestroy. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 740d722def71905dd74a622acce1561701ccbec6 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, 27 May 2021 05:44:14 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=740d722def71905dd74a622acce1561701ccbec6 commit 740d722def71905dd74a622acce1561701ccbec6 Author: Navdeep Parhar AuthorDate: 2021-05-27 04:32:13 +0000 Commit: Navdeep Parhar CommitDate: 2021-05-27 05:31:06 +0000 cxgbe(4): Use correct argument in call to hashdestroy. This fixes a panic on driver module unload. Fixes: 24b98f288d11 cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_clip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/t4_clip.c b/sys/dev/cxgbe/t4_clip.c index 18d78a9e830b..98734d6d11ce 100644 --- a/sys/dev/cxgbe/t4_clip.c +++ b/sys/dev/cxgbe/t4_clip.c @@ -712,7 +712,7 @@ t4_destroy_clip_table(struct adapter *sc) free(ce, M_CXGBE); } } - hashdestroy(&sc->clip_table, M_CXGBE, sc->clip_mask); + hashdestroy(sc->clip_table, M_CXGBE, sc->clip_mask); sc->clip_table = NULL; done: mtx_unlock(&clip_db_lock); @@ -856,7 +856,7 @@ t4_clip_modunload(void) { EVENTHANDLER_DEREGISTER(ifaddr_event_ext, ifaddr_evhandler); taskqueue_drain(taskqueue_thread, &clip_db_task); - hashdestroy(&clip_db, M_CXGBE, clip_db_mask); + hashdestroy(clip_db, M_CXGBE, clip_db_mask); mtx_destroy(&clip_db_lock); } #endif From owner-dev-commits-src-main@freebsd.org Thu May 27 06:00: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 9FCA6633322; Thu, 27 May 2021 06:00: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 4FrHHF3wwpz3syf; Thu, 27 May 2021 06:00: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 6F25A1EBF0; Thu, 27 May 2021 06:00: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 14R60fWe007538; Thu, 27 May 2021 06:00:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14R60fSB007537; Thu, 27 May 2021 06:00:41 GMT (envelope-from git) Date: Thu, 27 May 2021 06:00:41 GMT Message-Id: <202105270600.14R60fSB007537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 5ef87bf8b687 - main - cxgbe(4): Fix an incorrect assert. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ef87bf8b687575bee010967e23cd2c552b43ad9 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, 27 May 2021 06:00:41 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=5ef87bf8b687575bee010967e23cd2c552b43ad9 commit 5ef87bf8b687575bee010967e23cd2c552b43ad9 Author: Navdeep Parhar AuthorDate: 2021-05-27 02:18:42 +0000 Commit: Navdeep Parhar CommitDate: 2021-05-27 05:57:06 +0000 cxgbe(4): Fix an incorrect assert. CTRL and OFLD tx queues do not have automatic tx credit flush enabled so it is okay for the cidx not to be the same as the pidx when the queue is destroyed. Reported by: Jithesh Arakkan @ Chelsio MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_sge.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 0b429c602a91..5091c8f992bd 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4346,7 +4346,8 @@ static void free_eq(struct adapter *sc, struct sge_eq *eq) { MPASS(eq->flags & EQ_SW_ALLOCATED); - MPASS(eq->pidx == eq->cidx); + if (eq->type == EQ_ETH) + MPASS(eq->pidx == eq->cidx); free_ring(sc, eq->desc_tag, eq->desc_map, eq->ba, eq->desc); mtx_destroy(&eq->eq_lock); @@ -4499,6 +4500,8 @@ free_wrq(struct adapter *sc, struct sge_wrq *wrq) { free_eq(sc, &wrq->eq); MPASS(wrq->nwr_pending == 0); + MPASS(TAILQ_EMPTY(&wrq->incomplete_wrs)); + MPASS(STAILQ_EMPTY(&wrq->wr_list)); bzero(wrq, sizeof(*wrq)); } From owner-dev-commits-src-main@freebsd.org Thu May 27 06:54: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 7C7C7634491; Thu, 27 May 2021 06:54: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 4FrJTR2sFFz4TVJ; Thu, 27 May 2021 06:54: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 4B3EA1F8C1; Thu, 27 May 2021 06:54: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 14R6sZfW078582; Thu, 27 May 2021 06:54:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14R6sZxY078581; Thu, 27 May 2021 06:54:35 GMT (envelope-from git) Date: Thu, 27 May 2021 06:54:35 GMT Message-Id: <202105270654.14R6sZxY078581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 0a9e7899e270 - main - stress2: Removed three mksnap_ffs(8) tests from the exclude list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a9e7899e2700d21a68785db5357ccc982304903 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, 27 May 2021 06:54:35 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=0a9e7899e2700d21a68785db5357ccc982304903 commit 0a9e7899e2700d21a68785db5357ccc982304903 Author: Peter Holm AuthorDate: 2021-05-27 06:52:12 +0000 Commit: Peter Holm CommitDate: 2021-05-27 06:52:12 +0000 stress2: Removed three mksnap_ffs(8) tests from the exclude list --- tools/test/stress2/misc/all.exclude | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index 27142b026538..4f818b53a976 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -51,9 +51,6 @@ quota7.sh panic: dqflush: stray dquot 20120221 sctp3.sh panic: Queues are not empty when handling SHUTDOWN-COMPLETE 20210211 sendfile25.sh WiP 20200611 signal.sh Timing issues. Needs fixing 20171116 -snap8.sh https://people.freebsd.org/~pho/stress/log/log0049.txt 20210216 -snap9.sh panic: handle_written_filepage: not started 20170722 -snap11.sh panic: handle_written_filepage: not started 20200928 swapoff2.sh swap_pager_force_pagein: read from swap failed 20171223 swapoff5.sh log0005.txt, known issue 20210111 systrace.sh WiP 20200227 From owner-dev-commits-src-main@freebsd.org Thu May 27 07:44: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 45E8C634EC2; Thu, 27 May 2021 07:44: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 4FrKZq1Wpbz4YS5; Thu, 27 May 2021 07:44: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 185ED20521; Thu, 27 May 2021 07:44: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 14R7iI3X044366; Thu, 27 May 2021 07:44:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14R7iIC0044365; Thu, 27 May 2021 07:44:18 GMT (envelope-from git) Date: Thu, 27 May 2021 07:44:18 GMT Message-Id: <202105270744.14R7iIC0044365@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: 16fa3dcba027 - main - ibstat: Include prototype for sysctlbyname(). 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: 16fa3dcba027d13dcda9ee78e6057e3e5a79f80c 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, 27 May 2021 07:44:19 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=16fa3dcba027d13dcda9ee78e6057e3e5a79f80c commit 16fa3dcba027d13dcda9ee78e6057e3e5a79f80c Author: Hans Petter Selasky AuthorDate: 2021-05-27 07:39:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-27 07:42:30 +0000 ibstat: Include prototype for sysctlbyname(). Fixes the following compile warning: implicit declaration of function 'sysctlbyname' is invalid in C99 [-Wimplicit-function-declaration] Found by: J87 Differential Revision: https://reviews.freebsd.org/D30484 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- contrib/ofed/infiniband-diags/src/ibstat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/ofed/infiniband-diags/src/ibstat.c b/contrib/ofed/infiniband-diags/src/ibstat.c index 6e08fad409ca..e4f3608dfd76 100644 --- a/contrib/ofed/infiniband-diags/src/ibstat.c +++ b/contrib/ofed/infiniband-diags/src/ibstat.c @@ -48,6 +48,7 @@ #include #include #include +#include #include From owner-dev-commits-src-main@freebsd.org Thu May 27 12:39: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 C628D63C580; Thu, 27 May 2021 12:39: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 4FrS7G51Hvz3M2l; Thu, 27 May 2021 12:39: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 940FF23C62; Thu, 27 May 2021 12:39: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 14RCdMcZ034008; Thu, 27 May 2021 12:39:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RCdMUK034007; Thu, 27 May 2021 12:39:22 GMT (envelope-from git) Date: Thu, 27 May 2021 12:39:22 GMT Message-Id: <202105271239.14RCdMUK034007@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: 60afad6fc307 - main - mlx4: replace LinuxKPI macros with ifnet functions 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: 60afad6fc307815ad2b70a9974d908b6d5d50674 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, 27 May 2021 12:39:22 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=60afad6fc307815ad2b70a9974d908b6d5d50674 commit 60afad6fc307815ad2b70a9974d908b6d5d50674 Author: Bjoern A. Zeeb AuthorDate: 2021-05-26 17:47:02 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-27 12:26:01 +0000 mlx4: replace LinuxKPI macros with ifnet functions The LinuxKPI net_device actually is an ifnet; in order to further clean that up so we can extend "net_device" replace the few macros inline in mlx4. Sponsored by: The FreeBSD Foundation MFC after: 12 days Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D30476 --- sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c | 2 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 21 +++++++++++---------- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c index 76f78a9e2c9d..33c0f9e6b4e2 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c @@ -98,7 +98,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr if (gid_attr.ndev) { vlan_tag = rdma_vlan_dev_vlan_id(gid_attr.ndev); memcpy(ah->av.eth.s_mac, IF_LLADDR(gid_attr.ndev), ETH_ALEN); - dev_put(gid_attr.ndev); + if_rele(gid_attr.ndev); } if (vlan_tag < 0x1000) vlan_tag |= (ah_attr->sl & 7) << 13; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index b31744e73be6..b050272e49d0 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -156,7 +156,7 @@ static struct net_device *mlx4_ib_get_netdev(struct ib_device *device, u8 port_n } #endif if (dev) - dev_hold(dev); + if_ref(dev); rcu_read_unlock(); return dev; @@ -415,7 +415,7 @@ int mlx4_ib_gid_index_to_real_index(struct mlx4_ib_dev *ibdev, return ret; if (attr.ndev) - dev_put(attr.ndev); + if_rele(attr.ndev); if (!memcmp(&gid, &zgid, sizeof(gid))) return -EINVAL; @@ -736,7 +736,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, tmp = iboe_get_mtu(ndev->if_mtu); props->active_mtu = tmp ? min(props->max_mtu, tmp) : IB_MTU_256; - props->state = (netif_running(ndev) && netif_carrier_ok(ndev)) ? + props->state = ((ndev->if_drv_flags & IFF_DRV_RUNNING) != 0 && + ndev->if_link_state == LINK_STATE_UP) ? IB_PORT_ACTIVE : IB_PORT_DOWN; props->phys_state = state_to_phys_state(props->state); out_unlock: @@ -1356,12 +1357,12 @@ int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp, spin_lock_bh(&mdev->iboe.lock); ndev = mdev->iboe.netdevs[mqp->port - 1]; if (ndev) - dev_hold(ndev); + if_ref(ndev); spin_unlock_bh(&mdev->iboe.lock); if (ndev) { ret = 1; - dev_put(ndev); + if_rele(ndev); } return ret; @@ -2002,10 +2003,10 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) spin_lock_bh(&mdev->iboe.lock); ndev = ge->added ? mdev->iboe.netdevs[ge->port - 1] : NULL; if (ndev) - dev_hold(ndev); + if_ref(ndev); spin_unlock_bh(&mdev->iboe.lock); if (ndev) - dev_put(ndev); + if_rele(ndev); list_del(&ge->list); kfree(ge); } else @@ -2372,7 +2373,7 @@ static int mlx4_ib_netdev_event(struct notifier_block *this, struct net_device *dev = netdev_notifier_info_to_dev(ptr); struct mlx4_ib_dev *ibdev; - if (!net_eq(dev_net(dev), &init_net)) + if (dev->if_vnet != &init_net) return NOTIFY_DONE; ibdev = container_of(this, struct mlx4_ib_dev, iboe.nb); @@ -3111,8 +3112,8 @@ static void handle_bonded_port_state_event(struct work_struct *work) continue; curr_port_state = - (netif_running(curr_netdev) && - netif_carrier_ok(curr_netdev)) ? + ((curr_netdev->if_drv_flags & IFF_DRV_RUNNING) != 0 && + curr_netdev->if_link_state == LINK_STATE_UP) ? IB_PORT_ACTIVE : IB_PORT_DOWN; bonded_port_state = (bonded_port_state != IB_PORT_ACTIVE) ? diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c index a3bd86b182cb..3b81797b46b0 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c @@ -1783,7 +1783,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, if (!status && gid_attr.ndev) { vlan = rdma_vlan_dev_vlan_id(gid_attr.ndev); memcpy(smac, IF_LLADDR(gid_attr.ndev), ETH_ALEN); - dev_put(gid_attr.ndev); + if_rele(gid_attr.ndev); } } if (status) @@ -2471,7 +2471,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr, &gid_attr); if (!err) { if (gid_attr.ndev) - dev_put(gid_attr.ndev); + if_rele(gid_attr.ndev); if (!memcmp(&sgid, &zgid, sizeof(sgid))) err = -ENOENT; } @@ -2962,7 +2962,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, ah->av.ib.gid_index, &gid, &gid_attr)) { if (gid_attr.ndev) - dev_put(gid_attr.ndev); + if_rele(gid_attr.ndev); qp = (gid_attr.gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) ? to_mqp(sqp->roce_v2_gsi) : qp; } else { From owner-dev-commits-src-main@freebsd.org Thu May 27 12:39: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 85D5D63C4A2; Thu, 27 May 2021 12:39: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 4FrS7K19jSz3M7L; Thu, 27 May 2021 12:39: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 D802124333; Thu, 27 May 2021 12:39: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 14RCdOuG034050; Thu, 27 May 2021 12:39:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RCdOB9034049; Thu, 27 May 2021 12:39:24 GMT (envelope-from git) Date: Thu, 27 May 2021 12:39:24 GMT Message-Id: <202105271239.14RCdOB9034049@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: 9b6835f3ab7f - main - LinuxKPI: netdevice.h remove more ifnet operating macros 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: 9b6835f3ab7f05728caeaaa2ade09e80f1c5e825 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, 27 May 2021 12:39:25 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=9b6835f3ab7f05728caeaaa2ade09e80f1c5e825 commit 9b6835f3ab7f05728caeaaa2ade09e80f1c5e825 Author: Bjoern A. Zeeb AuthorDate: 2021-05-26 17:55:21 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-27 12:26:01 +0000 LinuxKPI: netdevice.h remove more ifnet operating macros Now that mlx4 and ofed either are operating on ifnet functions directly or have a private copy of these macros, we can remove them from linux/netdevice.h. With this only the #define for net_device to ifnet is left. Sponsored by: The FreeBSD Foundation MFC after: 12 days Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D30478 --- sys/compat/linuxkpi/common/include/linux/netdevice.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h index 07c111cc4fc9..faff2fde5f32 100644 --- a/sys/compat/linuxkpi/common/include/linux/netdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h @@ -53,15 +53,6 @@ #define net_device ifnet -#define dev_hold(d) if_ref(d) -#define dev_put(d) if_rele(d) -#define dev_net(d) ((d)->if_vnet) - -#define net_eq(a,b) ((a) == (b)) - -#define netif_running(dev) !!((dev)->if_drv_flags & IFF_DRV_RUNNING) -#define netif_carrier_ok(dev) ((dev)->if_link_state == LINK_STATE_UP) - #define rtnl_lock() #define rtnl_unlock() From owner-dev-commits-src-main@freebsd.org Thu May 27 12:39: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 E2FFC63C506; Thu, 27 May 2021 12:39: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 4FrS7H5zWrz3M0j; Thu, 27 May 2021 12:39: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 B653D240DB; Thu, 27 May 2021 12:39: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 14RCdNo7034029; Thu, 27 May 2021 12:39:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RCdNOY034028; Thu, 27 May 2021 12:39:23 GMT (envelope-from git) Date: Thu, 27 May 2021 12:39:23 GMT Message-Id: <202105271239.14RCdNOY034028@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: 825b7d4c9d1d - main - OFED: migrate LinuxKPI net_device/ifnet macros into ofed 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: 825b7d4c9d1d7cb0c79ffe002bc1bd58f28e1a67 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, 27 May 2021 12:39:24 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=825b7d4c9d1d7cb0c79ffe002bc1bd58f28e1a67 commit 825b7d4c9d1d7cb0c79ffe002bc1bd58f28e1a67 Author: Bjoern A. Zeeb AuthorDate: 2021-05-26 17:51:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-27 12:26:01 +0000 OFED: migrate LinuxKPI net_device/ifnet macros into ofed The LinuxKPI net_device actually is an ifnet; in order to further clean that up so we can extend "net_device" migrate the few macros left into ofed and make sure the header is included in all files which need access to the macros. Sponsored by: The FreeBSD Foundation MFC after: 12 days Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D30477 --- sys/ofed/drivers/infiniband/core/ib_cache.c | 1 + sys/ofed/drivers/infiniband/core/ib_cm.c | 1 + sys/ofed/drivers/infiniband/core/ib_sysfs.c | 1 + sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 + sys/ofed/include/rdma/ib_addr.h | 7 +++++++ 5 files changed, 11 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cache.c b/sys/ofed/drivers/infiniband/core/ib_cache.c index ac6382f69b95..a5bc498303c6 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cache.c +++ b/sys/ofed/drivers/infiniband/core/ib_cache.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "core_priv.h" diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 28c52c0cb2f2..7d5197cc4a0d 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include "cm_msgs.h" diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index 5f848a7a69db..fb9884a7ea08 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c index 27f4da93ccba..1e4358ba0a15 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include MODULE_AUTHOR("Roland Dreier"); diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h index 535e6c2b3b14..cea39f288207 100644 --- a/sys/ofed/include/rdma/ib_addr.h +++ b/sys/ofed/include/rdma/ib_addr.h @@ -51,6 +51,13 @@ #include #include +/* Linux netdevice.h but for working on an ifnet rather than a net_device. */ +#define dev_hold(d) if_ref(d) +#define dev_put(d) if_rele(d) +#define dev_net(d) ((d)->if_vnet) +#define net_eq(a,b) ((a) == (b)) + + struct rdma_addr_client { atomic_t refcount; struct completion comp; From owner-dev-commits-src-main@freebsd.org Thu May 27 13:52: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 63F9163DBC8; Thu, 27 May 2021 13:52: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 4FrTlr23Hmz3jTQ; Thu, 27 May 2021 13:52: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 2E09F252CA; Thu, 27 May 2021 13:52: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 14RDqeM4040184; Thu, 27 May 2021 13:52:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RDqeOA040183; Thu, 27 May 2021 13:52:40 GMT (envelope-from git) Date: Thu, 27 May 2021 13:52:40 GMT Message-Id: <202105271352.14RDqeOA040183@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: 4cc8a9da491d - main - LinuxKPI: add HWEIGHT32() 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: 4cc8a9da491d10f1b4bad6a50730b67dd5e899c7 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, 27 May 2021 13:52:40 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4cc8a9da491d10f1b4bad6a50730b67dd5e899c7 commit 4cc8a9da491d10f1b4bad6a50730b67dd5e899c7 Author: Bjoern A. Zeeb AuthorDate: 2021-05-27 13:09:40 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-05-27 13:38:30 +0000 LinuxKPI: add HWEIGHT32() Add HWEIGHT32() macro needed by iwlwifi and while here add the 8/16/64 variants likewise. Sponsored by: The FreeBSD Foundation MFC after: 12 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30501 --- sys/compat/linuxkpi/common/include/linux/bitops.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index 0e25fd3cfb1d..49bfc4cc7414 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -63,6 +63,11 @@ #define hweight64(x) bitcount64(x) #define hweight_long(x) bitcountl(x) +#define HWEIGHT8(x) (bitcount8((uint8_t)(x)) + 1) +#define HWEIGHT16(x) (bitcount16(x) + 1) +#define HWEIGHT32(x) (bitcount32(x) + 1) +#define HWEIGHT64(x) (bitcount64(x) + 1) + static inline int __ffs(int mask) { From owner-dev-commits-src-main@freebsd.org Thu May 27 14: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 C803963ED40; Thu, 27 May 2021 14:51: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 4FrW3q5MFRz3nqv; Thu, 27 May 2021 14:51: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 959022628A; Thu, 27 May 2021 14:51: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 14REpZ6A015905; Thu, 27 May 2021 14:51:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14REpZjN015904; Thu, 27 May 2021 14:51:35 GMT (envelope-from git) Date: Thu, 27 May 2021 14:51:35 GMT Message-Id: <202105271451.14REpZjN015904@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: 8c69d988a8d3 - main - tcp: When we have an out-of-order FIN we do want to strip off the FIN bit. 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: 8c69d988a8d32e53310c7b73ec8721b04b7249e6 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, 27 May 2021 14:51:35 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=8c69d988a8d32e53310c7b73ec8721b04b7249e6 commit 8c69d988a8d32e53310c7b73ec8721b04b7249e6 Author: Randall Stewart AuthorDate: 2021-05-27 14:50:32 +0000 Commit: Randall Stewart CommitDate: 2021-05-27 14:50:32 +0000 tcp: When we have an out-of-order FIN we do want to strip off the FIN bit. The last set of commits fixed both a panic (in rack) and an ACK-war (in freebsd and bbr). However there was a missing case, i.e. where we get an out-of-order FIN by itself. In such a case we don't want to leave the FIN bit set, otherwise we will do the wrong thing and ack the FIN incorrectly. Instead we need to go through the tcp_reasm() code and that way the FIN will be stripped and all will be well. Reviewed by: mtuexen,rscheff Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30497 --- sys/netinet/tcp_input.c | 7 ++++++- sys/netinet/tcp_stacks/bbr.c | 7 ++++++- sys/netinet/tcp_stacks/rack.c | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index b9836a137608..1dab2e511d95 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -3191,7 +3191,12 @@ dodata: /* XXX */ * when trimming from the head. */ tcp_seq temp = save_start; - if (tlen) { + if (tlen || (th->th_seq != tp->rcv_nxt)) { + /* + * We add the th_seq != rcv_nxt to + * catch the case of a stand alone out + * of order FIN. + */ thflags = tcp_reass(tp, th, &temp, &tlen, m); tp->t_flags |= TF_ACKNOW; } diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index b2fc5c1f928e..5b97c3d7800f 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -8320,7 +8320,12 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, * trimming from the head. */ tcp_seq temp = save_start; - if (tlen) { + if (tlen || (th->th_seq != tp->rcv_nxt)) { + /* + * We add the th_seq != rcv_nxt to + * catch the case of a stand alone out + * of order FIN. + */ thflags = tcp_reass(tp, th, &temp, &tlen, m); tp->t_flags |= TF_ACKNOW; } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index b7e8c1578f2b..1db09e30d968 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -10235,7 +10235,12 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, * trimming from the head. */ tcp_seq temp = save_start; - if (tlen) { + if (tlen || (th->th_seq != tp->rcv_nxt)) { + /* + * We add the th_seq != rcv_nxt to + * catch the case of a stand alone out + * of order FIN. + */ thflags = tcp_reass(tp, th, &temp, &tlen, m); tp->t_flags |= TF_ACKNOW; } From owner-dev-commits-src-main@freebsd.org Thu May 27 16:45: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 6F1C3640DAD; Thu, 27 May 2021 16:45: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 4FrYb02gt2z4X5P; Thu, 27 May 2021 16:45:16 +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 432622795F; Thu, 27 May 2021 16:45: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 14RGjG0L066554; Thu, 27 May 2021 16:45:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RGjGDE066553; Thu, 27 May 2021 16:45:16 GMT (envelope-from git) Date: Thu, 27 May 2021 16:45:16 GMT Message-Id: <202105271645.14RGjGDE066553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric van Gyzen Subject: git: 427f12f150e8 - main - libprocstat kstack: fix race with thread creation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 427f12f150e875c40acb84f292a80bfa0b90a1a2 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, 27 May 2021 16:45:16 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=427f12f150e875c40acb84f292a80bfa0b90a1a2 commit 427f12f150e875c40acb84f292a80bfa0b90a1a2 Author: Eric van Gyzen AuthorDate: 2021-05-27 16:33:22 +0000 Commit: Eric van Gyzen CommitDate: 2021-05-27 16:44:00 +0000 libprocstat kstack: fix race with thread creation When collecting kernel stacks for a target process, if the process adds a thread between the two calls to sysctl, ignore the additional threads. Previously, procstat would print only a useless error message. Now, it prints a consistent snapshot of the stacks. We know that snapshot is already stale, but it could still be stale even with a more complex fix to reallocate and retry, so such a fix is hardly worth the effort. Reported by: Daniel.Mitchell@emc.com MFC after: 1 week Sponsored by: Dell EMC Isilon --- lib/libprocstat/libprocstat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index 7ccf6c343705..b754bc568e99 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -2609,7 +2609,8 @@ procstat_getkstack_sysctl(pid_t pid, int *cntp) warn("malloc(%zu)", len); return (NULL); } - if (sysctl(name, nitems(name), kkstp, &len, NULL, 0) == -1) { + if (sysctl(name, nitems(name), kkstp, &len, NULL, 0) == -1 && + errno != ENOMEM) { warn("sysctl: kern.proc.pid: %d", pid); free(kkstp); return (NULL); From owner-dev-commits-src-main@freebsd.org Thu May 27 19:01: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 DF6266439F0; Thu, 27 May 2021 19:01: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 4Frccl631Yz4j7h; Thu, 27 May 2021 19:01: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 B8A0E14C8; Thu, 27 May 2021 19:01: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 14RJ1xAj051847; Thu, 27 May 2021 19:01:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RJ1xE5051846; Thu, 27 May 2021 19:01:59 GMT (envelope-from git) Date: Thu, 27 May 2021 19:01:59 GMT Message-Id: <202105271901.14RJ1xE5051846@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 434c46c00602 - main - rtwn_usb(4): Add a USB ID for the TP-Link Archer T2U v3. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 434c46c00602e16115cfb19344e4c45135b68b09 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, 27 May 2021 19:01:59 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=434c46c00602e16115cfb19344e4c45135b68b09 commit 434c46c00602e16115cfb19344e4c45135b68b09 Author: Dmitry Chagin AuthorDate: 2021-05-27 18:52:10 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-27 18:52:10 +0000 rtwn_usb(4): Add a USB ID for the TP-Link Archer T2U v3. PR: 256203 Submitted by: Steve Kargl sgk at troutmask.apl.washington.edu MFC after: 2 weeks --- share/man/man4/rtwn_usb.4 | 3 ++- sys/dev/rtwn/usb/rtwn_usb_attach.h | 1 + sys/dev/usb/usbdevs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/share/man/man4/rtwn_usb.4 b/share/man/man4/rtwn_usb.4 index b146cfe4fe09..86c4c02aafa9 100644 --- a/share/man/man4/rtwn_usb.4 +++ b/share/man/man4/rtwn_usb.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd May 26, 2021 +.Dd May 27, 2021 .Dt RTWN_USB 4 .Os .Sh NAME @@ -99,6 +99,7 @@ based USB wireless network adapters, including: .It "Realtek RTL8188CUS" Ta RTL8188CUS Ta USB 2.0 .It "Sitecom WLA-7100" Ta RTL8812AU Ta USB 3.0 .It "TP-Link Archer T2U Nano" Ta RTL8821AU Ta USB 2.0 +.It "TP-Link Archer T2U v3" Ta RTL8821AU Ta USB 2.0 .It "TP-Link Archer T4U" Ta RTL8812AU Ta USB 3.0 .It "TP-Link Archer T4U v2" Ta RTL8812AU Ta USB 3.0 .It "TP-Link Archer T4UH v1" Ta RTL8812AU Ta USB 3.0 diff --git a/sys/dev/rtwn/usb/rtwn_usb_attach.h b/sys/dev/rtwn/usb/rtwn_usb_attach.h index 40076dbb941c..c7a0f1ce1576 100644 --- a/sys/dev/rtwn/usb/rtwn_usb_attach.h +++ b/sys/dev/rtwn/usb/rtwn_usb_attach.h @@ -167,6 +167,7 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = { RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_2), RTWN_RTL8821AU_DEV(TPLINK, T2UNANO), RTWN_RTL8821AU_DEV(TPLINK, T2UPLUS), + RTWN_RTL8821AU_DEV(TPLINK, T2UV3), #undef RTWN_RTL8821AU_DEV }; diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 5613719a2c8b..5e6a1db31650 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -4700,6 +4700,7 @@ product TPLINK T4UV2 0x010d Archer T4U ver 2 product TPLINK T4UHV1 0x0103 Archer T4UH ver 1 product TPLINK T4UHV2 0x010e Archer T4UH ver 2 product TPLINK T2UNANO 0x011e Archer T2U Nano +product TPLINK T2UV3 0x011f Archer T2U ver 3 product TPLINK T2UPLUS 0x0120 Archer T2U Plus product TPLINK RTL8153 0x0601 RTL8153 USB 10/100/1000 LAN From owner-dev-commits-src-main@freebsd.org Thu May 27 19:53:21 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 8A8FF644527; Thu, 27 May 2021 19:53:21 +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 4Frdm13XBCz4m13; Thu, 27 May 2021 19:53:21 +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 61EF819DD; Thu, 27 May 2021 19:53:21 +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 14RJrLhS017623; Thu, 27 May 2021 19:53:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RJrLs7017622; Thu, 27 May 2021 19:53:21 GMT (envelope-from git) Date: Thu, 27 May 2021 19:53:21 GMT Message-Id: <202105271953.14RJrLs7017622@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: f88510077377 - main - ktrace: Handle negative array sizes in ktrstructarray 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: f88510077377157008f648b7036e1d1c9c83ea23 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, 27 May 2021 19:53:21 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f88510077377157008f648b7036e1d1c9c83ea23 commit f88510077377157008f648b7036e1d1c9c83ea23 Author: Mark Johnston AuthorDate: 2021-05-27 19:49:12 +0000 Commit: Mark Johnston CommitDate: 2021-05-27 19:52:20 +0000 ktrace: Handle negative array sizes in ktrstructarray ktrstructarray() may be used to create copies of kevent(2) change and event arrays. It is called before parameter validation is done and so should check for bogus array lengths before allocating a copy. Reported by: syzkaller Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30479 --- sys/kern/kern_ktrace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 9059a75f571c..dc064d9ebd67 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -878,6 +878,8 @@ ktrstructarray(const char *name, enum uio_seg seg, const void *data, if (__predict_false(curthread->td_pflags & TDP_INKTRACE)) return; + if (num_items < 0) + return; /* Trim array length to genio size. */ max_items = ktr_geniosize / struct_size; From owner-dev-commits-src-main@freebsd.org Thu May 27 19:53: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 4EA856442BB; Thu, 27 May 2021 19:53: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 4Frdm267qPz4lrr; Thu, 27 May 2021 19:53: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 8C26321A0; Thu, 27 May 2021 19:53: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 14RJrMs8017650; Thu, 27 May 2021 19:53:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RJrMH2017649; Thu, 27 May 2021 19:53:22 GMT (envelope-from git) Date: Thu, 27 May 2021 19:53:22 GMT Message-Id: <202105271953.14RJrMH2017649@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: e00bae5c181a - main - kevent: Prohibit negative change and event list lengths 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: e00bae5c181ac8282caf41cd33a076da03cf8ac9 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, 27 May 2021 19:53:23 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e00bae5c181ac8282caf41cd33a076da03cf8ac9 commit e00bae5c181ac8282caf41cd33a076da03cf8ac9 Author: Mark Johnston AuthorDate: 2021-05-27 19:49:32 +0000 Commit: Mark Johnston CommitDate: 2021-05-27 19:52:20 +0000 kevent: Prohibit negative change and event list lengths Previously, a negative change list length would be treated the same as an empty change list. A negative event list length would result in bogus copyouts. Make kevent(2) return EINVAL for both cases so that application bugs are more easily found, and to be more robust against future changes to kevent internals. Reviewed by: imp, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30480 --- lib/libc/sys/kqueue.2 | 4 +++- sys/kern/kern_event.c | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index b83d85d90d42..9be380bb5d99 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 8, 2020 +.Dd May 26, 2021 .Dt KQUEUE 2 .Os .Sh NAME @@ -762,6 +762,8 @@ events were placed on the kqueue for return. A cancellation request was delivered to the thread, but not yet handled. .It Bq Er EINVAL The specified time limit or filter is invalid. +.It Bq Er EINVAL +The specified length of the event or change lists is negative. .It Bq Er ENOENT The event could not be found to be modified or deleted. .It Bq Er ENOMEM diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index e7047e9a7ad9..b224ce87087e 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1303,6 +1303,9 @@ kqueue_kevent(struct kqueue *kq, struct thread *td, int nchanges, int nevents, struct kevent *kevp, *changes; int i, n, nerrors, error; + if (nchanges < 0) + return (EINVAL); + nerrors = 0; while (nchanges > 0) { n = nchanges > KQ_NEVENTS ? KQ_NEVENTS : nchanges; @@ -1887,6 +1890,10 @@ kqueue_scan(struct kqueue *kq, int maxevents, struct kevent_copyops *k_ops, if (maxevents == 0) goto done_nl; + if (maxevents < 0) { + error = EINVAL; + goto done_nl; + } rsbt = 0; if (tsp != NULL) { From owner-dev-commits-src-main@freebsd.org Thu May 27 19:53: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 DB1196442BC; Thu, 27 May 2021 19:53: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 4Frdm35cbvz4m5L; Thu, 27 May 2021 19:53: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 A51A221A1; Thu, 27 May 2021 19:53: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 14RJrNic017671; Thu, 27 May 2021 19:53:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RJrN36017670; Thu, 27 May 2021 19:53:23 GMT (envelope-from git) Date: Thu, 27 May 2021 19:53:23 GMT Message-Id: <202105271953.14RJrN36017670@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: f3851b235b23 - main - ktrace: Fix a race with fork() 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: f3851b235b23d9220ace31bbc89b1fe0a78fc75c 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, 27 May 2021 19:53:24 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f3851b235b23d9220ace31bbc89b1fe0a78fc75c commit f3851b235b23d9220ace31bbc89b1fe0a78fc75c Author: Mark Johnston AuthorDate: 2021-05-27 19:49:59 +0000 Commit: Mark Johnston CommitDate: 2021-05-27 19:52:20 +0000 ktrace: Fix a race with fork() ktrace(2) may toggle trace points in any of 1. a single process 2. all members of a process group 3. all descendents of the processes in 1 or 2 In the first two cases, we do not permit the operation if the process is being forked or not visible. However, in case 3 we did not enforce this restriction for descendents. As a result, the assertions about the child in ktrprocfork() may be violated. Move these checks into ktrops() so that they are applied consistently. Allow KTROP_CLEAR for nascent processes. Otherwise, there is a window where we cannot clear trace points for a nascent child if they are inherited from the parent. Reported by: syzbot+d96676592978f137e05c@syzkaller.appspotmail.com Reported by: syzbot+7c98fcf84a4439f2817f@syzkaller.appspotmail.com Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30481 --- sys/kern/kern_ktrace.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index dc064d9ebd67..4a2dad20b035 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1006,7 +1006,7 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) int facs = uap->facs & ~KTRFAC_ROOT; int ops = KTROP(uap->ops); int descend = uap->ops & KTRFLAG_DESCEND; - int nfound, ret = 0; + int ret = 0; int flags, error = 0; struct nameidata nd; struct ktr_io_params *kiop, *old_kiop; @@ -1080,42 +1080,31 @@ restart: error = ESRCH; goto done; } + /* * ktrops() may call vrele(). Lock pg_members * by the proctree_lock rather than pg_mtx. */ PGRP_UNLOCK(pg); - nfound = 0; + if (LIST_EMPTY(&pg->pg_members)) { + sx_sunlock(&proctree_lock); + error = ESRCH; + goto done; + } LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); - if (p->p_state == PRS_NEW || - p_cansee(td, p) != 0) { - PROC_UNLOCK(p); - continue; - } - nfound++; if (descend) ret |= ktrsetchildren(td, p, ops, facs, kiop); else ret |= ktrops(td, p, ops, facs, kiop); } - if (nfound == 0) { - sx_sunlock(&proctree_lock); - error = ESRCH; - goto done; - } } else { /* * by pid */ p = pfind(uap->pid); - if (p == NULL) + if (p == NULL) { error = ESRCH; - else - error = p_cansee(td, p); - if (error) { - if (p != NULL) - PROC_UNLOCK(p); sx_sunlock(&proctree_lock); goto done; } @@ -1187,8 +1176,20 @@ ktrops(struct thread *td, struct proc *p, int ops, int facs, PROC_UNLOCK(p); return (0); } - if (p->p_flag & P_WEXIT) { - /* If the process is exiting, just ignore it. */ + if ((ops == KTROP_SET && p->p_state == PRS_NEW) || !p_cansee(td, p)) { + /* + * Disallow setting trace points if the process is being born. + * This avoids races with trace point inheritance in + * ktrprocfork(). + */ + PROC_UNLOCK(p); + return (0); + } + if ((p->p_flag & P_WEXIT) != 0) { + /* + * There's nothing to do if the process is exiting, but avoid + * signaling an error. + */ PROC_UNLOCK(p); return (1); } From owner-dev-commits-src-main@freebsd.org Thu May 27 20:48: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 5051B644FCC; Thu, 27 May 2021 20:48: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 4Frfzy1nqWz4rYq; Thu, 27 May 2021 20:48:46 +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 2296B2B1E; Thu, 27 May 2021 20:48:46 +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 14RKmjut084843; Thu, 27 May 2021 20:48:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RKmjLc084842; Thu, 27 May 2021 20:48:45 GMT (envelope-from git) Date: Thu, 27 May 2021 20:48:45 GMT Message-Id: <202105272048.14RKmjLc084842@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ruslan Bukin Subject: git: f81b451dcccd - main - hdspe: Support for mono sound. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: br X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f81b451dcccd449388dd1b7901683d4cdd481a6e 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, 27 May 2021 20:48:46 -0000 The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=f81b451dcccd449388dd1b7901683d4cdd481a6e commit f81b451dcccd449388dd1b7901683d4cdd481a6e Author: Ruslan Bukin AuthorDate: 2021-05-27 20:40:21 +0000 Commit: Ruslan Bukin CommitDate: 2021-05-27 20:40:21 +0000 hdspe: Support for mono sound. This is useful when you have a single monitor speaker. --- sys/dev/sound/pci/hdspe-pcm.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/sys/dev/sound/pci/hdspe-pcm.c b/sys/dev/sound/pci/hdspe-pcm.c index 20cb39d2de14..6e2cccfb0c99 100644 --- a/sys/dev/sound/pci/hdspe-pcm.c +++ b/sys/dev/sound/pci/hdspe-pcm.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012-2016 Ruslan Bukin + * Copyright (c) 2012-2021 Ruslan Bukin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -196,7 +196,8 @@ hdspechan_enable(struct sc_chinfo *ch, int value) ch->run = value; hdspe_write_1(sc, reg + (4 * ch->lslot), value); - hdspe_write_1(sc, reg + (4 * ch->rslot), value); + if (AFMT_CHANNEL(ch->format) == 2) + hdspe_write_1(sc, reg + (4 * ch->rslot), value); } static int @@ -263,13 +264,16 @@ buffer_copy(struct sc_chinfo *ch) int ssize, dsize; int src, dst; int length; + int n; int i; scp = ch->parent; sc = scp->sc; + n = AFMT_CHANNEL(ch->format); /* n channels */ + length = sndbuf_getready(ch->buffer) / - (4 /* Bytes per sample. */ * 2 /* channels */); + (4 /* Bytes per sample. */ * n); if (ch->dir == PCMDIR_PLAY) { src = sndbuf_getreadyptr(ch->buffer); @@ -278,10 +282,10 @@ buffer_copy(struct sc_chinfo *ch) } src /= 4; /* Bytes per sample. */ - dst = src / 2; /* Destination buffer twice smaller. */ + dst = src / n; /* Destination buffer n-times smaller. */ ssize = ch->size / 4; - dsize = ch->size / 8; + dsize = ch->size / (4 * n); /* * Use two fragment buffer to avoid sound clipping. @@ -303,7 +307,7 @@ buffer_copy(struct sc_chinfo *ch) dst+=1; dst %= dsize; - src+=2; + src += n; src %= ssize; } } @@ -352,7 +356,7 @@ hdspechan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, ch->lvol = 0; ch->rvol = 0; - ch->size = HDSPE_CHANBUF_SIZE * 2 /* slots */; + ch->size = HDSPE_CHANBUF_SIZE * 2; /* max size */ ch->data = malloc(ch->size, M_HDSPE, M_NOWAIT); ch->buffer = b; @@ -432,7 +436,8 @@ hdspechan_getptr(kobj_t obj, void *data) snd_mtxunlock(sc->lock); pos = ret & HDSPE_BUF_POSITION_MASK; - pos *= 2; /* Hardbuf twice bigger. */ + if (AFMT_CHANNEL(ch->format) == 2) + pos *= 2; /* Hardbuf twice bigger. */ return (pos); } @@ -608,7 +613,8 @@ hdspechan_setblocksize(kobj_t obj, void *data, uint32_t blocksize) device_printf(scp->dev, "New period=%d\n", sc->period); #endif - sndbuf_resize(ch->buffer, (HDSPE_CHANBUF_SIZE * 2) / (sc->period * 4), + sndbuf_resize(ch->buffer, + (HDSPE_CHANBUF_SIZE * AFMT_CHANNEL(ch->format)) / (sc->period * 4), (sc->period * 4)); end: @@ -623,6 +629,7 @@ static uint32_t hdspe_rfmt[] = { static struct pcmchan_caps hdspe_rcaps = {32000, 192000, hdspe_rfmt, 0}; static uint32_t hdspe_pfmt[] = { + SND_FORMAT(AFMT_S32_LE, 1, 0), SND_FORMAT(AFMT_S32_LE, 2, 0), 0 }; From owner-dev-commits-src-main@freebsd.org Thu May 27 21:48: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 20B58646058; Thu, 27 May 2021 21:48:02 +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 4FrhJL0VHgz4vDf; Thu, 27 May 2021 21:48:02 +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 7F9FB4F69; Thu, 27 May 2021 21:48:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Kirk McKusick , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202105212038.14LKcb3U062829@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: f190f9193bc1 - main - Fix fsck_ufs segfaults with gjournal (SU+J) Message-ID: <4faa0667-ca1b-923b-fbae-c97b0b863589@FreeBSD.org> Date: Thu, 27 May 2021 14:47:57 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <202105212038.14LKcb3U062829@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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, 27 May 2021 21:48:02 -0000 On 5/21/21 1:38 PM, Kirk McKusick wrote: > The branch main has been updated by mckusick: > > URL: https://cgit.FreeBSD.org/src/commit/?id=f190f9193bc10a8193c87e0a02fa91400e4eb159 > > commit f190f9193bc10a8193c87e0a02fa91400e4eb159 > Author: Kirk McKusick > AuthorDate: 2021-05-21 20:41:40 +0000 > Commit: Kirk McKusick > CommitDate: 2021-05-21 20:42:37 +0000 > > Fix fsck_ufs segfaults with gjournal (SU+J) > > The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c) > while attempting to traverse the buffer cache to flush dirty buffers. > The tail queue used for the buffer cache was not initialized before > dropping into gjournal_check(). Move the buffer initialization earlier > so that it has been done before calling gjournal_check(). This appears to have broken fsck in at least some use cases. On my rpi I get this error trying to boot: Setting hostid: 0x4ce29432. Starting file system checks: fsck_ufs: Initial malloc(-1515870811) failed fsck_ufs: Initial malloc(-1515870811) failed Automatic file system check failed; help! ERROR: ABORTING BOOT (sending SIGTERM to parent)! The amount being passed to malloc() is malloc junk: (gdb) p/x -1515870811 $1 = 0xa5a5a5a5 The i386 CI jobs in jenkins have been failing with the same error recently as well. I guess this means sblock isn't fully initialized by sblock_init()? At least not enough to set fs_bsize? Hmm, perhaps readsb() is what sets fs_bsize? -- John Baldwin From owner-dev-commits-src-main@freebsd.org Fri May 28 02:12: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 10A10649E9A; Fri, 28 May 2021 02:12: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 4Frp8y00mLz3PsS; Fri, 28 May 2021 02:12: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 DB4786D6F; Fri, 28 May 2021 02:12: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 14S2C1OJ019126; Fri, 28 May 2021 02:12:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14S2C1w8019125; Fri, 28 May 2021 02:12:01 GMT (envelope-from git) Date: Fri, 28 May 2021 02:12:01 GMT Message-Id: <202105280212.14S2C1w8019125@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 96b40b896772 - main - nfscl: Use hash lists to improve expected search performance for opens MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 96b40b896772bbce5f93d62eaa640e1eb51b4a30 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, 28 May 2021 02:12:02 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=96b40b896772bbce5f93d62eaa640e1eb51b4a30 commit 96b40b896772bbce5f93d62eaa640e1eb51b4a30 Author: Rick Macklem AuthorDate: 2021-05-28 02:08:36 +0000 Commit: Rick Macklem CommitDate: 2021-05-28 02:08:36 +0000 nfscl: Use hash lists to improve expected search performance for opens A problem was reported via email, where a large (130000+) accumulation of NFSv4 opens on an NFSv4 mount caused significant lock contention on the mutex used to protect the client mount's open/lock state. Although the root cause for the accumulation of opens was not resolved, it is obvious that the NFSv4 client is not designed to handle 100000+ opens efficiently. When searching for an open, usually for a match by file handle, a linear search of all opens is done. Commit 3f7e14ad9345 added a hash table of lists hashed on file handle for the opens. This patch uses the hash lists for searching for a matching open based of file handle instead of an exhaustive linear search of all opens. This change appears to be performance neutral for a small number of opens, but should improve expected performance for a large number of opens. This commit should not affect the high level semantics of open handling. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 165 +++++++++++++++++++---------------------- 1 file changed, 75 insertions(+), 90 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 63c70ebcfdf5..5e4ac2ae9d4d 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -1229,7 +1229,6 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t len, struct nfscllockowner **lpp, int *dorpcp) { struct nfscllockowner *lp; - struct nfsclowner *owp; struct nfsclopen *op; struct nfscllock *nlop, *other_lop = NULL; struct nfscldeleg *dp; @@ -1291,24 +1290,21 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t len, */ lp = NULL; fnd = 0; - LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { + LIST_FOREACH(op, NFSCLOPENHASH(clp, np->n_fhp->nfh_fh, + np->n_fhp->nfh_len), nfso_hash) { if (op->nfso_fhlen == np->n_fhp->nfh_len && !NFSBCMP(op->nfso_fh, np->n_fhp->nfh_fh, op->nfso_fhlen)) { - LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { - if (lp->nfsl_inprog == NULL && - !NFSBCMP(lp->nfsl_owner, own, - NFSV4CL_LOCKNAMELEN)) { - fnd = 1; - break; + LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { + if (lp->nfsl_inprog == NULL && + !NFSBCMP(lp->nfsl_owner, own, + NFSV4CL_LOCKNAMELEN)) { + fnd = 1; + break; + } } - } - if (fnd) - break; } - } - if (fnd) - break; + if (fnd) + break; } if (lp != NULL) { @@ -1338,7 +1334,6 @@ void nfscl_releasealllocks(struct nfsclclient *clp, vnode_t vp, NFSPROC_T *p, void *id, int flags) { - struct nfsclowner *owp; struct nfsclopen *op; struct nfscllockowner *lp; struct nfsnode *np; @@ -1347,20 +1342,19 @@ nfscl_releasealllocks(struct nfsclclient *clp, vnode_t vp, NFSPROC_T *p, np = VTONFS(vp); nfscl_filllockowner(id, own, flags); NFSLOCKCLSTATE(); - LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { + LIST_FOREACH(op, NFSCLOPENHASH(clp, np->n_fhp->nfh_fh, + np->n_fhp->nfh_len), nfso_hash) { if (op->nfso_fhlen == np->n_fhp->nfh_len && !NFSBCMP(op->nfso_fh, np->n_fhp->nfh_fh, op->nfso_fhlen)) { - LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { - if (lp->nfsl_inprog == p && - !NFSBCMP(lp->nfsl_owner, own, - NFSV4CL_LOCKNAMELEN)) { - lp->nfsl_inprog = NULL; - nfscl_lockunlock(&lp->nfsl_rwlock); + LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { + if (lp->nfsl_inprog == p && + !NFSBCMP(lp->nfsl_owner, own, + NFSV4CL_LOCKNAMELEN)) { + lp->nfsl_inprog = NULL; + nfscl_lockunlock(&lp->nfsl_rwlock); + } } - } } - } } nfscl_clrelease(clp); NFSUNLOCKCLSTATE(); @@ -1376,7 +1370,6 @@ int nfscl_checkwritelocked(vnode_t vp, struct flock *fl, struct ucred *cred, NFSPROC_T *p, void *id, int flags) { - struct nfsclowner *owp; struct nfscllockowner *lp; struct nfsclopen *op; struct nfsclclient *clp; @@ -1445,30 +1438,29 @@ nfscl_checkwritelocked(vnode_t vp, struct flock *fl, /* * Now, check state against the server. */ - LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { + LIST_FOREACH(op, NFSCLOPENHASH(clp, np->n_fhp->nfh_fh, + np->n_fhp->nfh_len), nfso_hash) { if (op->nfso_fhlen == np->n_fhp->nfh_len && !NFSBCMP(op->nfso_fh, np->n_fhp->nfh_fh, op->nfso_fhlen)) { - LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { - if (!NFSBCMP(lp->nfsl_owner, own, - NFSV4CL_LOCKNAMELEN)) - break; - } - if (lp != NULL) { - LIST_FOREACH(lop, &lp->nfsl_lock, nfslo_list) { - if (lop->nfslo_first >= end) - break; - if (lop->nfslo_end <= off) - continue; - if (lop->nfslo_type == F_WRLCK) { - nfscl_clrelease(clp); - NFSUNLOCKCLSTATE(); - return (1); - } + LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { + if (!NFSBCMP(lp->nfsl_owner, own, + NFSV4CL_LOCKNAMELEN)) + break; + } + if (lp != NULL) { + LIST_FOREACH(lop, &lp->nfsl_lock, nfslo_list) { + if (lop->nfslo_first >= end) + break; + if (lop->nfslo_end <= off) + continue; + if (lop->nfslo_type == F_WRLCK) { + nfscl_clrelease(clp); + NFSUNLOCKCLSTATE(); + return (1); + } + } } - } } - } } nfscl_clrelease(clp); NFSUNLOCKCLSTATE(); @@ -3243,23 +3235,22 @@ nfscl_getclose(vnode_t vp, struct nfsclclient **clpp) } /* Now process the opens against the server. */ - LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - if (op->nfso_fhlen == nfhp->nfh_len && - !NFSBCMP(op->nfso_fh, nfhp->nfh_fh, - nfhp->nfh_len)) { - /* Found an open, decrement cnt if possible */ - if (notdecr && op->nfso_opencnt > 0) { - notdecr = 0; - op->nfso_opencnt--; - } - /* - * There are more opens, so just return. - */ - if (op->nfso_opencnt > 0) { - NFSUNLOCKCLSTATE(); - return (0); - } + LIST_FOREACH(op, NFSCLOPENHASH(clp, nfhp->nfh_fh, nfhp->nfh_len), + nfso_hash) { + if (op->nfso_fhlen == nfhp->nfh_len && + !NFSBCMP(op->nfso_fh, nfhp->nfh_fh, + nfhp->nfh_len)) { + /* Found an open, decrement cnt if possible */ + if (notdecr && op->nfso_opencnt > 0) { + notdecr = 0; + op->nfso_opencnt--; + } + /* + * There are more opens, so just return. + */ + if (op->nfso_opencnt > 0) { + NFSUNLOCKCLSTATE(); + return (0); } } } @@ -3310,24 +3301,21 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) /* Now process the opens against the server. */ lookformore: - LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { - op = LIST_FIRST(&owp->nfsow_open); - while (op != NULL) { - if (op->nfso_fhlen == nfhp->nfh_len && - !NFSBCMP(op->nfso_fh, nfhp->nfh_fh, - nfhp->nfh_len)) { - /* Found an open, close it. */ + LIST_FOREACH(op, NFSCLOPENHASH(clp, nfhp->nfh_fh, nfhp->nfh_len), + nfso_hash) { + if (op->nfso_fhlen == nfhp->nfh_len && + !NFSBCMP(op->nfso_fh, nfhp->nfh_fh, + nfhp->nfh_len)) { + /* Found an open, close it. */ #ifdef DIAGNOSTIC - KASSERT((op->nfso_opencnt == 0), - ("nfscl: bad open cnt on server (%d)", - op->nfso_opencnt)); + KASSERT((op->nfso_opencnt == 0), + ("nfscl: bad open cnt on server (%d)", + op->nfso_opencnt)); #endif - NFSUNLOCKCLSTATE(); - nfsrpc_doclose(VFSTONFS(vp->v_mount), op, p); - NFSLOCKCLSTATE(); - goto lookformore; - } - op = LIST_NEXT(op, nfso_list); + NFSUNLOCKCLSTATE(); + nfsrpc_doclose(VFSTONFS(vp->v_mount), op, p); + NFSLOCKCLSTATE(); + goto lookformore; } } NFSUNLOCKCLSTATE(); @@ -3956,7 +3944,6 @@ nfscl_localconflict(struct nfsclclient *clp, u_int8_t *fhp, int fhlen, struct nfscllock *nlop, u_int8_t *own, struct nfscldeleg *dp, struct nfscllock **lopp) { - struct nfsclowner *owp; struct nfsclopen *op; int ret; @@ -3965,15 +3952,13 @@ nfscl_localconflict(struct nfsclclient *clp, u_int8_t *fhp, int fhlen, if (ret) return (ret); } - LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - if (op->nfso_fhlen == fhlen && - !NFSBCMP(op->nfso_fh, fhp, fhlen)) { - ret = nfscl_checkconflict(&op->nfso_lock, nlop, - own, lopp); - if (ret) - return (ret); - } + LIST_FOREACH(op, NFSCLOPENHASH(clp, fhp, fhlen), nfso_hash) { + if (op->nfso_fhlen == fhlen && + !NFSBCMP(op->nfso_fh, fhp, fhlen)) { + ret = nfscl_checkconflict(&op->nfso_lock, nlop, + own, lopp); + if (ret) + return (ret); } } return (0); From owner-dev-commits-src-main@freebsd.org Fri May 28 05:54:21 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 89E0764C8DD; Fri, 28 May 2021 05:54:21 +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 4Frv5T3XXWz3vHP; Fri, 28 May 2021 05:54:21 +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 61BE712298; Fri, 28 May 2021 05:54:21 +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 14S5sLpT016120; Fri, 28 May 2021 05:54:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14S5sLQI016119; Fri, 28 May 2021 05:54:21 GMT (envelope-from git) Date: Fri, 28 May 2021 05:54:21 GMT Message-Id: <202105280554.14S5sLQI016119@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: dd722ccd6efc - main - ocs_fc: Fix a use after free in ocs_sport_free MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd722ccd6efcaed5c6056e51a044db7f1a5b4a0d 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, 28 May 2021 05:54:21 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=dd722ccd6efcaed5c6056e51a044db7f1a5b4a0d commit dd722ccd6efcaed5c6056e51a044db7f1a5b4a0d Author: Ram Kishore Vegesna AuthorDate: 2021-05-28 05:26:13 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-05-28 05:26:13 +0000 ocs_fc: Fix a use after free in ocs_sport_free Domain which could be freed is used while freeing the sport. Use ocs from sport. PR: 255866 Reported by: lylgood@foxmail.com Approved by:: markj --- sys/dev/ocs_fc/ocs_sport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ocs_fc/ocs_sport.c b/sys/dev/ocs_fc/ocs_sport.c index 71fe350311f7..7df31b1448f1 100644 --- a/sys/dev/ocs_fc/ocs_sport.c +++ b/sys/dev/ocs_fc/ocs_sport.c @@ -263,7 +263,7 @@ ocs_sport_free(ocs_sport_t *sport) ocs_lock_free(&sport->node_group_lock); ocs_scsi_sport_deleted(sport); - ocs_free(domain->ocs, sport, sizeof(*sport)); + ocs_free(sport->ocs, sport, sizeof(*sport)); } } From owner-dev-commits-src-main@freebsd.org Fri May 28 06:05: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 6626664CA44; Fri, 28 May 2021 06:05: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 4FrvKt2VCWz3vCs; Fri, 28 May 2021 06:05: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 397DD123A3; Fri, 28 May 2021 06:05: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 14S656Ov030531; Fri, 28 May 2021 06:05:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14S656KI030530; Fri, 28 May 2021 06:05:06 GMT (envelope-from git) Date: Fri, 28 May 2021 06:05:06 GMT Message-Id: <202105280605.14S656KI030530@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: 7377d3831bc8 - main - ocs_fc: Fix use after free bug in ocs_hw_async_call() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7377d3831bc8abec2d6e5fee359d7383d4551feb 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, 28 May 2021 06:05:06 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=7377d3831bc8abec2d6e5fee359d7383d4551feb commit 7377d3831bc8abec2d6e5fee359d7383d4551feb Author: Ram Kishore Vegesna AuthorDate: 2021-05-28 05:51:10 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-05-28 05:51:10 +0000 ocs_fc: Fix use after free bug in ocs_hw_async_call() Freed ctx is used in the later callee ocs_hw_command(), which is a use after free bug. Return error if sli_cmd_common_nop() failed. PR: 255865 Reported by: lylgood@foxmail.com Approved by:: markj --- sys/dev/ocs_fc/ocs_hw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_hw.c b/sys/dev/ocs_fc/ocs_hw.c index d28d5e4a08b7..aa7d5857d9d9 100644 --- a/sys/dev/ocs_fc/ocs_hw.c +++ b/sys/dev/ocs_fc/ocs_hw.c @@ -11778,7 +11778,6 @@ ocs_hw_async_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg) int32_t ocs_hw_async_call(ocs_hw_t *hw, ocs_hw_async_cb_t callback, void *arg) { - int32_t rc = 0; ocs_hw_async_call_ctx_t *ctx; /* @@ -11798,15 +11797,15 @@ ocs_hw_async_call(ocs_hw_t *hw, ocs_hw_async_cb_t callback, void *arg) if (sli_cmd_common_nop(&hw->sli, ctx->cmd, sizeof(ctx->cmd), 0) == 0) { ocs_log_err(hw->os, "COMMON_NOP format failure\n"); ocs_free(hw->os, ctx, sizeof(*ctx)); - rc = -1; + return OCS_HW_RTN_ERROR; } if (ocs_hw_command(hw, ctx->cmd, OCS_CMD_NOWAIT, ocs_hw_async_cb, ctx)) { ocs_log_err(hw->os, "COMMON_NOP command failure\n"); ocs_free(hw->os, ctx, sizeof(*ctx)); - rc = -1; + return OCS_HW_RTN_ERROR; } - return rc; + return OCS_HW_RTN_SUCCESS; } /** From owner-dev-commits-src-main@freebsd.org Fri May 28 08:05:09 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 C075664ED30; Fri, 28 May 2021 08:05:09 +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 4Fry0P4rcpz4b9L; Fri, 28 May 2021 08:05: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 8EDC413E11; Fri, 28 May 2021 08:05: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 14S859Fg092296; Fri, 28 May 2021 08:05:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14S859HS092295; Fri, 28 May 2021 08:05:09 GMT (envelope-from git) Date: Fri, 28 May 2021 08:05:09 GMT Message-Id: <202105280805.14S859HS092295@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 6d926e850d22 - main - linux: add new syscall numbers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d926e850d22c5c563571561c446c3c0dec16143 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, 28 May 2021 08:05:09 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=6d926e850d22c5c563571561c446c3c0dec16143 commit 6d926e850d22c5c563571561c446c3c0dec16143 Author: Edward Tomasz Napierala AuthorDate: 2021-05-28 08:02:10 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-28 08:02:16 +0000 linux: add new syscall numbers Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30193 --- sys/amd64/linux/syscalls.master | 47 ++++++++++++++++++++- sys/amd64/linux32/syscalls.master | 47 ++++++++++++++++++++- sys/arm64/linux/syscalls.master | 87 +++++++++++++++++++++++++++++++++++++-- sys/compat/linux/linux_dummy.c | 15 +++++++ sys/i386/linux/syscalls.master | 47 ++++++++++++++++++++- 5 files changed, 237 insertions(+), 6 deletions(-) diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master index cfa6dab84965..d99aaa019111 100644 --- a/sys/amd64/linux/syscalls.master +++ b/sys/amd64/linux/syscalls.master @@ -2060,6 +2060,51 @@ 427 AUE_NULL STD { int linux_io_uring_register(void); } +428 AUE_NULL STD { + int linux_open_tree(void); + } +429 AUE_NULL STD { + int linux_move_mount(void); + } +430 AUE_NULL STD { + int linux_fsopen(void); + } +431 AUE_NULL STD { + int linux_fsconfig(void); + } +432 AUE_NULL STD { + int linux_fsmount(void); + } +433 AUE_NULL STD { + int linux_fspick(void); + } +434 AUE_NULL STD { + int linux_pidfd_open(void); + } +435 AUE_NULL STD { + int linux_clone3(void); + } +436 AUE_NULL STD { + int linux_close_range(void); + } +437 AUE_NULL STD { + int linux_openat2(void); + } +438 AUE_NULL STD { + int linux_pidfd_getfd(void); + } +439 AUE_NULL STD { + int linux_faccessat2(void); + } +440 AUE_NULL STD { + int linux_process_madvise(void); + } +441 AUE_NULL STD { + int linux_epoll_pwait2(void); + } +442 AUE_NULL STD { + int linux_mount_setattr(void); + } ; please, keep this line at the end. -428 AUE_NULL UNIMPL nosys +443 AUE_NULL UNIMPL nosys ; vim: syntax=off diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 9c0cf347d7f4..d7002ed5ac72 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -2418,6 +2418,51 @@ 427 AUE_NULL STD { int linux_io_uring_register(void); } +428 AUE_NULL STD { + int linux_open_tree(void); + } +429 AUE_NULL STD { + int linux_move_mount(void); + } +430 AUE_NULL STD { + int linux_fsopen(void); + } +431 AUE_NULL STD { + int linux_fsconfig(void); + } +432 AUE_NULL STD { + int linux_fsmount(void); + } +433 AUE_NULL STD { + int linux_fspick(void); + } +434 AUE_NULL STD { + int linux_pidfd_open(void); + } +435 AUE_NULL STD { + int linux_clone3(void); + } +436 AUE_NULL STD { + int linux_close_range(void); + } +437 AUE_NULL STD { + int linux_openat2(void); + } +438 AUE_NULL STD { + int linux_pidfd_getfd(void); + } +439 AUE_NULL STD { + int linux_faccessat2(void); + } +440 AUE_NULL STD { + int linux_process_madvise(void); + } +441 AUE_NULL STD { + int linux_epoll_pwait2(void); + } +442 AUE_NULL STD { + int linux_mount_setattr(void); + } ; please, keep this line at the end. -428 AUE_NULL UNIMPL nosys +443 AUE_NULL UNIMPL nosys ; vim: syntax=off diff --git a/sys/arm64/linux/syscalls.master b/sys/arm64/linux/syscalls.master index 8b624d0687b6..c8e7a2da812a 100644 --- a/sys/arm64/linux/syscalls.master +++ b/sys/arm64/linux/syscalls.master @@ -1672,8 +1672,89 @@ l_int pkey ); } - +; Linux 4.11: +291 AUE_NULL STD { + int linux_statx( + l_int dirfd, + const char *pathname, + l_uint flags, + l_uint mask, + void *statxbuf + ); + } +; Linux 4.18: +292 AUE_NULL STD { + int linux_io_pgetevents(void); + } +293 AUE_NULL STD { + int linux_rseq(void); + } +294 AUE_NULL STD { + int linux_kexec_file_load(void); + } +295-423 AUE_NULL UNIMPL unimpl_md_syscall +424 AUE_NULL STD { + int linux_pidfd_send_signal( + l_int pidfd, + l_int sig, + l_siginfo_t *info, + l_uint flags + ); + } +425 AUE_NULL STD { + int linux_io_uring_setup(void); + } +426 AUE_NULL STD { + int linux_io_uring_enter(void); + } +427 AUE_NULL STD { + int linux_io_uring_register(void); + } +428 AUE_NULL STD { + int linux_open_tree(void); + } +429 AUE_NULL STD { + int linux_move_mount(void); + } +430 AUE_NULL STD { + int linux_fsopen(void); + } +431 AUE_NULL STD { + int linux_fsconfig(void); + } +432 AUE_NULL STD { + int linux_fsmount(void); + } +433 AUE_NULL STD { + int linux_fspick(void); + } +434 AUE_NULL STD { + int linux_pidfd_open(void); + } +435 AUE_NULL STD { + int linux_clone3(void); + } +436 AUE_NULL STD { + int linux_close_range(void); + } +437 AUE_NULL STD { + int linux_openat2(void); + } +438 AUE_NULL STD { + int linux_pidfd_getfd(void); + } +439 AUE_NULL STD { + int linux_faccessat2(void); + } +440 AUE_NULL STD { + int linux_process_madvise(void); + } +441 AUE_NULL STD { + int linux_epoll_pwait2(void); + } +442 AUE_NULL STD { + int linux_mount_setattr(void); + } ; please, keep this line at the end. -291 AUE_NULL UNIMPL nosys - +443 AUE_NULL UNIMPL nosys ; vim: syntax=off diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c index ae551da7fb43..5f174d0e4994 100644 --- a/sys/compat/linux/linux_dummy.c +++ b/sys/compat/linux/linux_dummy.c @@ -132,6 +132,21 @@ DUMMY(pwritev2); DUMMY(pkey_mprotect); DUMMY(pkey_alloc); DUMMY(pkey_free); +DUMMY(open_tree); +DUMMY(move_mount); +DUMMY(fsopen); +DUMMY(fsconfig); +DUMMY(fsmount); +DUMMY(fspick); +DUMMY(pidfd_open); +DUMMY(clone3); +DUMMY(close_range); +DUMMY(openat2); +DUMMY(pidfd_getfd); +DUMMY(faccessat2); +DUMMY(process_madvise); +DUMMY(epoll_pwait2); +DUMMY(mount_setattr); #define DUMMY_XATTR(s) \ int \ diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index ae053febd656..e2732d211235 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -2436,6 +2436,51 @@ 427 AUE_NULL STD { int linux_io_uring_register(void); } +428 AUE_NULL STD { + int linux_open_tree(void); + } +429 AUE_NULL STD { + int linux_move_mount(void); + } +430 AUE_NULL STD { + int linux_fsopen(void); + } +431 AUE_NULL STD { + int linux_fsconfig(void); + } +432 AUE_NULL STD { + int linux_fsmount(void); + } +433 AUE_NULL STD { + int linux_fspick(void); + } +434 AUE_NULL STD { + int linux_pidfd_open(void); + } +435 AUE_NULL STD { + int linux_clone3(void); + } +436 AUE_NULL STD { + int linux_close_range(void); + } +437 AUE_NULL STD { + int linux_openat2(void); + } +438 AUE_NULL STD { + int linux_pidfd_getfd(void); + } +439 AUE_NULL STD { + int linux_faccessat2(void); + } +440 AUE_NULL STD { + int linux_process_madvise(void); + } +441 AUE_NULL STD { + int linux_epoll_pwait2(void); + } +442 AUE_NULL STD { + int linux_mount_setattr(void); + } ; please, keep this line at the end. -428 AUE_NULL UNIMPL nosys +443 AUE_NULL UNIMPL nosys ; vim: syntax=off From owner-dev-commits-src-main@freebsd.org Fri May 28 08:05: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 0314664E8E8; Fri, 28 May 2021 08:05:11 +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 4Fry0Q6N0Wz4bCs; Fri, 28 May 2021 08:05: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 B895F13DA1; Fri, 28 May 2021 08:05: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 14S85AsO092317; Fri, 28 May 2021 08:05:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14S85AC3092316; Fri, 28 May 2021 08:05:10 GMT (envelope-from git) Date: Fri, 28 May 2021 08:05:10 GMT Message-Id: <202105280805.14S85AC3092316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: c0f171736a70 - main - Regen after 6d926e850d2. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0f171736a703c8d01f955190cfe5142381752f5 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, 28 May 2021 08:05:11 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=c0f171736a703c8d01f955190cfe5142381752f5 commit c0f171736a703c8d01f955190cfe5142381752f5 Author: Edward Tomasz Napierala AuthorDate: 2021-05-28 08:04:17 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-28 08:04:17 +0000 Regen after 6d926e850d2. Sponsored By: EPSRC --- sys/amd64/linux/linux_proto.h | 75 ++++++++ sys/amd64/linux/linux_syscall.h | 17 +- sys/amd64/linux/linux_syscalls.c | 17 +- sys/amd64/linux/linux_sysent.c | 17 +- sys/amd64/linux/linux_systrace_args.c | 150 ++++++++++++++++ sys/amd64/linux32/linux32_proto.h | 75 ++++++++ sys/amd64/linux32/linux32_syscall.h | 17 +- sys/amd64/linux32/linux32_syscalls.c | 17 +- sys/amd64/linux32/linux32_sysent.c | 17 +- sys/amd64/linux32/linux32_systrace_args.c | 150 ++++++++++++++++ sys/arm64/linux/linux_proto.h | 122 +++++++++++++ sys/arm64/linux/linux_syscall.h | 25 ++- sys/arm64/linux/linux_syscalls.c | 154 +++++++++++++++- sys/arm64/linux/linux_sysent.c | 154 +++++++++++++++- sys/arm64/linux/linux_systrace_args.c | 282 ++++++++++++++++++++++++++++++ sys/i386/linux/linux_proto.h | 75 ++++++++ sys/i386/linux/linux_syscall.h | 17 +- sys/i386/linux/linux_syscalls.c | 17 +- sys/i386/linux/linux_sysent.c | 17 +- sys/i386/linux/linux_systrace_args.c | 150 ++++++++++++++++ 20 files changed, 1553 insertions(+), 12 deletions(-) diff --git a/sys/amd64/linux/linux_proto.h b/sys/amd64/linux/linux_proto.h index b03540f9b7c8..5bd92a9ebf43 100644 --- a/sys/amd64/linux/linux_proto.h +++ b/sys/amd64/linux/linux_proto.h @@ -1331,6 +1331,51 @@ struct linux_io_uring_enter_args { struct linux_io_uring_register_args { register_t dummy; }; +struct linux_open_tree_args { + register_t dummy; +}; +struct linux_move_mount_args { + register_t dummy; +}; +struct linux_fsopen_args { + register_t dummy; +}; +struct linux_fsconfig_args { + register_t dummy; +}; +struct linux_fsmount_args { + register_t dummy; +}; +struct linux_fspick_args { + register_t dummy; +}; +struct linux_pidfd_open_args { + register_t dummy; +}; +struct linux_clone3_args { + register_t dummy; +}; +struct linux_close_range_args { + register_t dummy; +}; +struct linux_openat2_args { + register_t dummy; +}; +struct linux_pidfd_getfd_args { + register_t dummy; +}; +struct linux_faccessat2_args { + register_t dummy; +}; +struct linux_process_madvise_args { + register_t dummy; +}; +struct linux_epoll_pwait2_args { + register_t dummy; +}; +struct linux_mount_setattr_args { + register_t dummy; +}; #define nosys linux_nosys int linux_open(struct thread *, struct linux_open_args *); int linux_newstat(struct thread *, struct linux_newstat_args *); @@ -1614,6 +1659,21 @@ int linux_pidfd_send_signal(struct thread *, struct linux_pidfd_send_signal_args int linux_io_uring_setup(struct thread *, struct linux_io_uring_setup_args *); int linux_io_uring_enter(struct thread *, struct linux_io_uring_enter_args *); int linux_io_uring_register(struct thread *, struct linux_io_uring_register_args *); +int linux_open_tree(struct thread *, struct linux_open_tree_args *); +int linux_move_mount(struct thread *, struct linux_move_mount_args *); +int linux_fsopen(struct thread *, struct linux_fsopen_args *); +int linux_fsconfig(struct thread *, struct linux_fsconfig_args *); +int linux_fsmount(struct thread *, struct linux_fsmount_args *); +int linux_fspick(struct thread *, struct linux_fspick_args *); +int linux_pidfd_open(struct thread *, struct linux_pidfd_open_args *); +int linux_clone3(struct thread *, struct linux_clone3_args *); +int linux_close_range(struct thread *, struct linux_close_range_args *); +int linux_openat2(struct thread *, struct linux_openat2_args *); +int linux_pidfd_getfd(struct thread *, struct linux_pidfd_getfd_args *); +int linux_faccessat2(struct thread *, struct linux_faccessat2_args *); +int linux_process_madvise(struct thread *, struct linux_process_madvise_args *); +int linux_epoll_pwait2(struct thread *, struct linux_epoll_pwait2_args *); +int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); #ifdef COMPAT_43 @@ -1945,6 +2005,21 @@ int linux_io_uring_register(struct thread *, struct linux_io_uring_register_args #define LINUX_SYS_AUE_linux_io_uring_setup AUE_NULL #define LINUX_SYS_AUE_linux_io_uring_enter AUE_NULL #define LINUX_SYS_AUE_linux_io_uring_register AUE_NULL +#define LINUX_SYS_AUE_linux_open_tree AUE_NULL +#define LINUX_SYS_AUE_linux_move_mount AUE_NULL +#define LINUX_SYS_AUE_linux_fsopen AUE_NULL +#define LINUX_SYS_AUE_linux_fsconfig AUE_NULL +#define LINUX_SYS_AUE_linux_fsmount AUE_NULL +#define LINUX_SYS_AUE_linux_fspick AUE_NULL +#define LINUX_SYS_AUE_linux_pidfd_open AUE_NULL +#define LINUX_SYS_AUE_linux_clone3 AUE_NULL +#define LINUX_SYS_AUE_linux_close_range AUE_NULL +#define LINUX_SYS_AUE_linux_openat2 AUE_NULL +#define LINUX_SYS_AUE_linux_pidfd_getfd AUE_NULL +#define LINUX_SYS_AUE_linux_faccessat2 AUE_NULL +#define LINUX_SYS_AUE_linux_process_madvise AUE_NULL +#define LINUX_SYS_AUE_linux_epoll_pwait2 AUE_NULL +#define LINUX_SYS_AUE_linux_mount_setattr AUE_NULL #undef PAD_ #undef PADL_ diff --git a/sys/amd64/linux/linux_syscall.h b/sys/amd64/linux/linux_syscall.h index b222cd3d9c16..2416d23abd6d 100644 --- a/sys/amd64/linux/linux_syscall.h +++ b/sys/amd64/linux/linux_syscall.h @@ -329,4 +329,19 @@ #define LINUX_SYS_linux_io_uring_setup 425 #define LINUX_SYS_linux_io_uring_enter 426 #define LINUX_SYS_linux_io_uring_register 427 -#define LINUX_SYS_MAXSYSCALL 429 +#define LINUX_SYS_linux_open_tree 428 +#define LINUX_SYS_linux_move_mount 429 +#define LINUX_SYS_linux_fsopen 430 +#define LINUX_SYS_linux_fsconfig 431 +#define LINUX_SYS_linux_fsmount 432 +#define LINUX_SYS_linux_fspick 433 +#define LINUX_SYS_linux_pidfd_open 434 +#define LINUX_SYS_linux_clone3 435 +#define LINUX_SYS_linux_close_range 436 +#define LINUX_SYS_linux_openat2 437 +#define LINUX_SYS_linux_pidfd_getfd 438 +#define LINUX_SYS_linux_faccessat2 439 +#define LINUX_SYS_linux_process_madvise 440 +#define LINUX_SYS_linux_epoll_pwait2 441 +#define LINUX_SYS_linux_mount_setattr 442 +#define LINUX_SYS_MAXSYSCALL 444 diff --git a/sys/amd64/linux/linux_syscalls.c b/sys/amd64/linux/linux_syscalls.c index 393ebfb8d1c1..077d0230b261 100644 --- a/sys/amd64/linux/linux_syscalls.c +++ b/sys/amd64/linux/linux_syscalls.c @@ -435,5 +435,20 @@ const char *linux_syscallnames[] = { "linux_io_uring_setup", /* 425 = linux_io_uring_setup */ "linux_io_uring_enter", /* 426 = linux_io_uring_enter */ "linux_io_uring_register", /* 427 = linux_io_uring_register */ - "#428", /* 428 = nosys */ + "linux_open_tree", /* 428 = linux_open_tree */ + "linux_move_mount", /* 429 = linux_move_mount */ + "linux_fsopen", /* 430 = linux_fsopen */ + "linux_fsconfig", /* 431 = linux_fsconfig */ + "linux_fsmount", /* 432 = linux_fsmount */ + "linux_fspick", /* 433 = linux_fspick */ + "linux_pidfd_open", /* 434 = linux_pidfd_open */ + "linux_clone3", /* 435 = linux_clone3 */ + "linux_close_range", /* 436 = linux_close_range */ + "linux_openat2", /* 437 = linux_openat2 */ + "linux_pidfd_getfd", /* 438 = linux_pidfd_getfd */ + "linux_faccessat2", /* 439 = linux_faccessat2 */ + "linux_process_madvise", /* 440 = linux_process_madvise */ + "linux_epoll_pwait2", /* 441 = linux_epoll_pwait2 */ + "linux_mount_setattr", /* 442 = linux_mount_setattr */ + "#443", /* 443 = nosys */ }; diff --git a/sys/amd64/linux/linux_sysent.c b/sys/amd64/linux/linux_sysent.c index 558e56f87ba7..390f3bb4e32b 100644 --- a/sys/amd64/linux/linux_sysent.c +++ b/sys/amd64/linux/linux_sysent.c @@ -445,5 +445,20 @@ struct sysent linux_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_uring_setup, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 425 = linux_io_uring_setup */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_uring_enter, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 426 = linux_io_uring_enter */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_uring_register, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 427 = linux_io_uring_register */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 428 = nosys */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_open_tree, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 428 = linux_open_tree */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_move_mount, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 429 = linux_move_mount */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fsopen, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 430 = linux_fsopen */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fsconfig, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 431 = linux_fsconfig */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fsmount, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 432 = linux_fsmount */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fspick, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 433 = linux_fspick */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pidfd_open, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 434 = linux_pidfd_open */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clone3, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 435 = linux_clone3 */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_close_range, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 436 = linux_close_range */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_openat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 437 = linux_openat2 */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pidfd_getfd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 438 = linux_pidfd_getfd */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_faccessat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 439 = linux_faccessat2 */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_process_madvise, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 440 = linux_process_madvise */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_epoll_pwait2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 441 = linux_epoll_pwait2 */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_mount_setattr, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 442 = linux_mount_setattr */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 443 = nosys */ }; diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c index daacb1af287c..da43328aad5a 100644 --- a/sys/amd64/linux/linux_systrace_args.c +++ b/sys/amd64/linux/linux_systrace_args.c @@ -2640,6 +2640,81 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 0; break; } + /* linux_open_tree */ + case 428: { + *n_args = 0; + break; + } + /* linux_move_mount */ + case 429: { + *n_args = 0; + break; + } + /* linux_fsopen */ + case 430: { + *n_args = 0; + break; + } + /* linux_fsconfig */ + case 431: { + *n_args = 0; + break; + } + /* linux_fsmount */ + case 432: { + *n_args = 0; + break; + } + /* linux_fspick */ + case 433: { + *n_args = 0; + break; + } + /* linux_pidfd_open */ + case 434: { + *n_args = 0; + break; + } + /* linux_clone3 */ + case 435: { + *n_args = 0; + break; + } + /* linux_close_range */ + case 436: { + *n_args = 0; + break; + } + /* linux_openat2 */ + case 437: { + *n_args = 0; + break; + } + /* linux_pidfd_getfd */ + case 438: { + *n_args = 0; + break; + } + /* linux_faccessat2 */ + case 439: { + *n_args = 0; + break; + } + /* linux_process_madvise */ + case 440: { + *n_args = 0; + break; + } + /* linux_epoll_pwait2 */ + case 441: { + *n_args = 0; + break; + } + /* linux_mount_setattr */ + case 442: { + *n_args = 0; + break; + } default: *n_args = 0; break; @@ -6909,6 +6984,51 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) /* linux_io_uring_register */ case 427: break; + /* linux_open_tree */ + case 428: + break; + /* linux_move_mount */ + case 429: + break; + /* linux_fsopen */ + case 430: + break; + /* linux_fsconfig */ + case 431: + break; + /* linux_fsmount */ + case 432: + break; + /* linux_fspick */ + case 433: + break; + /* linux_pidfd_open */ + case 434: + break; + /* linux_clone3 */ + case 435: + break; + /* linux_close_range */ + case 436: + break; + /* linux_openat2 */ + case 437: + break; + /* linux_pidfd_getfd */ + case 438: + break; + /* linux_faccessat2 */ + case 439: + break; + /* linux_process_madvise */ + case 440: + break; + /* linux_epoll_pwait2 */ + case 441: + break; + /* linux_mount_setattr */ + case 442: + break; default: break; }; @@ -8355,6 +8475,36 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 426: /* linux_io_uring_register */ case 427: + /* linux_open_tree */ + case 428: + /* linux_move_mount */ + case 429: + /* linux_fsopen */ + case 430: + /* linux_fsconfig */ + case 431: + /* linux_fsmount */ + case 432: + /* linux_fspick */ + case 433: + /* linux_pidfd_open */ + case 434: + /* linux_clone3 */ + case 435: + /* linux_close_range */ + case 436: + /* linux_openat2 */ + case 437: + /* linux_pidfd_getfd */ + case 438: + /* linux_faccessat2 */ + case 439: + /* linux_process_madvise */ + case 440: + /* linux_epoll_pwait2 */ + case 441: + /* linux_mount_setattr */ + case 442: default: break; }; diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index f9402c8e815b..3055651ac382 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -1593,6 +1593,51 @@ struct linux_io_uring_enter_args { struct linux_io_uring_register_args { register_t dummy; }; +struct linux_open_tree_args { + register_t dummy; +}; +struct linux_move_mount_args { + register_t dummy; +}; +struct linux_fsopen_args { + register_t dummy; +}; +struct linux_fsconfig_args { + register_t dummy; +}; +struct linux_fsmount_args { + register_t dummy; +}; +struct linux_fspick_args { + register_t dummy; +}; +struct linux_pidfd_open_args { + register_t dummy; +}; +struct linux_clone3_args { + register_t dummy; +}; +struct linux_close_range_args { + register_t dummy; +}; +struct linux_openat2_args { + register_t dummy; +}; +struct linux_pidfd_getfd_args { + register_t dummy; +}; +struct linux_faccessat2_args { + register_t dummy; +}; +struct linux_process_madvise_args { + register_t dummy; +}; +struct linux_epoll_pwait2_args { + register_t dummy; +}; +struct linux_mount_setattr_args { + register_t dummy; +}; #define nosys linux_nosys int linux_exit(struct thread *, struct linux_exit_args *); int linux_fork(struct thread *, struct linux_fork_args *); @@ -1941,6 +1986,21 @@ int linux_pidfd_send_signal(struct thread *, struct linux_pidfd_send_signal_args int linux_io_uring_setup(struct thread *, struct linux_io_uring_setup_args *); int linux_io_uring_enter(struct thread *, struct linux_io_uring_enter_args *); int linux_io_uring_register(struct thread *, struct linux_io_uring_register_args *); +int linux_open_tree(struct thread *, struct linux_open_tree_args *); +int linux_move_mount(struct thread *, struct linux_move_mount_args *); +int linux_fsopen(struct thread *, struct linux_fsopen_args *); +int linux_fsconfig(struct thread *, struct linux_fsconfig_args *); +int linux_fsmount(struct thread *, struct linux_fsmount_args *); +int linux_fspick(struct thread *, struct linux_fspick_args *); +int linux_pidfd_open(struct thread *, struct linux_pidfd_open_args *); +int linux_clone3(struct thread *, struct linux_clone3_args *); +int linux_close_range(struct thread *, struct linux_close_range_args *); +int linux_openat2(struct thread *, struct linux_openat2_args *); +int linux_pidfd_getfd(struct thread *, struct linux_pidfd_getfd_args *); +int linux_faccessat2(struct thread *, struct linux_faccessat2_args *); +int linux_process_madvise(struct thread *, struct linux_process_madvise_args *); +int linux_epoll_pwait2(struct thread *, struct linux_epoll_pwait2_args *); +int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); #ifdef COMPAT_43 @@ -2337,6 +2397,21 @@ int linux_io_uring_register(struct thread *, struct linux_io_uring_register_args #define LINUX32_SYS_AUE_linux_io_uring_setup AUE_NULL #define LINUX32_SYS_AUE_linux_io_uring_enter AUE_NULL #define LINUX32_SYS_AUE_linux_io_uring_register AUE_NULL +#define LINUX32_SYS_AUE_linux_open_tree AUE_NULL +#define LINUX32_SYS_AUE_linux_move_mount AUE_NULL +#define LINUX32_SYS_AUE_linux_fsopen AUE_NULL +#define LINUX32_SYS_AUE_linux_fsconfig AUE_NULL +#define LINUX32_SYS_AUE_linux_fsmount AUE_NULL +#define LINUX32_SYS_AUE_linux_fspick AUE_NULL +#define LINUX32_SYS_AUE_linux_pidfd_open AUE_NULL +#define LINUX32_SYS_AUE_linux_clone3 AUE_NULL +#define LINUX32_SYS_AUE_linux_close_range AUE_NULL +#define LINUX32_SYS_AUE_linux_openat2 AUE_NULL +#define LINUX32_SYS_AUE_linux_pidfd_getfd AUE_NULL +#define LINUX32_SYS_AUE_linux_faccessat2 AUE_NULL +#define LINUX32_SYS_AUE_linux_process_madvise AUE_NULL +#define LINUX32_SYS_AUE_linux_epoll_pwait2 AUE_NULL +#define LINUX32_SYS_AUE_linux_mount_setattr AUE_NULL #undef PAD_ #undef PADL_ diff --git a/sys/amd64/linux32/linux32_syscall.h b/sys/amd64/linux32/linux32_syscall.h index 198941a856b1..e82029ce6705 100644 --- a/sys/amd64/linux32/linux32_syscall.h +++ b/sys/amd64/linux32/linux32_syscall.h @@ -389,4 +389,19 @@ #define LINUX32_SYS_linux_io_uring_setup 425 #define LINUX32_SYS_linux_io_uring_enter 426 #define LINUX32_SYS_linux_io_uring_register 427 -#define LINUX32_SYS_MAXSYSCALL 429 +#define LINUX32_SYS_linux_open_tree 428 +#define LINUX32_SYS_linux_move_mount 429 +#define LINUX32_SYS_linux_fsopen 430 +#define LINUX32_SYS_linux_fsconfig 431 +#define LINUX32_SYS_linux_fsmount 432 +#define LINUX32_SYS_linux_fspick 433 +#define LINUX32_SYS_linux_pidfd_open 434 +#define LINUX32_SYS_linux_clone3 435 +#define LINUX32_SYS_linux_close_range 436 +#define LINUX32_SYS_linux_openat2 437 +#define LINUX32_SYS_linux_pidfd_getfd 438 +#define LINUX32_SYS_linux_faccessat2 439 +#define LINUX32_SYS_linux_process_madvise 440 +#define LINUX32_SYS_linux_epoll_pwait2 441 +#define LINUX32_SYS_linux_mount_setattr 442 +#define LINUX32_SYS_MAXSYSCALL 444 diff --git a/sys/amd64/linux32/linux32_syscalls.c b/sys/amd64/linux32/linux32_syscalls.c index 325443bc5895..c60e40452d35 100644 --- a/sys/amd64/linux32/linux32_syscalls.c +++ b/sys/amd64/linux32/linux32_syscalls.c @@ -435,5 +435,20 @@ const char *linux32_syscallnames[] = { "linux_io_uring_setup", /* 425 = linux_io_uring_setup */ "linux_io_uring_enter", /* 426 = linux_io_uring_enter */ "linux_io_uring_register", /* 427 = linux_io_uring_register */ - "#428", /* 428 = nosys */ + "linux_open_tree", /* 428 = linux_open_tree */ + "linux_move_mount", /* 429 = linux_move_mount */ + "linux_fsopen", /* 430 = linux_fsopen */ + "linux_fsconfig", /* 431 = linux_fsconfig */ + "linux_fsmount", /* 432 = linux_fsmount */ + "linux_fspick", /* 433 = linux_fspick */ + "linux_pidfd_open", /* 434 = linux_pidfd_open */ + "linux_clone3", /* 435 = linux_clone3 */ + "linux_close_range", /* 436 = linux_close_range */ + "linux_openat2", /* 437 = linux_openat2 */ + "linux_pidfd_getfd", /* 438 = linux_pidfd_getfd */ + "linux_faccessat2", /* 439 = linux_faccessat2 */ + "linux_process_madvise", /* 440 = linux_process_madvise */ + "linux_epoll_pwait2", /* 441 = linux_epoll_pwait2 */ + "linux_mount_setattr", /* 442 = linux_mount_setattr */ + "#443", /* 443 = nosys */ }; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index 6da5fcb1fad9..4c0c0e991244 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -445,5 +445,20 @@ struct sysent linux32_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_uring_setup, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 425 = linux_io_uring_setup */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_uring_enter, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 426 = linux_io_uring_enter */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_uring_register, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 427 = linux_io_uring_register */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 428 = nosys */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_open_tree, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 428 = linux_open_tree */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_move_mount, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 429 = linux_move_mount */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fsopen, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 430 = linux_fsopen */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fsconfig, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 431 = linux_fsconfig */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fsmount, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 432 = linux_fsmount */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fspick, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 433 = linux_fspick */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pidfd_open, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 434 = linux_pidfd_open */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clone3, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 435 = linux_clone3 */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_close_range, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 436 = linux_close_range */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_openat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 437 = linux_openat2 */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pidfd_getfd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 438 = linux_pidfd_getfd */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_faccessat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 439 = linux_faccessat2 */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_process_madvise, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 440 = linux_process_madvise */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_epoll_pwait2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 441 = linux_epoll_pwait2 */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_mount_setattr, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 442 = linux_mount_setattr */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 443 = nosys */ }; diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 9df53d81b1e8..1a1f46412f33 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -3085,6 +3085,81 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 0; break; } + /* linux_open_tree */ + case 428: { + *n_args = 0; + break; + } + /* linux_move_mount */ + case 429: { + *n_args = 0; + break; + } + /* linux_fsopen */ + case 430: { + *n_args = 0; + break; + } + /* linux_fsconfig */ + case 431: { + *n_args = 0; + break; + } + /* linux_fsmount */ + case 432: { + *n_args = 0; + break; + } + /* linux_fspick */ + case 433: { + *n_args = 0; + break; + } + /* linux_pidfd_open */ + case 434: { + *n_args = 0; + break; + } + /* linux_clone3 */ + case 435: { + *n_args = 0; + break; + } + /* linux_close_range */ + case 436: { + *n_args = 0; + break; + } + /* linux_openat2 */ + case 437: { + *n_args = 0; + break; + } + /* linux_pidfd_getfd */ + case 438: { + *n_args = 0; + break; + } + /* linux_faccessat2 */ + case 439: { + *n_args = 0; + break; + } + /* linux_process_madvise */ + case 440: { + *n_args = 0; + break; + } + /* linux_epoll_pwait2 */ + case 441: { + *n_args = 0; + break; + } + /* linux_mount_setattr */ + case 442: { + *n_args = 0; + break; + } default: *n_args = 0; break; @@ -7997,6 +8072,51 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) /* linux_io_uring_register */ case 427: break; + /* linux_open_tree */ + case 428: + break; + /* linux_move_mount */ + case 429: + break; + /* linux_fsopen */ + case 430: + break; + /* linux_fsconfig */ + case 431: + break; + /* linux_fsmount */ + case 432: + break; + /* linux_fspick */ + case 433: + break; + /* linux_pidfd_open */ + case 434: + break; + /* linux_clone3 */ + case 435: + break; + /* linux_close_range */ + case 436: + break; + /* linux_openat2 */ + case 437: + break; + /* linux_pidfd_getfd */ + case 438: + break; + /* linux_faccessat2 */ + case 439: + break; + /* linux_process_madvise */ + case 440: + break; + /* linux_epoll_pwait2 */ + case 441: + break; + /* linux_mount_setattr */ + case 442: + break; default: break; }; @@ -9685,6 +9805,36 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 426: /* linux_io_uring_register */ case 427: + /* linux_open_tree */ + case 428: + /* linux_move_mount */ + case 429: + /* linux_fsopen */ + case 430: + /* linux_fsconfig */ + case 431: + /* linux_fsmount */ + case 432: + /* linux_fspick */ + case 433: + /* linux_pidfd_open */ + case 434: + /* linux_clone3 */ + case 435: + /* linux_close_range */ + case 436: + /* linux_openat2 */ + case 437: + /* linux_pidfd_getfd */ + case 438: + /* linux_faccessat2 */ + case 439: + /* linux_process_madvise */ + case 440: + /* linux_epoll_pwait2 */ + case 441: + /* linux_mount_setattr */ + case 442: default: break; }; diff --git a/sys/arm64/linux/linux_proto.h b/sys/arm64/linux/linux_proto.h index 6d6a3123d362..8953a9d71401 100644 --- a/sys/arm64/linux/linux_proto.h +++ b/sys/arm64/linux/linux_proto.h @@ -1115,6 +1115,82 @@ struct linux_pkey_alloc_args { struct linux_pkey_free_args { char pkey_l_[PADL_(l_int)]; l_int pkey; char pkey_r_[PADR_(l_int)]; }; +struct linux_statx_args { + char dirfd_l_[PADL_(l_int)]; l_int dirfd; char dirfd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; + char mask_l_[PADL_(l_uint)]; l_uint mask; char mask_r_[PADR_(l_uint)]; + char statxbuf_l_[PADL_(void *)]; void * statxbuf; char statxbuf_r_[PADR_(void *)]; +}; +struct linux_io_pgetevents_args { + register_t dummy; +}; +struct linux_rseq_args { + register_t dummy; +}; +struct linux_kexec_file_load_args { + register_t dummy; +}; +struct linux_pidfd_send_signal_args { + char pidfd_l_[PADL_(l_int)]; l_int pidfd; char pidfd_r_[PADR_(l_int)]; + char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; + char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; +}; +struct linux_io_uring_setup_args { + register_t dummy; +}; +struct linux_io_uring_enter_args { + register_t dummy; +}; +struct linux_io_uring_register_args { + register_t dummy; +}; +struct linux_open_tree_args { + register_t dummy; +}; +struct linux_move_mount_args { + register_t dummy; +}; +struct linux_fsopen_args { + register_t dummy; +}; +struct linux_fsconfig_args { + register_t dummy; +}; +struct linux_fsmount_args { + register_t dummy; +}; +struct linux_fspick_args { + register_t dummy; +}; +struct linux_pidfd_open_args { + register_t dummy; +}; +struct linux_clone3_args { + register_t dummy; +}; +struct linux_close_range_args { + register_t dummy; +}; +struct linux_openat2_args { + register_t dummy; +}; +struct linux_pidfd_getfd_args { + register_t dummy; +}; +struct linux_faccessat2_args { + register_t dummy; +}; +struct linux_process_madvise_args { + register_t dummy; +}; +struct linux_epoll_pwait2_args { + register_t dummy; +}; +struct linux_mount_setattr_args { + register_t dummy; +}; #define nosys linux_nosys int linux_setxattr(struct thread *, struct linux_setxattr_args *); int linux_lsetxattr(struct thread *, struct linux_lsetxattr_args *); @@ -1342,6 +1418,29 @@ int linux_pwritev2(struct thread *, struct linux_pwritev2_args *); int linux_pkey_mprotect(struct thread *, struct linux_pkey_mprotect_args *); int linux_pkey_alloc(struct thread *, struct linux_pkey_alloc_args *); int linux_pkey_free(struct thread *, struct linux_pkey_free_args *); +int linux_statx(struct thread *, struct linux_statx_args *); +int linux_io_pgetevents(struct thread *, struct linux_io_pgetevents_args *); +int linux_rseq(struct thread *, struct linux_rseq_args *); +int linux_kexec_file_load(struct thread *, struct linux_kexec_file_load_args *); +int linux_pidfd_send_signal(struct thread *, struct linux_pidfd_send_signal_args *); +int linux_io_uring_setup(struct thread *, struct linux_io_uring_setup_args *); +int linux_io_uring_enter(struct thread *, struct linux_io_uring_enter_args *); +int linux_io_uring_register(struct thread *, struct linux_io_uring_register_args *); +int linux_open_tree(struct thread *, struct linux_open_tree_args *); +int linux_move_mount(struct thread *, struct linux_move_mount_args *); +int linux_fsopen(struct thread *, struct linux_fsopen_args *); +int linux_fsconfig(struct thread *, struct linux_fsconfig_args *); +int linux_fsmount(struct thread *, struct linux_fsmount_args *); +int linux_fspick(struct thread *, struct linux_fspick_args *); +int linux_pidfd_open(struct thread *, struct linux_pidfd_open_args *); +int linux_clone3(struct thread *, struct linux_clone3_args *); +int linux_close_range(struct thread *, struct linux_close_range_args *); +int linux_openat2(struct thread *, struct linux_openat2_args *); +int linux_pidfd_getfd(struct thread *, struct linux_pidfd_getfd_args *); +int linux_faccessat2(struct thread *, struct linux_faccessat2_args *); +int linux_process_madvise(struct thread *, struct linux_process_madvise_args *); +int linux_epoll_pwait2(struct thread *, struct linux_epoll_pwait2_args *); +int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); #ifdef COMPAT_43 @@ -1617,6 +1716,29 @@ int linux_pkey_free(struct thread *, struct linux_pkey_free_args *); #define LINUX_SYS_AUE_linux_pkey_mprotect AUE_NULL #define LINUX_SYS_AUE_linux_pkey_alloc AUE_NULL #define LINUX_SYS_AUE_linux_pkey_free AUE_NULL +#define LINUX_SYS_AUE_linux_statx AUE_NULL +#define LINUX_SYS_AUE_linux_io_pgetevents AUE_NULL +#define LINUX_SYS_AUE_linux_rseq AUE_NULL +#define LINUX_SYS_AUE_linux_kexec_file_load AUE_NULL +#define LINUX_SYS_AUE_linux_pidfd_send_signal AUE_NULL +#define LINUX_SYS_AUE_linux_io_uring_setup AUE_NULL +#define LINUX_SYS_AUE_linux_io_uring_enter AUE_NULL +#define LINUX_SYS_AUE_linux_io_uring_register AUE_NULL +#define LINUX_SYS_AUE_linux_open_tree AUE_NULL +#define LINUX_SYS_AUE_linux_move_mount AUE_NULL +#define LINUX_SYS_AUE_linux_fsopen AUE_NULL +#define LINUX_SYS_AUE_linux_fsconfig AUE_NULL +#define LINUX_SYS_AUE_linux_fsmount AUE_NULL +#define LINUX_SYS_AUE_linux_fspick AUE_NULL +#define LINUX_SYS_AUE_linux_pidfd_open AUE_NULL +#define LINUX_SYS_AUE_linux_clone3 AUE_NULL +#define LINUX_SYS_AUE_linux_close_range AUE_NULL +#define LINUX_SYS_AUE_linux_openat2 AUE_NULL +#define LINUX_SYS_AUE_linux_pidfd_getfd AUE_NULL +#define LINUX_SYS_AUE_linux_faccessat2 AUE_NULL +#define LINUX_SYS_AUE_linux_process_madvise AUE_NULL +#define LINUX_SYS_AUE_linux_epoll_pwait2 AUE_NULL +#define LINUX_SYS_AUE_linux_mount_setattr AUE_NULL #undef PAD_ #undef PADL_ diff --git a/sys/arm64/linux/linux_syscall.h b/sys/arm64/linux/linux_syscall.h index 975229304af6..ab4fb534a8cb 100644 --- a/sys/arm64/linux/linux_syscall.h +++ b/sys/arm64/linux/linux_syscall.h @@ -269,4 +269,27 @@ #define LINUX_SYS_linux_pkey_mprotect 288 #define LINUX_SYS_linux_pkey_alloc 289 #define LINUX_SYS_linux_pkey_free 290 -#define LINUX_SYS_MAXSYSCALL 292 +#define LINUX_SYS_linux_statx 291 +#define LINUX_SYS_linux_io_pgetevents 292 +#define LINUX_SYS_linux_rseq 293 +#define LINUX_SYS_linux_kexec_file_load 294 +#define LINUX_SYS_linux_pidfd_send_signal 424 +#define LINUX_SYS_linux_io_uring_setup 425 +#define LINUX_SYS_linux_io_uring_enter 426 +#define LINUX_SYS_linux_io_uring_register 427 +#define LINUX_SYS_linux_open_tree 428 +#define LINUX_SYS_linux_move_mount 429 +#define LINUX_SYS_linux_fsopen 430 +#define LINUX_SYS_linux_fsconfig 431 +#define LINUX_SYS_linux_fsmount 432 +#define LINUX_SYS_linux_fspick 433 +#define LINUX_SYS_linux_pidfd_open 434 +#define LINUX_SYS_linux_clone3 435 +#define LINUX_SYS_linux_close_range 436 +#define LINUX_SYS_linux_openat2 437 +#define LINUX_SYS_linux_pidfd_getfd 438 +#define LINUX_SYS_linux_faccessat2 439 +#define LINUX_SYS_linux_process_madvise 440 +#define LINUX_SYS_linux_epoll_pwait2 441 +#define LINUX_SYS_linux_mount_setattr 442 +#define LINUX_SYS_MAXSYSCALL 444 diff --git a/sys/arm64/linux/linux_syscalls.c b/sys/arm64/linux/linux_syscalls.c index 9ce335174db8..21bb3ccf88f6 100644 --- a/sys/arm64/linux/linux_syscalls.c +++ b/sys/arm64/linux/linux_syscalls.c @@ -298,5 +298,157 @@ const char *linux_syscallnames[] = { "linux_pkey_mprotect", /* 288 = linux_pkey_mprotect */ "linux_pkey_alloc", /* 289 = linux_pkey_alloc */ "linux_pkey_free", /* 290 = linux_pkey_free */ - "#291", /* 291 = nosys */ + "linux_statx", /* 291 = linux_statx */ + "linux_io_pgetevents", /* 292 = linux_io_pgetevents */ + "linux_rseq", /* 293 = linux_rseq */ + "linux_kexec_file_load", /* 294 = linux_kexec_file_load */ + "#295", /* 295 = unimpl_md_syscall */ + "#296", /* 296 = unimpl_md_syscall */ + "#297", /* 297 = unimpl_md_syscall */ + "#298", /* 298 = unimpl_md_syscall */ + "#299", /* 299 = unimpl_md_syscall */ + "#300", /* 300 = unimpl_md_syscall */ + "#301", /* 301 = unimpl_md_syscall */ + "#302", /* 302 = unimpl_md_syscall */ + "#303", /* 303 = unimpl_md_syscall */ + "#304", /* 304 = unimpl_md_syscall */ + "#305", /* 305 = unimpl_md_syscall */ + "#306", /* 306 = unimpl_md_syscall */ + "#307", /* 307 = unimpl_md_syscall */ + "#308", /* 308 = unimpl_md_syscall */ + "#309", /* 309 = unimpl_md_syscall */ + "#310", /* 310 = unimpl_md_syscall */ + "#311", /* 311 = unimpl_md_syscall */ + "#312", /* 312 = unimpl_md_syscall */ + "#313", /* 313 = unimpl_md_syscall */ + "#314", /* 314 = unimpl_md_syscall */ + "#315", /* 315 = unimpl_md_syscall */ + "#316", /* 316 = unimpl_md_syscall */ + "#317", /* 317 = unimpl_md_syscall */ + "#318", /* 318 = unimpl_md_syscall */ + "#319", /* 319 = unimpl_md_syscall */ + "#320", /* 320 = unimpl_md_syscall */ + "#321", /* 321 = unimpl_md_syscall */ + "#322", /* 322 = unimpl_md_syscall */ + "#323", /* 323 = unimpl_md_syscall */ + "#324", /* 324 = unimpl_md_syscall */ + "#325", /* 325 = unimpl_md_syscall */ + "#326", /* 326 = unimpl_md_syscall */ + "#327", /* 327 = unimpl_md_syscall */ + "#328", /* 328 = unimpl_md_syscall */ + "#329", /* 329 = unimpl_md_syscall */ + "#330", /* 330 = unimpl_md_syscall */ + "#331", /* 331 = unimpl_md_syscall */ + "#332", /* 332 = unimpl_md_syscall */ + "#333", /* 333 = unimpl_md_syscall */ + "#334", /* 334 = unimpl_md_syscall */ + "#335", /* 335 = unimpl_md_syscall */ + "#336", /* 336 = unimpl_md_syscall */ + "#337", /* 337 = unimpl_md_syscall */ + "#338", /* 338 = unimpl_md_syscall */ + "#339", /* 339 = unimpl_md_syscall */ + "#340", /* 340 = unimpl_md_syscall */ + "#341", /* 341 = unimpl_md_syscall */ + "#342", /* 342 = unimpl_md_syscall */ + "#343", /* 343 = unimpl_md_syscall */ + "#344", /* 344 = unimpl_md_syscall */ + "#345", /* 345 = unimpl_md_syscall */ + "#346", /* 346 = unimpl_md_syscall */ + "#347", /* 347 = unimpl_md_syscall */ + "#348", /* 348 = unimpl_md_syscall */ *** 918 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri May 28 09:21: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 6C16164FB6F; Fri, 28 May 2021 09:21:08 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) (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 4Frzh41vJnz4jBH; Fri, 28 May 2021 09:21:07 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: by mail-ot1-x332.google.com with SMTP id 69-20020a9d0a4b0000b02902ed42f141e1so2909317otg.2; Fri, 28 May 2021 02:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2ZI45k/5uos3lObFuftHFXLPaGtd/WDPPi3VfnhKZ5s=; b=WiWQiQWkI7HuF3q9O8dG2ynt+uC1jYSIIdKCL8g3QPT9j+OI2nIZkwwDbbnbMlZzGE AFd2BATTk2atRKrk2KG+zErXNYW289rLCT82gs5smHhw82CyE136uTVf2OSbA82ki54U u9mUEDMtuHVi9FhSb/nYu6u2NdXYcWzDZnc+DgnnfOafMDR4oPWM5Tlmn3u9xiFGCGWc Ii9YDJWs6BXf6iGNiie6Htcdz0r3JKd5sqgP0ymtcvm57FIDiL1iSdhczJcHKyNNFQ/m SfhJvcu4RwdhefuMJsbfMxTX8XPfpFP+mBvYms/cATXnbvAhAtLIco/bvJs/cWyYu/4X dtMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2ZI45k/5uos3lObFuftHFXLPaGtd/WDPPi3VfnhKZ5s=; b=XMhNCmzJA3gPjPFMysIYmWwOnCFzG+W6n2WQBBzBMD+xOuoVXT8/G3UGZnsfJfNi1F MJyXnDUs5+IIo33erlHOglS/FbULSxjfJ2NB0C1GfRxj2tXx5M5ioeZCYfkRhASNVCTq SWePlasMWOAUvpdVde9wWRm1LVzOltFtdM2e8a/WtBZ2acZ4sjxXfF2T4T2k5uN78OBN AN/C5yO5tEb1wNYnCFM7rBt8gboCe0ro+4OY7+1lLWdA+b+B4F9h2wY3Qsl3HCSn2mXT MEneSHh0j6aaExfHCWxDzbR7r80lmI6j0Z1rdhsCCbi53UDAIDDNoBBuVn1BxM2Qk7ld dgrA== X-Gm-Message-State: AOAM5330EetL5z5i3/KSAQmsu64AXmiShWaw4SM7fn0s3b/t5mvzFaO0 zLJSIDAskpJogDv4jrO/X6t7pggDlunqysfhvTvWVGhW4L8= X-Google-Smtp-Source: ABdhPJxrRd2PBf9FjThCi17PqUq3m2JEKZnyqOcfI+yCmlHrA0uH2ST9BMvzS4wDw/RNZ+5hmJFXHnpu8wj296tyztU= X-Received: by 2002:a9d:65d6:: with SMTP id z22mr6300367oth.116.1622193666509; Fri, 28 May 2021 02:21:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:4186:0:0:0:0:0 with HTTP; Fri, 28 May 2021 02:21:05 -0700 (PDT) In-Reply-To: <4faa0667-ca1b-923b-fbae-c97b0b863589@FreeBSD.org> References: <202105212038.14LKcb3U062829@gitrepo.freebsd.org> <4faa0667-ca1b-923b-fbae-c97b0b863589@FreeBSD.org> From: Rob Wing Date: Fri, 28 May 2021 01:21:05 -0800 Message-ID: Subject: Re: git: f190f9193bc1 - main - Fix fsck_ufs segfaults with gjournal (SU+J) To: John Baldwin Cc: Kirk McKusick , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4Frzh41vJnz4jBH X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" 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: Fri, 28 May 2021 09:21:08 -0000 Hmm, I provided a fix for ( https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D245907) and it appears = to have created a spiderweb of breakage - as noted by jhb and chs (in commit 84768d114951e88288024f09d4beae0956c3cf21). I=E2=80=99ll have some time to dig into this in the next day or two. In the meantime, the best idea I have for an immediate fix is to revert the aforementioned commit and commit f190f9193bc10a8193c87e0a02fa91400e4eb159, then apply/test the patch found at: https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D225092&action=3Ddiff If there=E2=80=99s any input or suggestions, let me know. Thanks, Rob On Thursday, May 27, 2021, John Baldwin wrote: > On 5/21/21 1:38 PM, Kirk McKusick wrote: > >> The branch main has been updated by mckusick: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3Df190f9193bc10a8193c8 >> 7e0a02fa91400e4eb159 >> >> commit f190f9193bc10a8193c87e0a02fa91400e4eb159 >> Author: Kirk McKusick >> AuthorDate: 2021-05-21 20:41:40 +0000 >> Commit: Kirk McKusick >> CommitDate: 2021-05-21 20:42:37 +0000 >> >> Fix fsck_ufs segfaults with gjournal (SU+J) >> The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c= ) >> while attempting to traverse the buffer cache to flush dirty buffer= s. >> The tail queue used for the buffer cache was not initialized before >> dropping into gjournal_check(). Move the buffer initialization >> earlier >> so that it has been done before calling gjournal_check(). >> > > This appears to have broken fsck in at least some use cases. On my rpi > I get this error trying to boot: > > Setting hostid: 0x4ce29432. > Starting file system checks: > fsck_ufs: Initial malloc(-1515870811) failed > fsck_ufs: Initial malloc(-1515870811) failed > Automatic file system check failed; help! > ERROR: ABORTING BOOT (sending SIGTERM to parent)! > > The amount being passed to malloc() is malloc junk: > > (gdb) p/x -1515870811 > $1 =3D 0xa5a5a5a5 > > The i386 CI jobs in jenkins have been failing with the same error recentl= y > as well. > > I guess this means sblock isn't fully initialized by sblock_init()? At > least > not enough to set fs_bsize? Hmm, perhaps readsb() is what sets fs_bsize? > > -- > John Baldwin > From owner-dev-commits-src-main@freebsd.org Fri May 28 13:10: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 B0A8C65344A; Fri, 28 May 2021 13:10: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 4Fs4n14Qb0z3Hcb; Fri, 28 May 2021 13:10: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 7FDCF179FE; Fri, 28 May 2021 13:10: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 14SDAj9q000716; Fri, 28 May 2021 13:10:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SDAjAn000715; Fri, 28 May 2021 13:10:45 GMT (envelope-from git) Date: Fri, 28 May 2021 13:10:45 GMT Message-Id: <202105281310.14SDAjAn000715@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: d097687b3156 - main - arm64: correct END() copy-pasteo for generic_bs_fault 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: d097687b315671191b16494c938d3ceecd3eca4f 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, 28 May 2021 13:10:45 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d097687b315671191b16494c938d3ceecd3eca4f commit d097687b315671191b16494c938d3ceecd3eca4f Author: Ed Maste AuthorDate: 2021-05-28 00:10:26 +0000 Commit: Ed Maste CommitDate: 2021-05-28 13:10:11 +0000 arm64: correct END() copy-pasteo for generic_bs_fault PR: 256197 Reported by: Nick Reilly MFC after: 1 week Fixes: 95a85c125d0e67 ("Add NetBSD compatible bus_space_peek_N()...") Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/bus_space_asm.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/arm64/bus_space_asm.S b/sys/arm64/arm64/bus_space_asm.S index 53e104c7fb4f..1fac678df971 100644 --- a/sys/arm64/arm64/bus_space_asm.S +++ b/sys/arm64/arm64/bus_space_asm.S @@ -400,7 +400,7 @@ END(generic_bs_wr_8) ENTRY(generic_bs_fault) mov x0, #-1 ret -END(bus_fault) +END(generic_bs_fault) ENTRY(generic_bs_peek_1) .globl generic_bs_peek_1f From owner-dev-commits-src-main@freebsd.org Fri May 28 14:01: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 B74D2654109; Fri, 28 May 2021 14:01: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 4Fs5vl4dY1z3Mm3; Fri, 28 May 2021 14:01: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 872F7184D4; Fri, 28 May 2021 14:01: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 14SE1dNo069024; Fri, 28 May 2021 14:01:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SE1dSP069023; Fri, 28 May 2021 14:01:39 GMT (envelope-from git) Date: Fri, 28 May 2021 14:01:39 GMT Message-Id: <202105281401.14SE1dSP069023@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Nathan Whitehorn Subject: git: 40923b0c81cc - main - Fix scripted installation from media without local distfiles. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nwhitehorn X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40923b0c81cc2c151388ec5ead59f4bed89ac432 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, 28 May 2021 14:01:39 -0000 The branch main has been updated by nwhitehorn: URL: https://cgit.FreeBSD.org/src/commit/?id=40923b0c81cc2c151388ec5ead59f4bed89ac432 commit 40923b0c81cc2c151388ec5ead59f4bed89ac432 Author: Nathan Whitehorn AuthorDate: 2021-05-28 13:53:42 +0000 Commit: Nathan Whitehorn CommitDate: 2021-05-28 14:01:27 +0000 Fix scripted installation from media without local distfiles. The bsdinstall script target did not have the infrastructure to fetch distfiles from a remote server the way the interactive installer does on e.g. bootonly media. Solve this by factoring out the parts of the installer that deal with fetching missing distributions into a new install stage called 'fetchmissingdists', which is called by both the interactive and scripted installer frontends. In the course of these changes, cleaned up a few other issues with the fetching of missing distribution files and added a warning if fetching the MANIFEST file, which is used to verify the integrity of the distribution files. We should at some point add cryptographic signatures to MANIFEST so that it can be fetched safely if not present on the install media (which it is for bootonly media). Initial patch by: Vinícius Zavam PR: 255659, 250928 Reviewed by: dteske MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D27121 --- usr.sbin/bsdinstall/scripts/Makefile | 8 +- usr.sbin/bsdinstall/scripts/auto | 96 ++----------------- usr.sbin/bsdinstall/scripts/bootconfig | 6 +- usr.sbin/bsdinstall/scripts/fetchmissingdists | 132 ++++++++++++++++++++++++++ usr.sbin/bsdinstall/scripts/script | 8 ++ 5 files changed, 154 insertions(+), 96 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/Makefile b/usr.sbin/bsdinstall/scripts/Makefile index 11c4564ea909..147f49609921 100644 --- a/usr.sbin/bsdinstall/scripts/Makefile +++ b/usr.sbin/bsdinstall/scripts/Makefile @@ -1,9 +1,9 @@ # $FreeBSD$ -SCRIPTS= auto adduser bootconfig checksum config docsinstall entropy hardening \ - hostname jail keymap mirrorselect mount netconfig netconfig_ipv4 \ - netconfig_ipv6 rootpass script services time umount wlanconfig \ - zfsboot +SCRIPTS= auto adduser bootconfig checksum config docsinstall entropy \ + fetchmissingdists hardening hostname jail keymap mirrorselect mount \ + netconfig netconfig_ipv4 netconfig_ipv6 rootpass script services time \ + umount wlanconfig zfsboot BINDIR= ${LIBEXECDIR}/bsdinstall MAN= diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 58e74acb2d92..68809a22671b 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -77,7 +77,6 @@ error() local prompt="${1:+$1\n\n}$msg_an_installation_step_has_been_aborted" local hline="$hline_arrows_tab_space_enter" - [ "$DISTDIR_IS_UNIONFS" ] && umount -f "$BSDINSTALL_DISTDIR" [ -f "$PATH_FSTAB" ] && bsdinstall umount local height width @@ -170,17 +169,12 @@ if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then done fi -LOCAL_DISTRIBUTIONS="MANIFEST" FETCH_DISTRIBUTIONS="" for dist in $DISTRIBUTIONS; do if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist" - else - LOCAL_DISTRIBUTIONS="$LOCAL_DISTRIBUTIONS $dist" fi done -LOCAL_DISTRIBUTIONS=`echo $LOCAL_DISTRIBUTIONS` # Trim white space -FETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS` # Trim white space if [ -n "$FETCH_DISTRIBUTIONS" -a -n "$BSDINSTALL_CONFIGCURRENT" ]; then dialog --backtitle "FreeBSD Installer" --title "Network Installation" --msgbox "Some installation files were not found on the boot volume. The next few screens will allow you to configure networking so that they can be downloaded from the Internet." 0 0 @@ -188,15 +182,6 @@ if [ -n "$FETCH_DISTRIBUTIONS" -a -n "$BSDINSTALL_CONFIGCURRENT" ]; then NETCONFIG_DONE=yes fi -if [ -n "$FETCH_DISTRIBUTIONS" ]; then - exec 3>&1 - BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&3) - MIRROR_BUTTON=$? - exec 3>&- - test $MIRROR_BUTTON -eq 0 || error "No mirror selected" - export BSDINSTALL_DISTSITE -fi - rm -f $PATH_FSTAB touch $PATH_FSTAB @@ -347,79 +332,14 @@ case "$PARTMODE" in ;; esac -if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then - ALL_DISTRIBUTIONS="$DISTRIBUTIONS" - WANT_DEBUG= - - # Download to a directory in the new system as scratch space - BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist" - mkdir -p "$BSDINSTALL_FETCHDEST" || error "Could not create directory $BSDINSTALL_FETCHDEST" - - export DISTRIBUTIONS="$FETCH_DISTRIBUTIONS" - # Try to use any existing distfiles - if [ -d $BSDINSTALL_DISTDIR ]; then - DISTDIR_IS_UNIONFS=1 - mount_nullfs -o union "$BSDINSTALL_FETCHDEST" "$BSDINSTALL_DISTDIR" - else - export DISTRIBUTIONS="$FETCH_DISTRIBUTIONS" - export BSDINSTALL_DISTDIR="$BSDINSTALL_FETCHDEST" - fi - - export FTP_PASSIVE_MODE=YES - # Iterate through the distribution list and set a flag if debugging - # distributions have been selected. - for _DISTRIBUTION in $DISTRIBUTIONS; do - case $_DISTRIBUTION in - *-dbg.*) - [ -e $BSDINSTALL_DISTDIR/$_DISTRIBUTION ] \ - && continue - WANT_DEBUG=1 - DEBUG_LIST="\n$DEBUG_LIST\n$_DISTRIBUTION" - ;; - *) - ;; - esac - done - - # Fetch the distributions. - bsdinstall distfetch - rc=$? - - if [ $rc -ne 0 ]; then - # If unable to fetch the remote distributions, recommend - # deselecting the debugging distributions, and retrying the - # installation, since failure to fetch *-dbg.txz should not - # be considered a fatal installation error. - msg="Failed to fetch remote distribution" - if [ ! -z "$WANT_DEBUG" ]; then - # Trim leading and trailing newlines. - DEBUG_LIST="${DEBUG_LIST%%\n}" - DEBUG_LIST="${DEBUG_LIST##\n}" - msg="$msg\n\nPlease deselect the following distributions" - msg="$msg and retry the installation:" - msg="$msg\n$DEBUG_LIST" - fi - error "$msg" - fi - export DISTRIBUTIONS="$ALL_DISTRIBUTIONS" -fi +if [ -n "$FETCH_DISTRIBUTIONS" ]; then + exec 3>&1 + export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&3) + FETCH_RESULT=$? + exec 3>&- -if [ ! -z "$LOCAL_DISTRIBUTIONS" ]; then - # Download to a directory in the new system as scratch space - BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist" - mkdir -p "$BSDINSTALL_FETCHDEST" || error "Could not create directory $BSDINSTALL_FETCHDEST" - # Try to use any existing distfiles - if [ -d $BSDINSTALL_DISTDIR ]; then - DISTDIR_IS_UNIONFS=1 - mount_nullfs -o union "$BSDINSTALL_FETCHDEST" "$BSDINSTALL_DISTDIR" - export BSDINSTALL_DISTDIR="$BSDINSTALL_FETCHDEST" - fi - env DISTRIBUTIONS="$LOCAL_DISTRIBUTIONS" \ - BSDINSTALL_DISTSITE="file:///usr/freebsd-dist" \ - bsdinstall distfetch || \ - error "Failed to fetch distribution from local media" + [ $FETCH_RESULT -ne 0 ] && error "Could not fetch remote distributions" fi - bsdinstall checksum || error "Distribution checksum failed" bsdinstall distextract || error "Distribution extract failed" @@ -498,10 +418,6 @@ finalconfig trap error SIGINT # SIGINT is bad again bsdinstall config || error "Failed to save config" -if [ -n "$DISTDIR_IS_UNIONFS" ]; then - umount -f $BSDINSTALL_DISTDIR -fi - if [ ! -z "$BSDINSTALL_FETCHDEST" ]; then rm -rf "$BSDINSTALL_FETCHDEST" fi diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig index a592142d87a2..c0a0ff4f77ee 100755 --- a/usr.sbin/bsdinstall/scripts/bootconfig +++ b/usr.sbin/bsdinstall/scripts/bootconfig @@ -83,8 +83,10 @@ if [ -n "$(awk '{if ($2=="/boot/efi") printf("%s\n",$1);}' $PATH_FSTAB)" ]; then bootlabel="FreeBSD" - f_dprintf "Creating UEFI boot entry" - efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null + if [ "$BSDINSTALL_CONFIGCURRENT" ]; then + f_dprintf "Creating UEFI boot entry" + efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null + fi f_dprintf "Finished configuring ESP" fi diff --git a/usr.sbin/bsdinstall/scripts/fetchmissingdists b/usr.sbin/bsdinstall/scripts/fetchmissingdists new file mode 100644 index 000000000000..768217e2fb8c --- /dev/null +++ b/usr.sbin/bsdinstall/scripts/fetchmissingdists @@ -0,0 +1,132 @@ +#!/bin/sh +#- +# Copyright (c) 2011 Nathan Whitehorn +# Copyright (c) 2013-2018 Devin Teske +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +error() +{ + dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox $1 0 0 + exit 1 +} + +FETCH_DISTRIBUTIONS="" +LOCAL_DISTRIBUTIONS="" +for dist in $DISTRIBUTIONS; do + if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then + FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist" + else + LOCAL_DISTRIBUTIONS="$LOCAL_DISTRIBUTIONS $dist" + fi +done +LOCAL_DISTRIBUTIONS=`echo $LOCAL_DISTRIBUTIONS` # Trim white space +FETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS` # Trim white space + +if [ -z "$FETCH_DISTRIBUTIONS" ]; then + echo $BSDINSTALL_DISTDIR >&2 + exit 0 +fi + +ALL_DISTRIBUTIONS="$DISTRIBUTIONS" +WANT_DEBUG= + +# Download to a directory in the new system as scratch space +BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist" +mkdir -p "$BSDINSTALL_FETCHDEST" || error "Could not create directory $BSDINSTALL_FETCHDEST" + +if [ -z "$BSDINSTALL_DISTSITE" ]; then + exec 3>&1 + BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&3) + MIRROR_BUTTON=$? + exec 3>&- + test $MIRROR_BUTTON -eq 0 || error "No mirror selected" + export BSDINSTALL_DISTSITE +fi + +BSDINSTALL_DISTDIR_ORIG="$BSDINSTALL_DISTDIR" +export BSDINSTALL_DISTDIR="$BSDINSTALL_FETCHDEST" +export FTP_PASSIVE_MODE=YES + +if [ -f "$BSDINSTALL_DISTDIR_ORIG/MANIFEST" ]; then + cp "$BSDINSTALL_DISTDIR_ORIG/MANIFEST" "$BSDINSTALL_DISTDIR/MANIFEST" + VERIFY_MANIFEST_SIG=0 +else + FETCH_DISTRIBUTIONS="MANIFEST $FETCH_DISTRIBUTIONS" + VERIFY_MANIFEST_SIG=1 + + # XXX actually verify signature on manifest + dialog --backtitle "FreeBSD Installer" --title "Warning" --msgbox "Manifest not found on local disk and will be fetched from an unverified source. This is a potential security risk. If you do not wish to proceed, press control-C now." 0 0 +fi + +if [ ! -z "$LOCAL_DISTRIBUTIONS" ]; then + # Copy local stuff first + env DISTRIBUTIONS="$LOCAL_DISTRIBUTIONS" \ + BSDINSTALL_DISTSITE="file://$BSDINSTALL_DISTDIR" \ + bsdinstall distfetch || \ + error "Failed to fetch distribution from local media" +fi + +export DISTRIBUTIONS="$FETCH_DISTRIBUTIONS" + +# Iterate through the distribution list and set a flag if debugging +# distributions have been selected. +for _DISTRIBUTION in $DISTRIBUTIONS; do + case $_DISTRIBUTION in + *-dbg.*) + [ -e $BSDINSTALL_DISTDIR/$_DISTRIBUTION ] \ + && continue + WANT_DEBUG=1 + DEBUG_LIST="\n$DEBUG_LIST\n$_DISTRIBUTION" + ;; + *) + ;; + esac +done + +# Fetch the distributions. +bsdinstall distfetch +rc=$? + +if [ $rc -ne 0 ]; then + # If unable to fetch the remote distributions, recommend + # deselecting the debugging distributions, and retrying the + # installation, since failure to fetch *-dbg.txz should not + # be considered a fatal installation error. + msg="Failed to fetch remote distribution" + if [ ! -z "$WANT_DEBUG" ]; then + # Trim leading and trailing newlines. + DEBUG_LIST="${DEBUG_LIST%%\n}" + DEBUG_LIST="${DEBUG_LIST##\n}" + msg="$msg\n\nPlease deselect the following distributions" + msg="$msg and retry the installation:" + msg="$msg\n$DEBUG_LIST" + fi + error "$msg" +fi + +echo $BSDINSTALL_DISTDIR >&2 + diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script index 6a03e88bba39..131ef008d35f 100755 --- a/usr.sbin/bsdinstall/scripts/script +++ b/usr.sbin/bsdinstall/scripts/script @@ -114,6 +114,14 @@ else fi bsdinstall mount +# Fetch missing distribution files, if any +exec 3>&1 +export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&3) +FETCH_RESULT=$? +exec 3>&- + +[ $FETCH_RESULT -ne 0 ] && error "Could not fetch remote distributions" + # Unpack distributions bsdinstall checksum if [ -t 0 ]; then From owner-dev-commits-src-main@freebsd.org Fri May 28 14:21: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 B6F56654517; Fri, 28 May 2021 14:21: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 4Fs6MC4rBNz3NvZ; Fri, 28 May 2021 14:21: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 8E272188B5; Fri, 28 May 2021 14:21: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 14SELxVk099415; Fri, 28 May 2021 14:21:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SELxWY099414; Fri, 28 May 2021 14:21:59 GMT (envelope-from git) Date: Fri, 28 May 2021 14:21:59 GMT Message-Id: <202105281421.14SELxWY099414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 023ee5392c77 - main - linux: make linux64.ko loadable again on aarch64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 023ee5392c77fbb803ea7552d7a25f7d231e56f8 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, 28 May 2021 14:21:59 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=023ee5392c77fbb803ea7552d7a25f7d231e56f8 commit 023ee5392c77fbb803ea7552d7a25f7d231e56f8 Author: Edward Tomasz Napierala AuthorDate: 2021-05-28 13:53:31 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-28 14:20:30 +0000 linux: make linux64.ko loadable again on aarch64 This should probably get deduplicated; this is a quick fix just to unbreak things. Fixes: 6d926e850d2 Sponsored By: EPSRC --- sys/arm64/linux/linux_dummy_machdep.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/arm64/linux/linux_dummy_machdep.c b/sys/arm64/linux/linux_dummy_machdep.c index b006809740d7..47b6ac093cb1 100644 --- a/sys/arm64/linux/linux_dummy_machdep.c +++ b/sys/arm64/linux/linux_dummy_machdep.c @@ -61,3 +61,11 @@ DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); DUMMY(semtimedop); +DUMMY(statx); +DUMMY(io_pgetevents); +DUMMY(kexec_file_load); +DUMMY(rseq); +DUMMY(pidfd_send_signal); +DUMMY(io_uring_setup); +DUMMY(io_uring_enter); +DUMMY(io_uring_register); From owner-dev-commits-src-main@freebsd.org Fri May 28 15:31: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 70F42655805; Fri, 28 May 2021 15:31: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 4Fs7vb2jCBz3j3F; Fri, 28 May 2021 15:31: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 445B119A24; Fri, 28 May 2021 15:31: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 14SFVdIr092585; Fri, 28 May 2021 15:31:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SFVd94092584; Fri, 28 May 2021 15:31:39 GMT (envelope-from git) Date: Fri, 28 May 2021 15:31:39 GMT Message-Id: <202105281531.14SFVd94092584@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 5434ebd256a0 - main - tests/libalias: Measure cleanup time separatly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5434ebd256a08e452dec376c1488abdf7ff02af8 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, 28 May 2021 15:31:39 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=5434ebd256a08e452dec376c1488abdf7ff02af8 commit 5434ebd256a08e452dec376c1488abdf7ff02af8 Author: Lutz Donnerhacke AuthorDate: 2021-05-28 15:29:10 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-28 15:29:10 +0000 tests/libalias: Measure cleanup time separatly After long test runs, a lot of ressouces can be allocated. Freeing them takes a considerable amount of time. --- tests/sys/netinet/libalias/perf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/sys/netinet/libalias/perf.c b/tests/sys/netinet/libalias/perf.c index 3c0b0d593f4c..f238846bdb16 100644 --- a/tests/sys/netinet/libalias/perf.c +++ b/tests/sys/netinet/libalias/perf.c @@ -66,7 +66,7 @@ usage(void) { int main(int argc, char ** argv) { struct libalias *la; - struct timeval timeout; + struct timeval timeout, now, start; struct ip *p; struct udphdr *u; struct { @@ -141,7 +141,6 @@ int main(int argc, char ** argv) printf("RND SECOND newNAT RANDOM ATTACK useNAT\n"); for (round = 0; ; round++) { int res, cnt; - struct timeval now, start; printf("%3d ", round+1); @@ -279,7 +278,6 @@ out: printf("\n\n"); free(batch); free(p); - LibAliasUninit(la); printf("Results\n"); printf(" Rounds : %9u\n", round); @@ -300,5 +298,11 @@ out: usenat.ok + usenat.fail + random.ok + random.fail + attack.ok + attack.fail); + + gettimeofday(&start, NULL); + printf("\n Cleanup : "); + LibAliasUninit(la); + gettimeofday(&now, NULL); + printf("%.2fs\n", timevaldiff(now, start)/1000000l); return (0); } From owner-dev-commits-src-main@freebsd.org Fri May 28 16:59: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 E644F656829; Fri, 28 May 2021 16:59: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 4Fs9s54z7cz3nPb; Fri, 28 May 2021 16:59: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 8F6E01ABA4; Fri, 28 May 2021 16:59: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 14SGxbrx009187; Fri, 28 May 2021 16:59:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SGxbjX009186; Fri, 28 May 2021 16:59:37 GMT (envelope-from git) Date: Fri, 28 May 2021 16:59:37 GMT Message-Id: <202105281659.14SGxbjX009186@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: 6bb5699d2b59 - main - libradius: Fix attribute length validation in rad_get_attr(3) 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: 6bb5699d2b59491097bc21ffa3c097cdd4853f89 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, 28 May 2021 16:59:38 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6bb5699d2b59491097bc21ffa3c097cdd4853f89 commit 6bb5699d2b59491097bc21ffa3c097cdd4853f89 Author: Mark Johnston AuthorDate: 2021-05-28 14:41:43 +0000 Commit: Mark Johnston CommitDate: 2021-05-28 16:58:29 +0000 libradius: Fix attribute length validation in rad_get_attr(3) The length of the attribute header needs to be excluded when comparing the attribute length against the length of the packet. Otherwise, validation may incorrectly fail when fetching the final attribute in a message. Fixes: 8d5c78130 ("libradius: Fix input validation bugs") Reported by: Peter Eriksson Tested by: Peter Eriksson MFC after: now Sponsored by: The FreeBSD Foundation --- lib/libradius/radlib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/libradius/radlib.c b/lib/libradius/radlib.c index 18aee8b53024..4d21887c4ee2 100644 --- a/lib/libradius/radlib.c +++ b/lib/libradius/radlib.c @@ -964,7 +964,12 @@ rad_get_attr(struct rad_handle *h, const void **value, size_t *lenp) } type = h->in[h->in_pos++]; len = h->in[h->in_pos++]; - if (len < 2 || h->in_pos + len > h->in_len) { + if (len < 2) { + generr(h, "Malformed attribute in response"); + return -1; + } + len -= 2; + if (h->in_pos + len > h->in_len) { generr(h, "Malformed attribute in response"); return -1; } From owner-dev-commits-src-main@freebsd.org Fri May 28 18: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 908F3657951; Fri, 28 May 2021 18: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 4FsCXy3d4yz4Ss7; Fri, 28 May 2021 18:15:46 +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 5A7D71BF16; Fri, 28 May 2021 18:15:46 +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 14SIFkpx050430; Fri, 28 May 2021 18: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 14SIFkVl050429; Fri, 28 May 2021 18:15:46 GMT (envelope-from git) Date: Fri, 28 May 2021 18:15:46 GMT Message-Id: <202105281815.14SIFkVl050429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 5e912f5fec02 - main - aic7xxx: Fix re-building firmware with -fno-common MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e912f5fec025766521f535d1237330ede7f18e2 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, 28 May 2021 18:15:46 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=5e912f5fec025766521f535d1237330ede7f18e2 commit 5e912f5fec025766521f535d1237330ede7f18e2 Author: Jessica Clarke AuthorDate: 2021-05-28 18:07:17 +0000 Commit: Jessica Clarke CommitDate: 2021-05-28 18:07:17 +0000 aic7xxx: Fix re-building firmware with -fno-common The generated C output for aicasm_scan.l defines yylineno already, so references to it from other files should use an extern declaration. The STAILQ_HEAD use in aicasm_symbol.h also provided an identifier, causing it to both define the struct type and define a variable of that struct type, causing any C file including the header to define the same variable. This variable is not used (and confusingly clashes with a field name just below) and was likely caused by confusion when switching between defining fields using similar type macros and defining the type itself. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30525 --- sys/dev/aic7xxx/aicasm/aicasm_gram.y | 2 +- sys/dev/aic7xxx/aicasm/aicasm_symbol.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/aic7xxx/aicasm/aicasm_gram.y b/sys/dev/aic7xxx/aicasm/aicasm_gram.y index c479c8fdf2db..d32793f4c12b 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_gram.y +++ b/sys/dev/aic7xxx/aicasm/aicasm_gram.y @@ -59,7 +59,7 @@ #include "aicasm_symbol.h" #include "aicasm_insformat.h" -int yylineno; +extern int yylineno; char *yyfilename; char stock_prefix[] = "aic_"; char *prefix = stock_prefix; diff --git a/sys/dev/aic7xxx/aicasm/aicasm_symbol.h b/sys/dev/aic7xxx/aicasm/aicasm_symbol.h index 616dfd28fdeb..a15fa12176d1 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_symbol.h +++ b/sys/dev/aic7xxx/aicasm/aicasm_symbol.h @@ -110,7 +110,7 @@ struct macro_arg { regex_t arg_regex; char *replacement_text; }; -STAILQ_HEAD(macro_arg_list, macro_arg) args; +STAILQ_HEAD(macro_arg_list, macro_arg); struct macro_info { struct macro_arg_list args; From owner-dev-commits-src-main@freebsd.org Fri May 28 18:39: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 C0C52657CA8; Fri, 28 May 2021 18:39: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 4FsD3m4sF2z4Vr3; Fri, 28 May 2021 18:39: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 905A11C317; Fri, 28 May 2021 18:39: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 14SId0HW088135; Fri, 28 May 2021 18:39:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SId0DF088133; Fri, 28 May 2021 18:39:00 GMT (envelope-from git) Date: Fri, 28 May 2021 18:39:00 GMT Message-Id: <202105281839.14SId0DF088133@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: c56de177d282 - main - x86: initialize initial FPU state earlier 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: c56de177d28295b4b07ad0b17e4faf4f11c9e4f2 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, 28 May 2021 18:39:00 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c56de177d28295b4b07ad0b17e4faf4f11c9e4f2 commit c56de177d28295b4b07ad0b17e4faf4f11c9e4f2 Author: Konstantin Belousov AuthorDate: 2021-05-27 16:26:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-28 18:38:32 +0000 x86: initialize initial FPU state earlier Make it under SI_SUB_CPU sysinit, instead of much later SI_SUB_DRIVERS. The SI_SUB_DRIVERS survived from times when FPU used real ISA attachment, now it is only pnp stub claiming id. PR: 255997 Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30512 --- sys/amd64/amd64/fpu.c | 2 +- sys/i386/i386/npx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index b9723266ea37..20e3dd34405d 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -495,7 +495,7 @@ fpuinitstate(void *arg __unused) intr_restore(saveintr); } /* EFIRT needs this to be initialized before we can enter our EFI environment */ -SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_FIRST, fpuinitstate, NULL); +SYSINIT(fpuinitstate, SI_SUB_CPU, SI_ORDER_ANY, fpuinitstate, NULL); /* * Free coprocessor (if we have it). diff --git a/sys/i386/i386/npx.c b/sys/i386/i386/npx.c index 34fd2e957169..4767d8896de9 100644 --- a/sys/i386/i386/npx.c +++ b/sys/i386/i386/npx.c @@ -551,7 +551,7 @@ npxinitstate(void *arg __unused) start_emulating(); intr_restore(saveintr); } -SYSINIT(npxinitstate, SI_SUB_DRIVERS, SI_ORDER_ANY, npxinitstate, NULL); +SYSINIT(npxinitstate, SI_SUB_CPU, SI_ORDER_ANY, npxinitstate, NULL); /* * Free coprocessor (if we have it). From owner-dev-commits-src-main@freebsd.org Fri May 28 20:30: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 954E46316A2; Fri, 28 May 2021 20:30: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 4FsGX93Zfrz4jKC; Fri, 28 May 2021 20:30: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 5F5631D92C; Fri, 28 May 2021 20:30: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 14SKUHo2086002; Fri, 28 May 2021 20:30:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SKUHq1085996; Fri, 28 May 2021 20:30:17 GMT (envelope-from git) Date: Fri, 28 May 2021 20:30:17 GMT Message-Id: <202105282030.14SKUHq1085996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Zhilin Subject: git: d513292e74a8 - main - [bhnd] remove unused sc variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mizhka X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d513292e74a868cd73a145970344f4d8a6bb9286 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, 28 May 2021 20:30:17 -0000 The branch main has been updated by mizhka: URL: https://cgit.FreeBSD.org/src/commit/?id=d513292e74a868cd73a145970344f4d8a6bb9286 commit d513292e74a868cd73a145970344f4d8a6bb9286 Author: Michael Zhilin AuthorDate: 2021-05-28 20:26:14 +0000 Commit: Michael Zhilin CommitDate: 2021-05-28 20:26:14 +0000 [bhnd] remove unused sc variable Cosmetic patch to remove unused sc variable. Tested on mips32 Reviewed by: bz, imp, landonf Sponsored by: Postgres Professional Differential revision: https://reviews.freebsd.org/D18948 --- sys/dev/bhnd/bhnd.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/dev/bhnd/bhnd.c b/sys/dev/bhnd/bhnd.c index 683fd662bcdc..1ec4cb1ce48d 100644 --- a/sys/dev/bhnd/bhnd.c +++ b/sys/dev/bhnd/bhnd.c @@ -634,14 +634,11 @@ bhnd_generic_request_clock(device_t dev, device_t child, bhnd_clock clock) int bhnd_generic_enable_clocks(device_t dev, device_t child, uint32_t clocks) { - struct bhnd_softc *sc; struct bhnd_core_clkctl *clkctl; uint32_t avail; uint32_t req; int error; - sc = device_get_softc(dev); - if (device_get_parent(child) != dev) return (EINVAL); @@ -650,8 +647,6 @@ bhnd_generic_enable_clocks(device_t dev, device_t child, uint32_t clocks) BHND_ASSERT_CLKCTL_AVAIL(clkctl); - sc = device_get_softc(dev); - avail = 0x0; req = 0x0; From owner-dev-commits-src-main@freebsd.org Fri May 28 20:31: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 E4E53631C94; Fri, 28 May 2021 20:31: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 4FsGYL69vtz4jH8; Fri, 28 May 2021 20:31: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 BD20A1D937; Fri, 28 May 2021 20:31: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 14SKVI3U092157; Fri, 28 May 2021 20:31:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SKVIiJ092156; Fri, 28 May 2021 20:31:18 GMT (envelope-from git) Date: Fri, 28 May 2021 20:31:18 GMT Message-Id: <202105282031.14SKVIiJ092156@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: e889a462d878 - main - usbhid(4): Fix NULL pointer dereference in usbd_xfer_max_len() 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: e889a462d878675551b227a382764c3879e6c2b3 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, 28 May 2021 20:31:19 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=e889a462d878675551b227a382764c3879e6c2b3 commit e889a462d878675551b227a382764c3879e6c2b3 Author: Vladimir Kondratyev AuthorDate: 2021-05-28 20:13:44 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-05-28 20:29:42 +0000 usbhid(4): Fix NULL pointer dereference in usbd_xfer_max_len() Which happens when USB transfer setup is failed. MFC after: 1 week PR: 254974 Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30485 --- sys/dev/usb/input/usbhid.c | 64 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/sys/dev/usb/input/usbhid.c b/sys/dev/usb/input/usbhid.c index 70b1f4ae99c2..4fb846840b8a 100644 --- a/sys/dev/usb/input/usbhid.c +++ b/sys/dev/usb/input/usbhid.c @@ -308,6 +308,22 @@ static const struct usb_config usbhid_config[USBHID_N_TRANSFER] = { }, }; +static inline usb_frlength_t +usbhid_xfer_max_len(struct usb_xfer *xfer) +{ + return (xfer == NULL ? 0 : usbd_xfer_max_len(xfer)); +} + +static inline int +usbhid_xfer_check_len(struct usbhid_softc* sc, int xfer_idx, hid_size_t len) +{ + if (sc->sc_xfer[xfer_idx] == NULL) + return (ENODEV); + if (len > usbd_xfer_max_len(sc->sc_xfer[xfer_idx])) + return (ENOBUFS); + return (0); +} + static void usbhid_intr_setup(device_t dev, hid_intr_t intr, void *context, struct hid_rdesc_info *rdesc) @@ -320,6 +336,7 @@ usbhid_intr_setup(device_t dev, hid_intr_t intr, void *context, sc->sc_intr_handler = intr; sc->sc_intr_ctx = context; bcopy(usbhid_config, sc->sc_config, sizeof(usbhid_config)); + bzero(sc->sc_xfer, sizeof(sc->sc_xfer)); /* Set buffer sizes to match HID report sizes */ sc->sc_config[USBHID_INTR_OUT_DT].bufsize = rdesc->osize; @@ -342,17 +359,15 @@ usbhid_intr_setup(device_t dev, hid_intr_t intr, void *context, sc->sc_xfer + n, sc->sc_config + n, 1, (void *)(sc->sc_xfer_ctx + n), &sc->sc_mtx); if (error) - break; + DPRINTF("xfer %d setup error=%s\n", n, + usbd_errstr(error)); } - if (error) - DPRINTF("error=%s\n", usbd_errstr(error)); - - rdesc->rdsize = usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_IN_DT]); - rdesc->grsize = usbd_xfer_max_len(sc->sc_xfer[USBHID_CTRL_DT]); + rdesc->rdsize = usbhid_xfer_max_len(sc->sc_xfer[USBHID_INTR_IN_DT]); + rdesc->grsize = usbhid_xfer_max_len(sc->sc_xfer[USBHID_CTRL_DT]); rdesc->srsize = rdesc->grsize; rdesc->wrsize = nowrite ? rdesc->srsize : - usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_OUT_DT]); + usbhid_xfer_max_len(sc->sc_xfer[USBHID_INTR_OUT_DT]); sc->sc_intr_buf = malloc(rdesc->rdsize, M_USBDEV, M_ZERO | M_WAITOK); } @@ -371,6 +386,9 @@ usbhid_intr_start(device_t dev) { struct usbhid_softc* sc = device_get_softc(dev); + if (sc->sc_xfer[USBHID_INTR_IN_DT] == NULL) + return (ENODEV); + mtx_lock(&sc->sc_mtx); sc->sc_xfer_ctx[USBHID_INTR_IN_DT] = (struct usbhid_xfer_ctx) { .req.intr.maxlen = @@ -493,8 +511,9 @@ usbhid_get_report(device_t dev, void *buf, hid_size_t maxlen, union usbhid_device_request req; int error; - if (maxlen > usbd_xfer_max_len(sc->sc_xfer[USBHID_CTRL_DT])) - return (ENOBUFS); + error = usbhid_xfer_check_len(sc, USBHID_CTRL_DT, maxlen); + if (error) + return (error); req.ctrl.bmRequestType = UT_READ_CLASS_INTERFACE; req.ctrl.bRequest = UR_GET_REPORT; @@ -516,9 +535,11 @@ usbhid_set_report(device_t dev, const void *buf, hid_size_t len, uint8_t type, { struct usbhid_softc* sc = device_get_softc(dev); union usbhid_device_request req; + int error; - if (len > usbd_xfer_max_len(sc->sc_xfer[USBHID_CTRL_DT])) - return (ENOBUFS); + error = usbhid_xfer_check_len(sc, USBHID_CTRL_DT, len); + if (error) + return (error); req.ctrl.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.ctrl.bRequest = UR_SET_REPORT; @@ -538,8 +559,9 @@ usbhid_read(device_t dev, void *buf, hid_size_t maxlen, hid_size_t *actlen) union usbhid_device_request req; int error; - if (maxlen > usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_IN_DT])) - return (ENOBUFS); + error = usbhid_xfer_check_len(sc, USBHID_INTR_IN_DT, maxlen); + if (error) + return (error); req.intr.maxlen = maxlen; error = usbhid_sync_xfer(sc, USBHID_INTR_IN_DT, &req, buf); @@ -554,9 +576,11 @@ usbhid_write(device_t dev, const void *buf, hid_size_t len) { struct usbhid_softc* sc = device_get_softc(dev); union usbhid_device_request req; + int error; - if (len > usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_OUT_DT])) - return (ENOBUFS); + error = usbhid_xfer_check_len(sc, USBHID_INTR_OUT_DT, len); + if (error) + return (error); req.intr.maxlen = len; return (usbhid_sync_xfer(sc, USBHID_INTR_OUT_DT, &req, @@ -568,6 +592,11 @@ usbhid_set_idle(device_t dev, uint16_t duration, uint8_t id) { struct usbhid_softc* sc = device_get_softc(dev); union usbhid_device_request req; + int error; + + error = usbhid_xfer_check_len(sc, USBHID_CTRL_DT, 0); + if (error) + return (error); /* Duration is measured in 4 milliseconds per unit. */ req.ctrl.bmRequestType = UT_WRITE_CLASS_INTERFACE; @@ -585,6 +614,11 @@ usbhid_set_protocol(device_t dev, uint16_t protocol) { struct usbhid_softc* sc = device_get_softc(dev); union usbhid_device_request req; + int error; + + error = usbhid_xfer_check_len(sc, USBHID_CTRL_DT, 0); + if (error) + return (error); req.ctrl.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.ctrl.bRequest = UR_SET_PROTOCOL; From owner-dev-commits-src-main@freebsd.org Fri May 28 20:31: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 65065631B23; Fri, 28 May 2021 20:31: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 4FsGYN2Ctfz4jSp; Fri, 28 May 2021 20:31: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 EF9181D8B1; Fri, 28 May 2021 20:31: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 14SKVJQp092178; Fri, 28 May 2021 20:31:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SKVJYv092177; Fri, 28 May 2021 20:31:19 GMT (envelope-from git) Date: Fri, 28 May 2021 20:31:19 GMT Message-Id: <202105282031.14SKVJYv092177@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: 9aa0e5af75d0 - main - usbhid(4): Add second set of USB transfers to work in polled mode. 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: 9aa0e5af75d033aa2dff763dd2886daaa7213612 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, 28 May 2021 20:31:20 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=9aa0e5af75d033aa2dff763dd2886daaa7213612 commit 9aa0e5af75d033aa2dff763dd2886daaa7213612 Author: Vladimir Kondratyev AuthorDate: 2021-05-28 20:25:42 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-05-28 20:29:42 +0000 usbhid(4): Add second set of USB transfers to work in polled mode. The second set of USB transfer is requested by hkbd(4) and should improve HID keyboard handling in kdb and panic contexts. MFC after: 1 week Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30486 --- sys/dev/hid/hid_if.m | 9 +++--- sys/dev/hid/hidbus.c | 3 ++ sys/dev/iicbus/iichid.c | 3 ++ sys/dev/usb/input/usbhid.c | 77 +++++++++++++++++++++++++++++++++++++--------- 4 files changed, 73 insertions(+), 19 deletions(-) diff --git a/sys/dev/hid/hid_if.m b/sys/dev/hid/hid_if.m index e33791ba24e8..896308fccd17 100644 --- a/sys/dev/hid/hid_if.m +++ b/sys/dev/hid/hid_if.m @@ -44,8 +44,8 @@ INTERFACE hid; # rdesc is pointer to structire containing requested maximal sizes of input, # output and feature reports. It is used by hardware transport drivers # to determine sizes of internal buffers. -# This function returns zero upon success. A non-zero return value indicates -# failure. +# This function can be subsequently called with intr parameter set to NULL +# to request intr_poll method support for transport driver. # METHOD void intr_setup { device_t dev; @@ -76,8 +76,9 @@ METHOD int intr_stop { }; # -# The following function gets called from the HID keyboard driver -# when the system has paniced. +# The following function gets called from the HID keyboard driver when +# the system has paniced. intr_setup method with NULL passed as intr parameter +# must be called once before to let transport driver to be prepared. # METHOD void intr_poll { device_t dev; diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c index be3564842988..3064f9999f2f 100644 --- a/sys/dev/hid/hidbus.c +++ b/sys/dev/hid/hidbus.c @@ -457,6 +457,9 @@ hidbus_write_ivar(device_t bus, device_t child, int which, uintptr_t value) break; case HIDBUS_IVAR_FLAGS: tlc->flags = value; + if ((value & HIDBUS_FLAG_CAN_POLL) != 0) + HID_INTR_SETUP( + device_get_parent(bus), NULL, NULL, NULL); break; case HIDBUS_IVAR_DRIVER_INFO: tlc->driver_info = value; diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index fe949f113984..7c51a697c4c7 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -782,6 +782,9 @@ iichid_intr_setup(device_t dev, hid_intr_t intr, void *context, { struct iichid_softc *sc; + if (intr == NULL) + return; + sc = device_get_softc(dev); /* * Do not rely on wMaxInputLength, as some devices may set it to diff --git a/sys/dev/usb/input/usbhid.c b/sys/dev/usb/input/usbhid.c index 4fb846840b8a..c6f2a1f24303 100644 --- a/sys/dev/usb/input/usbhid.c +++ b/sys/dev/usb/input/usbhid.c @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define USB_DEBUG_VAR usbhid_debug #include @@ -85,6 +86,8 @@ SYSCTL_INT(_hw_usb_usbhid, OID_AUTO, debug, CTLFLAG_RWTUN, &usbhid_debug, 0, "Debug level"); #endif +/* Second set of USB transfers for polling mode */ +#define POLL_XFER(xfer) ((xfer) + USBHID_N_TRANSFER) enum { USBHID_INTR_OUT_DT, USBHID_INTR_IN_DT, @@ -123,8 +126,9 @@ struct usbhid_softc { struct mtx sc_mtx; struct usb_config sc_config[USBHID_N_TRANSFER]; - struct usb_xfer *sc_xfer[USBHID_N_TRANSFER]; - struct usbhid_xfer_ctx sc_xfer_ctx[USBHID_N_TRANSFER]; + struct usb_xfer *sc_xfer[POLL_XFER(USBHID_N_TRANSFER)]; + struct usbhid_xfer_ctx sc_xfer_ctx[POLL_XFER(USBHID_N_TRANSFER)]; + bool sc_can_poll; struct usb_device *sc_udev; uint8_t sc_iface_no; @@ -317,6 +321,8 @@ usbhid_xfer_max_len(struct usb_xfer *xfer) static inline int usbhid_xfer_check_len(struct usbhid_softc* sc, int xfer_idx, hid_size_t len) { + if (USB_IN_POLLING_MODE_FUNC()) + xfer_idx = POLL_XFER(xfer_idx); if (sc->sc_xfer[xfer_idx] == NULL) return (ENODEV); if (len > usbd_xfer_max_len(sc->sc_xfer[xfer_idx])) @@ -333,6 +339,39 @@ usbhid_intr_setup(device_t dev, hid_intr_t intr, void *context, bool nowrite; int error; + nowrite = hid_test_quirk(&sc->sc_hw, HQ_NOWRITE); + + /* + * Setup the USB transfers one by one, so they are memory independent + * which allows for handling panics triggered by the HID drivers + * itself, typically by hkbd via CTRL+ALT+ESC sequences. Or if the HID + * keyboard driver was processing a key at the moment of panic. + */ + if (intr == NULL) { + if (sc->sc_can_poll) + return; + for (n = 0; n != USBHID_N_TRANSFER; n++) { + if (nowrite && n == USBHID_INTR_OUT_DT) + continue; + error = usbd_transfer_setup(sc->sc_udev, + &sc->sc_iface_index, sc->sc_xfer + POLL_XFER(n), + sc->sc_config + n, 1, + (void *)(sc->sc_xfer_ctx + POLL_XFER(n)), + &sc->sc_mtx); + if (error) + DPRINTF("xfer %d setup error=%s\n", n, + usbd_errstr(error)); + } + mtx_lock(&sc->sc_mtx); + if (sc->sc_xfer[USBHID_INTR_IN_DT] != NULL && + sc->sc_xfer[USBHID_INTR_IN_DT]->flags_int.started) + usbd_transfer_start( + sc->sc_xfer[POLL_XFER(USBHID_INTR_IN_DT)]); + mtx_unlock(&sc->sc_mtx); + sc->sc_can_poll = true; + return; + } + sc->sc_intr_handler = intr; sc->sc_intr_ctx = context; bcopy(usbhid_config, sc->sc_config, sizeof(usbhid_config)); @@ -344,14 +383,6 @@ usbhid_intr_setup(device_t dev, hid_intr_t intr, void *context, sc->sc_config[USBHID_CTRL_DT].bufsize = MAX(rdesc->isize, MAX(rdesc->osize, rdesc->fsize)); - nowrite = hid_test_quirk(&sc->sc_hw, HQ_NOWRITE); - - /* - * Setup the USB transfers one by one, so they are memory independent - * which allows for handling panics triggered by the HID drivers - * itself, typically by hkbd via CTRL+ALT+ESC sequences. Or if the HID - * keyboard driver was processing a key at the moment of panic. - */ for (n = 0; n != USBHID_N_TRANSFER; n++) { if (nowrite && n == USBHID_INTR_OUT_DT) continue; @@ -378,6 +409,10 @@ usbhid_intr_unsetup(device_t dev) struct usbhid_softc* sc = device_get_softc(dev); usbd_transfer_unsetup(sc->sc_xfer, USBHID_N_TRANSFER); + if (sc->sc_can_poll) + usbd_transfer_unsetup( + sc->sc_xfer, POLL_XFER(USBHID_N_TRANSFER)); + sc->sc_can_poll = false; free(sc->sc_intr_buf, M_USBDEV); } @@ -397,7 +432,16 @@ usbhid_intr_start(device_t dev) .cb_ctx = sc, .buf = sc->sc_intr_buf, }; + sc->sc_xfer_ctx[POLL_XFER(USBHID_INTR_IN_DT)] = (struct usbhid_xfer_ctx) { + .req.intr.maxlen = + usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_IN_DT]), + .cb = usbhid_intr_handler_cb, + .cb_ctx = sc, + .buf = sc->sc_intr_buf, + }; usbd_transfer_start(sc->sc_xfer[USBHID_INTR_IN_DT]); + if (sc->sc_can_poll) + usbd_transfer_start(sc->sc_xfer[POLL_XFER(USBHID_INTR_IN_DT)]); mtx_unlock(&sc->sc_mtx); return (0); @@ -410,6 +454,8 @@ usbhid_intr_stop(device_t dev) usbd_transfer_drain(sc->sc_xfer[USBHID_INTR_IN_DT]); usbd_transfer_drain(sc->sc_xfer[USBHID_INTR_OUT_DT]); + if (sc->sc_can_poll) + usbd_transfer_drain(sc->sc_xfer[POLL_XFER(USBHID_INTR_IN_DT)]); return (0); } @@ -419,7 +465,9 @@ usbhid_intr_poll(device_t dev) { struct usbhid_softc* sc = device_get_softc(dev); + MPASS(sc->sc_can_poll); usbd_transfer_poll(sc->sc_xfer + USBHID_INTR_IN_DT, 1); + usbd_transfer_poll(sc->sc_xfer + POLL_XFER(USBHID_INTR_IN_DT), 1); } /* @@ -430,12 +478,13 @@ usbhid_sync_xfer(struct usbhid_softc* sc, int xfer_idx, union usbhid_device_request *req, void *buf) { int error, timeout; - struct usbhid_xfer_ctx *xfer_ctx, save; + struct usbhid_xfer_ctx *xfer_ctx; xfer_ctx = sc->sc_xfer_ctx + xfer_idx; if (USB_IN_POLLING_MODE_FUNC()) { - save = *xfer_ctx; + xfer_ctx = POLL_XFER(xfer_ctx); + xfer_idx = POLL_XFER(xfer_idx); } else { mtx_lock(&sc->sc_mtx); ++xfer_ctx->waiters; @@ -473,9 +522,7 @@ usbhid_sync_xfer(struct usbhid_softc* sc, int xfer_idx, if (error == 0) *req = xfer_ctx->req; - if (USB_IN_POLLING_MODE_FUNC()) { - *xfer_ctx = save; - } else { + if (!USB_IN_POLLING_MODE_FUNC()) { xfer_ctx->influx = false; if (xfer_ctx->waiters != 0) wakeup_one(&xfer_ctx->waiters); From owner-dev-commits-src-main@freebsd.org Fri May 28 20:36:09 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 030E96314D0; Fri, 28 May 2021 20:36:09 +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 4FsGfw628Tz4jpD; Fri, 28 May 2021 20:36: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 B71261DAAC; Fri, 28 May 2021 20:36: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 14SKa8GE092733; Fri, 28 May 2021 20:36:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SKa8fi092732; Fri, 28 May 2021 20:36:08 GMT (envelope-from git) Date: Fri, 28 May 2021 20:36:08 GMT Message-Id: <202105282036.14SKa8fi092732@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Zhilin Subject: git: 91abbc4993a5 - main - [mips/broadcom] set sysctl "hw.model" by SoC ChipCommon ID MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mizhka X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91abbc4993a5964badd21bc691ae273a1a2d9c20 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, 28 May 2021 20:36:09 -0000 The branch main has been updated by mizhka: URL: https://cgit.FreeBSD.org/src/commit/?id=91abbc4993a5964badd21bc691ae273a1a2d9c20 commit 91abbc4993a5964badd21bc691ae273a1a2d9c20 Author: Michael Zhilin AuthorDate: 2021-05-28 20:32:30 +0000 Commit: Michael Zhilin CommitDate: 2021-05-28 20:35:37 +0000 [mips/broadcom] set sysctl "hw.model" by SoC ChipCommon ID Small patch to set "hw.model" by SoC ChipCommon ID. On BCM4718 it will be BCM4716, because 4716 is core for 4716,4717 & 4718. Tested on Netgear WNR3500L (BCM4718) and Asus RT-N53 (BCM5357). Reviewed by: landonf, yamori813@yahoo.co.jp Sponsored by: Postgres Professional Differential revision: https://reviews.freebsd.org/D12737 --- sys/mips/broadcom/bcm_machdep.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/mips/broadcom/bcm_machdep.c b/sys/mips/broadcom/bcm_machdep.c index 20ae22f2e9b0..581fffdd899d 100644 --- a/sys/mips/broadcom/bcm_machdep.c +++ b/sys/mips/broadcom/bcm_machdep.c @@ -116,6 +116,9 @@ static int bcm_erom_probe_and_attach(bhnd_erom_class_t **erom_cls, extern int *edata; extern int *end; +/* from sys/mips/mips/machdep.c */ +extern char cpu_model[]; + static struct bcm_platform bcm_platform_data; static bool bcm_platform_data_avail = false; @@ -399,6 +402,12 @@ bcm_init_platform_data(struct bcm_platform *bp) return (error); } + /* All hex formatted IDs are within the range of 0x4000-0x9C3F (40000-1) */ + if (bp->cid.chip_id >= 0x4000 && bp->cid.chip_id <= 0x9C3F) + snprintf(cpu_model, 10, "BCM%hX", bp->cid.chip_id); + else + snprintf(cpu_model, 10, "BCM%hu", bp->cid.chip_id); + /* Fetch chipc capability flags */ bp->cc_caps = BCM_SOC_READ_4(bp->cc_addr, CHIPC_CAPABILITIES); bp->cc_caps_ext = 0x0; From owner-dev-commits-src-main@freebsd.org Fri May 28 20:43: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 CF38463218B for ; Fri, 28 May 2021 20:43:54 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 4FsGqt5P8nz4k20 for ; Fri, 28 May 2021 20:43:54 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f52.google.com with SMTP id f17so1336330wmf.2 for ; Fri, 28 May 2021 13:43:54 -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=seUHlrSCCZKA6i9opWWhzw2fhckWuAtFk8XGeOz6700=; b=RORPQ9fvPB9b0m8IJ8Zsc1V5qoHqVrC/KzNsF9sW80ErD7EpGF7fhOG3Ty/FtGL58+ 30+jzoTq9Tg6L1dV8AEaiQE+g9U5I2F5/evutICXRfyuTLZKs/QWViF4d5zviZvE6XVO yfHMZ5XyZ+ZBGC7+57KKUTytFfmdMh3wW+H+3UqwjeF2EJIDgW8c1/n/wrF/lTHmCEiI WAPgt3aasnyYQBqHvM88FY+bBj+I0Juf/bGwu8M/BGMn60DckCjPx/JHTHvihWemjhxO TrbsgLcNd8UUqHbDQOLj3a8cNAh8Ypb17kr6xYv2RU7ugfMTnh2o8vSYobTOXCUfB21i 2kGw== X-Gm-Message-State: AOAM533DpwGbY635R2ZfoZs6HEKpK8ElFh2ufg6V1QMYwC6st09P3I9p QiHlLrv+64o55U0ADUK6/JRD2Q== X-Google-Smtp-Source: ABdhPJxZLhZwChdtNsiXDoGeoufWq1csaIR//jg416MybbiNa29RZ20iD97f+HQfMnPWZxlZJY5wXg== X-Received: by 2002:a05:600c:154e:: with SMTP id f14mr15422301wmg.36.1622234632881; Fri, 28 May 2021 13:43:52 -0700 (PDT) Received: from [192.168.150.48] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id s83sm7470323wms.16.2021.05.28.13.43.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 May 2021 13:43:52 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 91abbc4993a5 - main - [mips/broadcom] set sysctl "hw.model" by SoC ChipCommon ID From: Jessica Clarke In-Reply-To: <202105282036.14SKa8fi092732@gitrepo.freebsd.org> Date: Fri, 28 May 2021 21:43:51 +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: References: <202105282036.14SKa8fi092732@gitrepo.freebsd.org> To: Michael Zhilin X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FsGqt5P8nz4k20 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: Fri, 28 May 2021 20:43:54 -0000 On 28 May 2021, at 21:36, Michael Zhilin wrote: >=20 > The branch main has been updated by mizhka: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D91abbc4993a5964badd21bc691ae273a= 1a2d9c20 >=20 > commit 91abbc4993a5964badd21bc691ae273a1a2d9c20 > Author: Michael Zhilin > AuthorDate: 2021-05-28 20:32:30 +0000 > Commit: Michael Zhilin > CommitDate: 2021-05-28 20:35:37 +0000 >=20 > [mips/broadcom] set sysctl "hw.model" by SoC ChipCommon ID >=20 > Small patch to set "hw.model" by SoC ChipCommon ID. On BCM4718 it = will be BCM4716, because 4716 is core for 4716,4717 & 4718. >=20 > Tested on Netgear WNR3500L (BCM4718) and Asus RT-N53 (BCM5357). >=20 > Reviewed by: landonf, yamori813@yahoo.co.jp > Sponsored by: Postgres Professional > Differential revision: https://reviews.freebsd.org/D12737 > --- > sys/mips/broadcom/bcm_machdep.c | 9 +++++++++ > 1 file changed, 9 insertions(+) >=20 > diff --git a/sys/mips/broadcom/bcm_machdep.c = b/sys/mips/broadcom/bcm_machdep.c > index 20ae22f2e9b0..581fffdd899d 100644 > --- a/sys/mips/broadcom/bcm_machdep.c > +++ b/sys/mips/broadcom/bcm_machdep.c > @@ -116,6 +116,9 @@ static int = bcm_erom_probe_and_attach(bhnd_erom_class_t **erom_cls, > extern int *edata; > extern int *end; >=20 > +/* from sys/mips/mips/machdep.c */ > +extern char cpu_model[]; This should already be declared by machine/md_var.h. Jess From owner-dev-commits-src-main@freebsd.org Fri May 28 21:35: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 70AE36327E2; Fri, 28 May 2021 21:35:28 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (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 4FsHzM2pq1z4mdW; Fri, 28 May 2021 21:35:26 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: by mail-ot1-x32f.google.com with SMTP id v19-20020a0568301413b0290304f00e3d88so4819933otp.4; Fri, 28 May 2021 14:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9I5nuHr58RZL99yOwhMBQgvMwPXwLpnyCxNcare0fuY=; b=sTRCXgb2Bjp6CLub5E4kjDPv45THv/DsvtsK2kY/7bu8SbsDMlLxxKIgd4gg0zGTPp uA2P4vxfKDAK9GMLI3C8yu8a/AA+YE2JbQOg8BB+EY/Dm7E5aIV5vvQsNJagZRr2aZB4 g4/r3Huj0Pp4nP4ljkgjx0bUm7h+jSR/kk6dt+yF+b/AeV0cPjU1iAZPR7w6VIjhKmdV kMXPRVTYf4BN5A0SfakcJM3e709x5CuTxtDzMibufrMbYszb6ttdDOV/D4Ic6ap+yzsw TQCDs2PWr52qdD+Hs3ue8n/gTwsE0nZM5K6B9WPTbCJ4HSF/1+j9J/CssjTNymlbpGqp DLMQ== 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=9I5nuHr58RZL99yOwhMBQgvMwPXwLpnyCxNcare0fuY=; b=ZJ9iSU6K7hIK5TZnldjlmzboH7mUoQjrkAe8oH/S+d6vmbz/7hUau7+ImV3aICX75r ecbJwqyBNIv5jmmLYZbK74Ht2cPdTkTXKJQfS6IiTZjAVthSz71q7XHol5EPPnYRp9Wi GZlaofrOd1uKNLAD3vUqw5b+wbnb0AZfVnPBCY5F+O3wWSmRZPKFmovM274H7GJPFQK8 XRMRfpNxuTzvlxIA+Ay4LS3LegRmEjpaSjAIXTiRhQPbrCPAE1EQD0WOsOheTq+T/EPY bpZG+WA8gUF2+uRIUXhnpi5pAYp4UsJzNr38VLiMh2x/ntYfd3zpycoa49832Yg7Ixtz 5mQw== X-Gm-Message-State: AOAM531mxXitgZrSFA9Zb067Tp8GBIYkjNezzr3/Soc+bcyKspCNh1Qx F5xnf96FLN1dcMtk90ONXwjaYgYvG/chA5GuGAq4r1Pn7mOuB+YO X-Google-Smtp-Source: ABdhPJzfHMRi7Y5LbUD8oyQdyWmSW8yMm9UlTe47S5YjZLiPW98EwkXCs10f9TzB/A7KWghNY7Wm6/ocdH590HtMTjA= X-Received: by 2002:a05:6830:1556:: with SMTP id l22mr8680042otp.34.1622237725208; Fri, 28 May 2021 14:35:25 -0700 (PDT) MIME-Version: 1.0 References: <202105212038.14LKcb3U062829@gitrepo.freebsd.org> <4faa0667-ca1b-923b-fbae-c97b0b863589@FreeBSD.org> In-Reply-To: From: Rob Wing Date: Fri, 28 May 2021 13:35:55 -0800 Message-ID: Subject: Re: git: f190f9193bc1 - main - Fix fsck_ufs segfaults with gjournal (SU+J) To: John Baldwin Cc: Kirk McKusick , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4FsHzM2pq1z4mdW X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=sTRCXgb2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of robfx907@gmail.com designates 2607:f8b0:4864:20::32f as permitted sender) smtp.mailfrom=robfx907@gmail.com X-Spamd-Result: default: False [-2.46 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::32f:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; NEURAL_SPAM_SHORT(0.54)[0.544]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::32f:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::32f:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] Content-Type: text/plain; charset="UTF-8" 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: Fri, 28 May 2021 21:35:28 -0000 I put a revision up https://reviews.freebsd.org/D30537 if anyone wants to have a look. As John already pointed out, readsb() is what sets fs_bsize. I considered placing the setup() routine after sblock_init()..but decided to add an additional bufinit() call just before gjournal_check as it is the least intrusive fix I can come up with at the moment, while still fixing the original bug and (hopefully) not introducing others. -Rob On Fri, May 28, 2021 at 1:21 AM Rob Wing wrote: > Hmm, I provided a fix for ( > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D245907) and it appear= s > to have created a spiderweb of breakage - as noted by jhb and chs (in com= mit > 84768d114951e88288024f09d4beae0956c3cf21). > > I=E2=80=99ll have some time to dig into this in the next day or two. > > In the meantime, the best idea I have for an immediate fix is to revert > the aforementioned commit and commit f190f9193bc10a8193c87e0a02fa91400e4e= b159, > then apply/test the patch found at: > https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D225092&action=3Ddif= f > > If there=E2=80=99s any input or suggestions, let me know. > > Thanks, > Rob > > > On Thursday, May 27, 2021, John Baldwin wrote: > >> On 5/21/21 1:38 PM, Kirk McKusick wrote: >> >>> The branch main has been updated by mckusick: >>> >>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=3Df190f9193bc10a8193c87e0a02fa9= 1400e4eb159 >>> >>> commit f190f9193bc10a8193c87e0a02fa91400e4eb159 >>> Author: Kirk McKusick >>> AuthorDate: 2021-05-21 20:41:40 +0000 >>> Commit: Kirk McKusick >>> CommitDate: 2021-05-21 20:42:37 +0000 >>> >>> Fix fsck_ufs segfaults with gjournal (SU+J) >>> The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.= c) >>> while attempting to traverse the buffer cache to flush dirty >>> buffers. >>> The tail queue used for the buffer cache was not initialized befor= e >>> dropping into gjournal_check(). Move the buffer initialization >>> earlier >>> so that it has been done before calling gjournal_check(). >>> >> >> This appears to have broken fsck in at least some use cases. On my rpi >> I get this error trying to boot: >> >> Setting hostid: 0x4ce29432. >> Starting file system checks: >> fsck_ufs: Initial malloc(-1515870811) failed >> fsck_ufs: Initial malloc(-1515870811) failed >> Automatic file system check failed; help! >> ERROR: ABORTING BOOT (sending SIGTERM to parent)! >> >> The amount being passed to malloc() is malloc junk: >> >> (gdb) p/x -1515870811 >> $1 =3D 0xa5a5a5a5 >> >> The i386 CI jobs in jenkins have been failing with the same error recent= ly >> as well. >> >> I guess this means sblock isn't fully initialized by sblock_init()? At >> least >> not enough to set fs_bsize? Hmm, perhaps readsb() is what sets fs_bsize= ? >> >> -- >> John Baldwin >> > From owner-dev-commits-src-main@freebsd.org Fri May 28 22:18: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 4C66A633711; Fri, 28 May 2021 22:18: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 4FsJxZ1hk9z4qsc; Fri, 28 May 2021 22:18: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 224C71F20C; Fri, 28 May 2021 22:18: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 14SMIwgJ080943; Fri, 28 May 2021 22:18:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SMIwtO080942; Fri, 28 May 2021 22:18:58 GMT (envelope-from git) Date: Fri, 28 May 2021 22:18:58 GMT Message-Id: <202105282218.14SMIwtO080942@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: 7ad70d22c667 - main - libcrypto: Add symbol versions for symbols added since 1.1.1d. 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: 7ad70d22c667173586c04fc13dd315995d78fbbf 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, 28 May 2021 22:18:58 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7ad70d22c667173586c04fc13dd315995d78fbbf commit 7ad70d22c667173586c04fc13dd315995d78fbbf Author: John Baldwin AuthorDate: 2021-05-28 22:18:15 +0000 Commit: John Baldwin CommitDate: 2021-05-28 22:18:15 +0000 libcrypto: Add symbol versions for symbols added since 1.1.1d. While here, trim a spurious local: I missed when added SSL_sendfile. PR: 255277 Reported by: yuri Reviewed by: jkim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30483 --- secure/lib/libcrypto/Version.map | 17 ++++++++++++++++- secure/lib/libssl/Version.map | 1 - 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/secure/lib/libcrypto/Version.map b/secure/lib/libcrypto/Version.map index 33432019a023..bed7623b9c47 100644 --- a/secure/lib/libcrypto/Version.map +++ b/secure/lib/libcrypto/Version.map @@ -4450,7 +4450,22 @@ OPENSSL_1_1_1d { global: X509_get0_authority_issuer; X509_get0_authority_serial; - local: *; } OPENSSL_1_1_1c; +OPENSSL_1_1_1e { + global: + EVP_PKEY_meth_get_digestsign; + EVP_PKEY_meth_get_digestverify; + EVP_PKEY_meth_set_digestsign; + EVP_PKEY_meth_set_digestverify; + RSA_get0_pss_params; +} OPENSSL_1_1_1d; +OPENSSL_1_1_1h { + global: + EC_KEY_decoded_from_explicit_params; + X509_ALGOR_copy; + X509_REQ_set0_signature; + X509_REQ_set1_signature_algo; + local: *; +} OPENSSL_1_1_1e; diff --git a/secure/lib/libssl/Version.map b/secure/lib/libssl/Version.map index 8c5eba6795ec..3e4e00950def 100644 --- a/secure/lib/libssl/Version.map +++ b/secure/lib/libssl/Version.map @@ -512,7 +512,6 @@ OPENSSL_1_1_1 { OPENSSL_1_1_1a { global: SSL_get_signature_type_nid; - local: *; } OPENSSL_1_1_1; OPENSSL_1_1_1e { From owner-dev-commits-src-main@freebsd.org Fri May 28 22:42: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 5AAE5633F05; Fri, 28 May 2021 22:42: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 4FsKSz21PCz4sdL; Fri, 28 May 2021 22:42: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 2C20F1F890; Fri, 28 May 2021 22:42: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 14SMghjG034570; Fri, 28 May 2021 22:42:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SMghWd034569; Fri, 28 May 2021 22:42:43 GMT (envelope-from git) Date: Fri, 28 May 2021 22:42:43 GMT Message-Id: <202105282242.14SMghWd034569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9fac68fc3853 - main - Newly added features and bug fixes in latest Microchip SmartPQI driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9fac68fc3853b696c8479bb3a8181d62cb9f59c9 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, 28 May 2021 22:42:43 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9fac68fc3853b696c8479bb3a8181d62cb9f59c9 commit 9fac68fc3853b696c8479bb3a8181d62cb9f59c9 Author: PAPANI SRIKANTH AuthorDate: 2021-05-28 06:17:56 +0000 Commit: Warner Losh CommitDate: 2021-05-28 22:40:23 +0000 Newly added features and bug fixes in latest Microchip SmartPQI driver It includes: 1)Newly added TMF feature. 2)Added newly Huawei & Inspur PCI ID's 3)Fixed smartpqi driver hangs in Z-Pool while running on FreeBSD12.1 4)Fixed flooding dmesg in kernel while the controller is offline during in ioctls. 5)Avoided unnecessary host memory allocation for rcb sg buffers. 6)Fixed race conditions while accessing internal rcb structure. 7)Fixed where Logical volumes exposing two different names to the OS it's due to the system memory is overwritten with DMA stale data. 8)Fixed dynamically unloading a smartpqi driver. 9)Added device_shutdown callback instead of deprecated shutdown_final kernel event in smartpqi driver. 10)Fixed where Os is crashed during physical drive hot removal during heavy IO. 11)Fixed OS crash during controller lockup/offline during heavy IO. 12)Fixed coverity issues in smartpqi driver 13)Fixed system crash while creating and deleting logical volume in a continuous loop. 14)Fixed where the volume size is not exposing to OS when it expands. 15)Added HC3 pci id's. Reviewed by: Scott Benesh (microsemi), Murthy Bhat (microsemi), imp Differential Revision: https://reviews.freebsd.org/D30182 Sponsored by: Netflix --- sys/dev/smartpqi/smartpqi_cam.c | 586 ++++++++++++++++++----------- sys/dev/smartpqi/smartpqi_cmd.c | 11 +- sys/dev/smartpqi/smartpqi_defines.h | 459 +++++++++++++++------- sys/dev/smartpqi/smartpqi_discovery.c | 668 +++++++++++++++++++++------------ sys/dev/smartpqi/smartpqi_event.c | 94 ++--- sys/dev/smartpqi/smartpqi_helper.c | 289 +++++++++++--- sys/dev/smartpqi/smartpqi_includes.h | 6 +- sys/dev/smartpqi/smartpqi_init.c | 455 ++++++++++++++++------ sys/dev/smartpqi/smartpqi_intr.c | 151 ++++---- sys/dev/smartpqi/smartpqi_ioctl.c | 122 +++--- sys/dev/smartpqi/smartpqi_ioctl.h | 25 +- sys/dev/smartpqi/smartpqi_main.c | 247 +++++++----- sys/dev/smartpqi/smartpqi_mem.c | 74 +++- sys/dev/smartpqi/smartpqi_misc.c | 77 ++-- sys/dev/smartpqi/smartpqi_prototypes.h | 65 +++- sys/dev/smartpqi/smartpqi_queue.c | 236 +++++++----- sys/dev/smartpqi/smartpqi_request.c | 461 ++++++++++++++++++----- sys/dev/smartpqi/smartpqi_response.c | 171 +++++++-- sys/dev/smartpqi/smartpqi_sis.c | 93 +++-- sys/dev/smartpqi/smartpqi_structures.h | 597 +++++++++++++++++++---------- sys/dev/smartpqi/smartpqi_tag.c | 103 ++--- 21 files changed, 3392 insertions(+), 1598 deletions(-) diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c index c81b5a049da6..3d39e1ffbdd4 100644 --- a/sys/dev/smartpqi/smartpqi_cam.c +++ b/sys/dev/smartpqi/smartpqi_cam.c @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2018 Microsemi Corporation. - * All rights reserved. + * Copyright 2016-2021 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,11 +33,15 @@ /* * Set cam sim properties of the smartpqi adapter. */ -static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) +static void +update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) { pqisrc_softstate_t *softs = (struct pqisrc_softstate *) cam_sim_softc(sim); + + device_t dev = softs->os_specific.pqi_dev; + DBG_FUNC("IN\n"); cpi->version_num = 1; @@ -50,9 +53,9 @@ static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) cpi->max_target = 1088; cpi->maxio = (softs->pqi_cap.max_sg_elem - 1) * PAGE_SIZE; cpi->initiator_id = 255; - strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); - strncpy(cpi->hba_vid, "Microsemi", HBA_IDLEN); - strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); + strlcpy(cpi->hba_vid, "Microsemi", HBA_IDLEN); + strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); cpi->bus_id = cam_sim_bus(sim); cpi->base_transfer_speed = 1200000; /* Base bus speed in KB/sec */ @@ -61,6 +64,11 @@ static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) cpi->transport = XPORT_SPI; cpi->transport_version = 2; cpi->ccb_h.status = CAM_REQ_CMP; + cpi->hba_vendor = pci_get_vendor(dev); + cpi->hba_device = pci_get_device(dev); + cpi->hba_subvendor = pci_get_subvendor(dev); + cpi->hba_subdevice = pci_get_subdevice(dev); + DBG_FUNC("OUT\n"); } @@ -68,7 +76,8 @@ static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) /* * Get transport settings of the smartpqi adapter */ -static void get_transport_settings(struct pqisrc_softstate *softs, +static void +get_transport_settings(struct pqisrc_softstate *softs, struct ccb_trans_settings *cts) { struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; @@ -76,7 +85,7 @@ static void get_transport_settings(struct pqisrc_softstate *softs, struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi; DBG_FUNC("IN\n"); - + cts->protocol = PROTO_SCSI; cts->protocol_version = SCSI_REV_SPC4; cts->transport = XPORT_SPI; @@ -94,8 +103,10 @@ static void get_transport_settings(struct pqisrc_softstate *softs, /* * Add the target to CAM layer and rescan, when a new device is found */ -void os_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) { - union ccb *ccb; +void +os_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) +{ + union ccb *ccb; DBG_FUNC("IN\n"); @@ -121,12 +132,13 @@ void os_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) { /* * Remove the device from CAM layer when deleted or hot removed */ -void os_remove_device(pqisrc_softstate_t *softs, - pqi_scsi_dev_t *device) { +void +os_remove_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) +{ struct cam_path *tmppath; DBG_FUNC("IN\n"); - + if(softs->os_specific.sim_registered) { if (xpt_create_path(&tmppath, NULL, cam_sim_path(softs->os_specific.sim), @@ -136,6 +148,7 @@ void os_remove_device(pqisrc_softstate_t *softs, } xpt_async(AC_LOST_DEVICE, tmppath, NULL); xpt_free_path(tmppath); + softs->device_list[device->target][device->lun] = NULL; pqisrc_free_device(softs, device); } @@ -146,7 +159,8 @@ void os_remove_device(pqisrc_softstate_t *softs, /* * Function to release the frozen simq */ -static void pqi_release_camq( rcb_t *rcb ) +static void +pqi_release_camq(rcb_t *rcb) { pqisrc_softstate_t *softs; struct ccb_scsiio *csio; @@ -167,18 +181,12 @@ static void pqi_release_camq( rcb_t *rcb ) DBG_FUNC("OUT\n"); } -/* - * Function to dma-unmap the completed request - */ -static void pqi_unmap_request(void *arg) +static void +pqi_synch_request(rcb_t *rcb) { - pqisrc_softstate_t *softs; - rcb_t *rcb; - - DBG_IO("IN rcb = %p\n", arg); + pqisrc_softstate_t *softs = rcb->softs; - rcb = (rcb_t *)arg; - softs = rcb->softs; + DBG_IO("IN rcb = %p\n", rcb); if (!(rcb->cm_flags & PQI_CMD_MAPPED)) return; @@ -199,9 +207,21 @@ static void pqi_unmap_request(void *arg) if(rcb->sgt && rcb->nseg) os_mem_free(rcb->softs, (void*)rcb->sgt, - rcb->nseg*sizeof(sgt_t)); + rcb->nseg*sizeof(sgt_t)); - pqisrc_put_tag(&softs->taglist, rcb->tag); + DBG_IO("OUT\n"); +} + +/* + * Function to dma-unmap the completed request + */ +static inline void +pqi_unmap_request(rcb_t *rcb) +{ + DBG_IO("IN rcb = %p\n", rcb); + + pqi_synch_request(rcb); + pqisrc_put_tag(&rcb->softs->taglist, rcb->tag); DBG_IO("OUT\n"); } @@ -218,61 +238,103 @@ smartpqi_fix_ld_inquiry(pqisrc_softstate_t *softs, struct ccb_scsiio *csio) DBG_FUNC("IN\n"); + if (pqisrc_ctrl_offline(softs)) + return; + cdb = (csio->ccb_h.flags & CAM_CDB_POINTER) ? (uint8_t *)csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes; - if(cdb[0] == INQUIRY && + if(cdb[0] == INQUIRY && (cdb[1] & SI_EVPD) == 0 && (csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN && csio->dxfer_len >= SHORT_INQUIRY_LENGTH) { + inq = (struct scsi_inquiry_data *)csio->data_ptr; device = softs->device_list[csio->ccb_h.target_id][csio->ccb_h.target_lun]; /* Let the disks be probed and dealt with via CAM. Only for LD let it fall through and inquiry be tweaked */ - if( !device || !pqisrc_is_logical_device(device) || - (device->devtype != DISK_DEVICE) || + if (!device || !pqisrc_is_logical_device(device) || + (device->devtype != DISK_DEVICE) || pqisrc_is_external_raid_device(device)) { return; } - strncpy(inq->vendor, "MSCC", - SID_VENDOR_SIZE); - strncpy(inq->product, - pqisrc_raidlevel_to_string(device->raid_level), - SID_PRODUCT_SIZE); + strncpy(inq->vendor, device->vendor, + SID_VENDOR_SIZE); + strncpy(inq->product, + pqisrc_raidlevel_to_string(device->raid_level), + SID_PRODUCT_SIZE); strncpy(inq->revision, device->volume_offline?"OFF":"OK", - SID_REVISION_SIZE); + SID_REVISION_SIZE); } DBG_FUNC("OUT\n"); } +static void +pqi_complete_scsi_io(struct ccb_scsiio *csio, rcb_t *rcb) +{ + uint32_t release_tag; + pqisrc_softstate_t *softs = rcb->softs; + + DBG_IO("IN scsi io = %p\n", csio); + + pqi_synch_request(rcb); + smartpqi_fix_ld_inquiry(rcb->softs, csio); + pqi_release_camq(rcb); + release_tag = rcb->tag; + os_reset_rcb(rcb); + pqisrc_put_tag(&softs->taglist, release_tag); + xpt_done((union ccb *)csio); + + DBG_FUNC("OUT\n"); +} + /* * Handle completion of a command - pass results back through the CCB */ void os_io_response_success(rcb_t *rcb) { - struct ccb_scsiio *csio; + struct ccb_scsiio *csio; DBG_IO("IN rcb = %p\n", rcb); - if (rcb == NULL) + if (rcb == NULL) panic("rcb is null"); csio = (struct ccb_scsiio *)&rcb->cm_ccb->csio; - if (csio == NULL) + if (csio == NULL) panic("csio is null"); rcb->status = REQUEST_SUCCESS; csio->ccb_h.status = CAM_REQ_CMP; - smartpqi_fix_ld_inquiry(rcb->softs, csio); - pqi_release_camq(rcb); - pqi_unmap_request(rcb); - xpt_done((union ccb *)csio); + pqi_complete_scsi_io(csio, rcb); + + DBG_IO("OUT\n"); +} + +static void +copy_sense_data_to_csio(struct ccb_scsiio *csio, + uint8_t *sense_data, uint16_t sense_data_len) +{ + DBG_IO("IN csio = %p\n", csio); + + memset(&csio->sense_data, 0, csio->sense_len); + + sense_data_len = (sense_data_len > csio->sense_len) ? + csio->sense_len : sense_data_len; + + if (sense_data) + memcpy(&csio->sense_data, sense_data, sense_data_len); + + if (csio->sense_len > sense_data_len) + csio->sense_resid = csio->sense_len - sense_data_len; + else + csio->sense_resid = 0; DBG_IO("OUT\n"); } @@ -280,7 +342,8 @@ os_io_response_success(rcb_t *rcb) /* * Error response handling for raid IO */ -void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) +void +os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) { struct ccb_scsiio *csio; pqisrc_softstate_t *softs; @@ -294,10 +357,16 @@ void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) softs = rcb->softs; - ASSERT(err_info != NULL); - csio->scsi_status = err_info->status; csio->ccb_h.status = CAM_REQ_CMP_ERR; + if (!err_info || !rcb->dvp) { + DBG_ERR("couldn't be accessed! error info = %p, rcb->dvp = %p\n", + err_info, rcb->dvp); + goto error_out; + } + + csio->scsi_status = err_info->status; + if (csio->ccb_h.func_code == XPT_SCSI_IO) { /* * Handle specific SCSI status values. @@ -305,59 +374,40 @@ void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) switch(csio->scsi_status) { case PQI_RAID_STATUS_QUEUE_FULL: csio->ccb_h.status = CAM_REQ_CMP; - DBG_ERR("Queue Full error"); + DBG_ERR("Queue Full error\n"); break; /* check condition, sense data included */ case PQI_RAID_STATUS_CHECK_CONDITION: { - uint16_t sense_data_len = - LE_16(err_info->sense_data_len); - uint8_t *sense_data = NULL; - if (sense_data_len) - sense_data = err_info->data; - memset(&csio->sense_data, 0, csio->sense_len); - sense_data_len = (sense_data_len > - csio->sense_len) ? - csio->sense_len : - sense_data_len; - if (sense_data) - memcpy(&csio->sense_data, sense_data, - sense_data_len); - if (csio->sense_len > sense_data_len) - csio->sense_resid = csio->sense_len - - sense_data_len; - else - csio->sense_resid = 0; - csio->ccb_h.status = CAM_SCSI_STATUS_ERROR + uint16_t sense_data_len = + LE_16(err_info->sense_data_len); + uint8_t *sense_data = NULL; + if (sense_data_len) + sense_data = err_info->data; + copy_sense_data_to_csio(csio, sense_data, sense_data_len); + csio->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID | CAM_REQ_CMP_ERR; + } break; case PQI_RAID_DATA_IN_OUT_UNDERFLOW: { - uint32_t resid = 0; - resid = rcb->bcount-err_info->data_out_transferred; - csio->resid = resid; - csio->ccb_h.status = CAM_REQ_CMP; - break; + uint32_t resid = 0; + resid = rcb->bcount-err_info->data_out_transferred; + csio->resid = resid; + csio->ccb_h.status = CAM_REQ_CMP; } + break; default: csio->ccb_h.status = CAM_REQ_CMP; break; } } - if (softs->os_specific.pqi_flags & PQI_FLAG_BUSY) { - softs->os_specific.pqi_flags &= ~PQI_FLAG_BUSY; - if (csio->ccb_h.status & CAM_RELEASE_SIMQ) - xpt_release_simq(xpt_path_sim(csio->ccb_h.path), 0); - else - csio->ccb_h.status |= CAM_RELEASE_SIMQ; - } - - pqi_unmap_request(rcb); - xpt_done((union ccb *)csio); +error_out: + pqi_complete_scsi_io(csio, rcb); DBG_IO("OUT\n"); } @@ -365,14 +415,15 @@ void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) /* * Error response handling for aio. */ -void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) +void +os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) { struct ccb_scsiio *csio; pqisrc_softstate_t *softs; DBG_IO("IN\n"); - if (rcb == NULL) + if (rcb == NULL) panic("rcb is null"); rcb->status = REQUEST_SUCCESS; @@ -382,6 +433,13 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) softs = rcb->softs; + if (!err_info || !rcb->dvp) { + csio->ccb_h.status = CAM_REQ_CMP_ERR; + DBG_ERR("couldn't be accessed! error info = %p, rcb->dvp = %p\n", + err_info, rcb->dvp); + goto error_out; + } + switch (err_info->service_resp) { case PQI_AIO_SERV_RESPONSE_COMPLETE: csio->ccb_h.status = err_info->status; @@ -402,6 +460,14 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) break; case PQI_AIO_STATUS_AIO_PATH_DISABLED: DBG_WARN_BTL(rcb->dvp,"AIO Path Disabled\n"); + /* Timed out TMF response comes here */ + if (rcb->tm_req) { + rcb->req_pending = false; + rcb->status = REQUEST_SUCCESS; + DBG_ERR("AIO Disabled for TMF\n"); + return; + } + rcb->dvp->aio_enabled = false; rcb->dvp->offload_enabled = false; csio->ccb_h.status |= CAM_REQUEUE_REQ; break; @@ -417,18 +483,24 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) break; case PQI_AIO_SERV_RESPONSE_TMF_COMPLETE: case PQI_AIO_SERV_RESPONSE_TMF_SUCCEEDED: - csio->ccb_h.status = CAM_REQ_CMP; - break; + DBG_ERR("PQI_AIO_SERV_RESPONSE_TMF %s\n", + (err_info->service_resp == PQI_AIO_SERV_RESPONSE_TMF_COMPLETE) ? "COMPLETE" : "SUCCEEDED"); + rcb->status = REQUEST_SUCCESS; + rcb->req_pending = false; + return; case PQI_AIO_SERV_RESPONSE_TMF_REJECTED: case PQI_AIO_SERV_RESPONSE_TMF_INCORRECT_LUN: - DBG_WARN_BTL(rcb->dvp,"TMF rejected/Incorrect Lun\n"); - csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR; - break; + DBG_ERR("PQI_AIO_SERV_RESPONSE_TMF %s\n", + (err_info->service_resp == PQI_AIO_SERV_RESPONSE_TMF_REJECTED) ? "REJECTED" : "INCORRECT LUN"); + rcb->status = REQUEST_FAILED; + rcb->req_pending = false; + return; default: DBG_WARN_BTL(rcb->dvp,"Scsi Status Error\n"); csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR; break; } + if(err_info->data_pres == DATA_PRESENT_SENSE_DATA ) { csio->scsi_status = PQI_AIO_STATUS_CHECK_CONDITION; uint8_t *sense_data = NULL; @@ -437,21 +509,12 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) sense_data = err_info->data; DBG_ERR_BTL(rcb->dvp, "SCSI_STATUS_CHECK_COND sense size %u\n", sense_data_len); - memset(&csio->sense_data, 0, csio->sense_len); - if (sense_data) - memcpy(&csio->sense_data, sense_data, ((sense_data_len > - csio->sense_len) ? csio->sense_len : sense_data_len)); - if (csio->sense_len > sense_data_len) - csio->sense_resid = csio->sense_len - sense_data_len; - else - csio->sense_resid = 0; + copy_sense_data_to_csio(csio, sense_data, sense_data_len); csio->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID; } - smartpqi_fix_ld_inquiry(softs, csio); - pqi_release_camq(rcb); - pqi_unmap_request(rcb); - xpt_done((union ccb *)csio); +error_out: + pqi_complete_scsi_io(csio, rcb); DBG_IO("OUT\n"); } @@ -470,31 +533,21 @@ pqi_freeze_ccb(union ccb *ccb) static void pqi_request_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - pqisrc_softstate_t *softs; - rcb_t *rcb; - - rcb = (rcb_t *)arg; - softs = rcb->softs; + rcb_t *rcb = (rcb_t *)arg; + pqisrc_softstate_t *softs = rcb->softs; + union ccb *ccb; - if( error || nseg > softs->pqi_cap.max_sg_elem ) - { - rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; - pqi_freeze_ccb(rcb->cm_ccb); - DBG_ERR_BTL(rcb->dvp, "map failed err = %d or nseg(%d) > sgelem(%d)\n", + if (error || nseg > softs->pqi_cap.max_sg_elem) { + DBG_ERR_BTL(rcb->dvp, "map failed err = %d or nseg(%d) > sgelem(%d)\n", error, nseg, softs->pqi_cap.max_sg_elem); - pqi_unmap_request(rcb); - xpt_done((union ccb *)rcb->cm_ccb); - return; + goto error_io; } - rcb->sgt = os_mem_alloc(softs, nseg * sizeof(rcb_t)); - if (rcb->sgt == NULL) { - rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; - pqi_freeze_ccb(rcb->cm_ccb); + rcb->sgt = os_mem_alloc(softs, nseg * sizeof(sgt_t)); + + if (!rcb->sgt) { DBG_ERR_BTL(rcb->dvp, "os_mem_alloc() failed; nseg = %d\n", nseg); - pqi_unmap_request(rcb); - xpt_done((union ccb *)rcb->cm_ccb); - return; + goto error_io; } rcb->nseg = nseg; @@ -518,38 +571,46 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) if (error) { rcb->req_pending = false; - rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; - pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "Build IO failed, error = %d\n", error); - pqi_unmap_request(rcb); - xpt_done((union ccb *)rcb->cm_ccb); + } else { + /* Successfully IO was submitted to the device. */ return; } + +error_io: + ccb = rcb->cm_ccb; + ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(ccb); + pqi_unmap_request(rcb); + xpt_done(ccb); + return; } /* - * Function to dma-map the request buffer + * Function to dma-map the request buffer */ -static int pqi_map_request( rcb_t *rcb ) +static int +pqi_map_request(rcb_t *rcb) { pqisrc_softstate_t *softs = rcb->softs; - int error = PQI_STATUS_SUCCESS; + int bsd_status = BSD_SUCCESS; union ccb *ccb = rcb->cm_ccb; DBG_FUNC("IN\n"); /* check that mapping is necessary */ if (rcb->cm_flags & PQI_CMD_MAPPED) - return(0); + return BSD_SUCCESS; + rcb->cm_flags |= PQI_CMD_MAPPED; if (rcb->bcount) { - error = bus_dmamap_load_ccb(softs->os_specific.pqi_buffer_dmat, + bsd_status = bus_dmamap_load_ccb(softs->os_specific.pqi_buffer_dmat, rcb->cm_datamap, ccb, pqi_request_map_helper, rcb, 0); - if (error != 0){ - DBG_ERR_BTL(rcb->dvp, "bus_dmamap_load_ccb failed = %d count = %d\n", - error, rcb->bcount); - return error; + if (bsd_status != BSD_SUCCESS && bsd_status != EINPROGRESS) { + DBG_ERR_BTL(rcb->dvp, "bus_dmamap_load_ccb failed, return status = %d transfer length = %d\n", + bsd_status, rcb->bcount); + return bsd_status; } } else { /* @@ -560,18 +621,21 @@ static int pqi_map_request( rcb_t *rcb ) /* Call IO functions depending on pd or ld */ rcb->status = REQUEST_PENDING; - error = pqisrc_build_send_io(softs, rcb); + if (pqisrc_build_send_io(softs, rcb) != PQI_STATUS_SUCCESS) { + bsd_status = EIO; + } } - DBG_FUNC("OUT error = %d\n", error); + DBG_FUNC("OUT error = %d\n", bsd_status); - return error; + return bsd_status; } /* * Function to clear the request control block */ -void os_reset_rcb( rcb_t *rcb ) +void +os_reset_rcb(rcb_t *rcb) { rcb->error_info = NULL; rcb->req = NULL; @@ -582,7 +646,7 @@ void os_reset_rcb( rcb_t *rcb ) rcb->softs = NULL; rcb->cm_flags = 0; rcb->cm_data = NULL; - rcb->bcount = 0; + rcb->bcount = 0; rcb->nseg = 0; rcb->sgt = NULL; rcb->cm_ccb = NULL; @@ -590,30 +654,39 @@ void os_reset_rcb( rcb_t *rcb ) rcb->ioaccel_handle = 0; rcb->resp_qid = 0; rcb->req_pending = false; + rcb->tm_req = false; } /* * Callback function for the lun rescan */ -static void smartpqi_lunrescan_cb(struct cam_periph *periph, union ccb *ccb) +static void +smartpqi_lunrescan_cb(struct cam_periph *periph, union ccb *ccb) { xpt_free_path(ccb->ccb_h.path); xpt_free_ccb(ccb); } + /* * Function to rescan the lun */ -static void smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, +static void +smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, int lun) { - union ccb *ccb = NULL; - cam_status status = 0; - struct cam_path *path = NULL; + union ccb *ccb = NULL; + cam_status status = 0; + struct cam_path *path = NULL; DBG_FUNC("IN\n"); ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + DBG_ERR("Unable to alloc ccb for lun rescan\n"); + return; + } + status = xpt_create_path(&path, NULL, cam_sim_path(softs->os_specific.sim), target, lun); if (status != CAM_REQ_CMP) { @@ -623,6 +696,7 @@ static void smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, return; } + bzero(ccb, sizeof(union ccb)); xpt_setup_ccb(&ccb->ccb_h, path, 5); ccb->ccb_h.func_code = XPT_SCAN_LUN; ccb->ccb_h.cbfcnp = smartpqi_lunrescan_cb; @@ -636,7 +710,8 @@ static void smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, /* * Function to rescan the lun under each target */ -void smartpqi_target_rescan(struct pqisrc_softstate *softs) +void +smartpqi_target_rescan(struct pqisrc_softstate *softs) { int target = 0, lun = 0; @@ -656,7 +731,8 @@ void smartpqi_target_rescan(struct pqisrc_softstate *softs) /* * Set the mode of tagged command queueing for the current task. */ -uint8_t os_get_task_attr(rcb_t *rcb) +uint8_t +os_get_task_attr(rcb_t *rcb) { union ccb *ccb = rcb->cm_ccb; uint8_t tag_action = SOP_TASK_ATTRIBUTE_SIMPLE; @@ -679,19 +755,24 @@ uint8_t os_get_task_attr(rcb_t *rcb) /* * Complete all outstanding commands */ -void os_complete_outstanding_cmds_nodevice(pqisrc_softstate_t *softs) +void +os_complete_outstanding_cmds_nodevice(pqisrc_softstate_t *softs) { int tag = 0; + pqi_scsi_dev_t *dvp = NULL; DBG_FUNC("IN\n"); - for (tag = 1; tag < softs->max_outstanding_io; tag++) { + for (tag = 1; tag <= softs->max_outstanding_io; tag++) { rcb_t *prcb = &softs->rcb[tag]; + dvp = prcb->dvp; if(prcb->req_pending && prcb->cm_ccb ) { prcb->req_pending = false; prcb->cm_ccb->ccb_h.status = CAM_REQ_ABORTED | CAM_REQ_CMP; - xpt_done((union ccb *)prcb->cm_ccb); - prcb->cm_ccb = NULL; + pqi_complete_scsi_io(&prcb->cm_ccb->csio, prcb); + if (dvp) + pqisrc_decrement_device_active_io(softs, dvp); + } } @@ -701,21 +782,22 @@ void os_complete_outstanding_cmds_nodevice(pqisrc_softstate_t *softs) /* * IO handling functionality entry point */ -static int pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) +static int +pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) { rcb_t *rcb; uint32_t tag, no_transfer = 0; pqisrc_softstate_t *softs = (struct pqisrc_softstate *) cam_sim_softc(sim); - int32_t error = PQI_STATUS_FAILURE; + int32_t error; pqi_scsi_dev_t *dvp; DBG_FUNC("IN\n"); - if( softs->device_list[ccb->ccb_h.target_id][ccb->ccb_h.target_lun] == NULL ) { + if (softs->device_list[ccb->ccb_h.target_id][ccb->ccb_h.target_lun] == NULL) { ccb->ccb_h.status = CAM_DEV_NOT_THERE; DBG_INFO("Device = %d not there\n", ccb->ccb_h.target_id); - return PQI_STATUS_FAILURE; + return ENXIO; } dvp = softs->device_list[ccb->ccb_h.target_id][ccb->ccb_h.target_lun]; @@ -724,40 +806,40 @@ static int pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) ccb->ccb_h.status = CAM_SCSI_BUS_RESET | CAM_BUSY | CAM_REQ_INPROG; DBG_WARN("Device = %d BUSY/IN_RESET\n", ccb->ccb_h.target_id); - return error; + return ENXIO; } /* Check device state */ if (pqisrc_ctrl_offline(softs) || DEV_GONE(dvp)) { ccb->ccb_h.status = CAM_DEV_NOT_THERE | CAM_REQ_CMP; DBG_WARN("Device = %d GONE/OFFLINE\n", ccb->ccb_h.target_id); - return error; + return ENXIO; } /* Check device reset */ - if (dvp->reset_in_progress) { + if (DEVICE_RESET(dvp)) { ccb->ccb_h.status = CAM_SCSI_BUSY | CAM_REQ_INPROG | CAM_BUSY; DBG_WARN("Device %d reset returned busy\n", ccb->ccb_h.target_id); - return error; + return EBUSY; } if (dvp->expose_device == false) { ccb->ccb_h.status = CAM_DEV_NOT_THERE; DBG_INFO("Device = %d not exposed\n", ccb->ccb_h.target_id); - return error; + return ENXIO; } tag = pqisrc_get_tag(&softs->taglist); - if( tag == INVALID_ELEM ) { + if (tag == INVALID_ELEM) { DBG_ERR("Get Tag failed\n"); xpt_freeze_simq(softs->os_specific.sim, 1); softs->os_specific.pqi_flags |= PQI_FLAG_BUSY; ccb->ccb_h.status |= (CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ); - return PQI_STATUS_FAILURE; + return EIO; } DBG_IO("tag = %d &softs->taglist : %p\n", tag, &softs->taglist); rcb = &softs->rcb[tag]; - os_reset_rcb( rcb ); + os_reset_rcb(rcb); rcb->tag = tag; rcb->softs = softs; rcb->cmdlen = ccb->csio.cdb_len; @@ -794,57 +876,72 @@ static int pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) * if we ever learn a transport layer other than simple, may fail * if the adapter rejects the command). */ - if ((error = pqi_map_request(rcb)) != 0) { - rcb->req_pending = false; + if ((error = pqi_map_request(rcb)) != BSD_SUCCESS) { xpt_freeze_simq(softs->os_specific.sim, 1); - ccb->ccb_h.status |= CAM_RELEASE_SIMQ; if (error == EINPROGRESS) { - DBG_WARN("In Progress on %d\n", ccb->ccb_h.target_id); - error = 0; + /* Release simq in the completion */ + softs->os_specific.pqi_flags |= PQI_FLAG_BUSY; + error = BSD_SUCCESS; } else { - ccb->ccb_h.status |= CAM_REQUEUE_REQ; + rcb->req_pending = false; + ccb->ccb_h.status |= CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; DBG_WARN("Requeue req error = %d target = %d\n", error, ccb->ccb_h.target_id); pqi_unmap_request(rcb); + error = EIO; } } DBG_FUNC("OUT error = %d\n", error); + return error; } +static inline int +pqi_tmf_status_to_bsd_tmf_status(int pqi_status, rcb_t *rcb) +{ + if (PQI_STATUS_SUCCESS == pqi_status && + REQUEST_SUCCESS == rcb->status) + return BSD_SUCCESS; + else + return EIO; +} + /* * Abort a task, task management functionality */ static int pqisrc_scsi_abort_task(pqisrc_softstate_t *softs, union ccb *ccb) { - rcb_t *rcb = ccb->ccb_h.sim_priv.entries[0].ptr; - uint32_t abort_tag = rcb->tag; - uint32_t tag = 0; - int rval = PQI_STATUS_SUCCESS; - uint16_t qid; - - DBG_FUNC("IN\n"); + struct ccb_hdr *ccb_h = &ccb->ccb_h; + rcb_t *rcb = NULL; + rcb_t *prcb = ccb->ccb_h.sim_priv.entries[0].ptr; + uint32_t tag; + int rval; - qid = (uint16_t)rcb->resp_qid; + DBG_FUNC("IN\n"); tag = pqisrc_get_tag(&softs->taglist); rcb = &softs->rcb[tag]; rcb->tag = tag; - rcb->resp_qid = qid; - rval = pqisrc_send_tmf(softs, rcb->dvp, rcb, abort_tag, + if (!rcb->dvp) { + DBG_ERR("dvp is null, tmf type : 0x%x\n", ccb_h->func_code); + rval = ENXIO; + goto error_tmf; + } + + rcb->tm_req = true; + + rval = pqisrc_send_tmf(softs, rcb->dvp, rcb, prcb, SOP_TASK_MANAGEMENT_FUNCTION_ABORT_TASK); - if (PQI_STATUS_SUCCESS == rval) { - rval = rcb->status; - if (REQUEST_SUCCESS == rval) { - ccb->ccb_h.status = CAM_REQ_ABORTED; - } - } - pqisrc_put_tag(&softs->taglist, abort_tag); - pqisrc_put_tag(&softs->taglist,rcb->tag); + if ((rval = pqi_tmf_status_to_bsd_tmf_status(rval, rcb)) == BSD_SUCCESS) + ccb->ccb_h.status = CAM_REQ_ABORTED; + +error_tmf: + os_reset_rcb(rcb); + pqisrc_put_tag(&softs->taglist, tag); DBG_FUNC("OUT rval = %d\n", rval); @@ -857,9 +954,10 @@ pqisrc_scsi_abort_task(pqisrc_softstate_t *softs, union ccb *ccb) static int pqisrc_scsi_abort_task_set(pqisrc_softstate_t *softs, union ccb *ccb) { + struct ccb_hdr *ccb_h = &ccb->ccb_h; rcb_t *rcb = NULL; - uint32_t tag = 0; - int rval = PQI_STATUS_SUCCESS; + uint32_t tag; + int rval; DBG_FUNC("IN\n"); @@ -867,14 +965,22 @@ pqisrc_scsi_abort_task_set(pqisrc_softstate_t *softs, union ccb *ccb) rcb = &softs->rcb[tag]; rcb->tag = tag; - rval = pqisrc_send_tmf(softs, rcb->dvp, rcb, 0, + if (!rcb->dvp) { + DBG_ERR("dvp is null, tmf type : 0x%x\n", ccb_h->func_code); + rval = ENXIO; + goto error_tmf; *** 9201 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri May 28 22:42: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 A14CC633763; Fri, 28 May 2021 22:42: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 4FsKT03NKgz4sMm; Fri, 28 May 2021 22:42: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 522DF1F4FD; Fri, 28 May 2021 22:42: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 14SMgirm034603; Fri, 28 May 2021 22:42:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SMgiIS034602; Fri, 28 May 2021 22:42:44 GMT (envelope-from git) Date: Fri, 28 May 2021 22:42:44 GMT Message-Id: <202105282242.14SMgiIS034602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e20e60be5012 - main - smartpqi: clear CCBs allocated on the stack MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e20e60be501204c3ba742e266afecc6c6e498a6c 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, 28 May 2021 22:42:44 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e20e60be501204c3ba742e266afecc6c6e498a6c commit e20e60be501204c3ba742e266afecc6c6e498a6c Author: Edward Tomasz Napierala AuthorDate: 2021-05-28 06:33:37 +0000 Commit: Warner Losh CommitDate: 2021-05-28 22:40:24 +0000 smartpqi: clear CCBs allocated on the stack Differential Revision: https://reviews.freebsd.org/D30299 Sponsored by: Netflix --- sys/dev/smartpqi/smartpqi_cam.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c index 3d39e1ffbdd4..e389eb143e4a 100644 --- a/sys/dev/smartpqi/smartpqi_cam.c +++ b/sys/dev/smartpqi/smartpqi_cam.c @@ -1140,6 +1140,7 @@ smartpqi_adjust_queue_depth(struct cam_path *path, uint32_t queue_depth) DBG_INFO("IN\n"); + memset(&crs, 0, sizeof(crs)); xpt_setup_ccb(&crs.ccb_h, path, 5); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = CAM_DEV_QFREEZE; @@ -1262,6 +1263,7 @@ register_sim(struct pqisrc_softstate *softs, int card_index) * derived from the FW. */ softs->os_specific.path = ccb->ccb_h.path; + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, softs->os_specific.path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_FOUND_DEVICE; @@ -1294,6 +1296,7 @@ deregister_sim(struct pqisrc_softstate *softs) } + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, softs->os_specific.path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = 0; From owner-dev-commits-src-main@freebsd.org Fri May 28 23:29:21 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 C1E76634BA0; Fri, 28 May 2021 23:29:21 +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 4FsLVn5BgFz3CTT; Fri, 28 May 2021 23:29:21 +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 9B0821FBED; Fri, 28 May 2021 23:29:21 +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 14SNTLm3013254; Fri, 28 May 2021 23:29:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14SNTLoB013253; Fri, 28 May 2021 23:29:21 GMT (envelope-from git) Date: Fri, 28 May 2021 23:29:21 GMT Message-Id: <202105282329.14SNTLoB013253@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: 55baee8cdbd9 - main - Correct location for KTR masks. 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: 55baee8cdbd9cbaef5f3cb4d69bd6667afd32e09 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, 28 May 2021 23:29:21 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=55baee8cdbd9cbaef5f3cb4d69bd6667afd32e09 commit 55baee8cdbd9cbaef5f3cb4d69bd6667afd32e09 Author: Bryan Drewery AuthorDate: 2021-03-26 21:38:38 +0000 Commit: Bryan Drewery CommitDate: 2021-05-28 23:29:18 +0000 Correct location for KTR masks. MFC after: 3 days Sponsored by: Dell EMC --- share/man/man4/ktr.4 | 4 ++-- share/man/man9/ktr.9 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/share/man/man4/ktr.4 b/share/man/man4/ktr.4 index 730c3ec619a0..175a7ac7e2af 100644 --- a/share/man/man4/ktr.4 +++ b/share/man/man4/ktr.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 20, 2012 +.Dd March 26, 2021 .Dt KTR 4 .Os .Sh NAME @@ -78,7 +78,7 @@ It can also be examined and set after booting via the sysctl. By default the run time mask is set to block any tracing. The definitions of the event mask bits can be found in -.In sys/ktr.h . +.In sys/ktr_class.h . .Pp Furthermore, there is a CPU event mask whose default value can be changed via the diff --git a/share/man/man9/ktr.9 b/share/man/man9/ktr.9 index 17af74ff8459..c7f4138b855c 100644 --- a/share/man/man9/ktr.9 +++ b/share/man/man9/ktr.9 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2008 +.Dd March 26, 2021 .Dt KTR 9 .Os .Sh NAME @@ -69,7 +69,7 @@ macros. The first parameter is a mask of event types .Pq Dv KTR_* defined in -.In sys/ktr.h . +.In sys/ktr_class.h . The event will be logged only if any of the event types specified in .Fa mask are enabled in the global event mask stored in From owner-dev-commits-src-main@freebsd.org Sat May 29 00:02: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 85BF1635411; Sat, 29 May 2021 00:02: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 4FsMDw3CzDz3DsW; Sat, 29 May 2021 00:02: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 5598F20566; Sat, 29 May 2021 00:02: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 14T02O8G072663; Sat, 29 May 2021 00:02:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T02OXc072662; Sat, 29 May 2021 00:02:24 GMT (envelope-from git) Date: Sat, 29 May 2021 00:02:24 GMT Message-Id: <202105290002.14T02OXc072662@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: 67360f7bb0bb - main - cxgbei: Support iSCSI offload on T6. 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: 67360f7bb0bb575d823c21420abaf165ecf62066 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, 29 May 2021 00:02:24 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=67360f7bb0bb575d823c21420abaf165ecf62066 commit 67360f7bb0bb575d823c21420abaf165ecf62066 Author: John Baldwin AuthorDate: 2021-05-28 23:45:29 +0000 Commit: John Baldwin CommitDate: 2021-05-28 23:45:29 +0000 cxgbei: Support iSCSI offload on T6. T6 makes several changes relative to T5 for receive of iSCSI PDUs. First, earlier adapters issue either 2 or 3 messages to the host for each PDU received: CPL_ISCSI_HDR contains the BHS of the PDU, CPL_ISCSI_DATA (when DDP is not used for zero-copy receive) contains the PDU data as buffers on the freelist, and CPL_RX_ISCSI_DDP with status of the PDU such as result of CRC checks. In T6, a new CPL_RX_ISCSI_CMP combines CPL_ISCSI_HDR and CPL_RX_ISCSI_DDP. Data PDUs which are directly placed via DDP only report a single CPL_RX_ISCSI_CMP message. Data PDUs received on the free lists are reported as CPL_ISCSI_DATA followed by CPL_RX_ISCSI_CMP. Control PDUs such as R2T are still reported via CPL_ISCSI_HDR and CPL_RX_ISCSI_DDP. Supporting this requires changing the CPL_ISCSI_DATA handler to allocate a PDU structure if it is not preceded by a CPL_ISCSI_HDR as well as support for the new CPL_RX_ISCSI_CMP. Second, when using DDP for zero-copy receive, T6 will only issue a CPL_RX_ISCSI_CMP after a burst of PDUs have been received (indicated by the F flag in the BHS). In this case, the CPL_RX_ISCSI_CMP can reflect the completion of multiple PDUs and the BHS and TCP sequence number included in the message are from the last PDU received in the burst. Notably, the message does not include any information about earlier PDUs received as part of the burst. Instead, the driver must track the amount of data already received for a given transfer and use this to compute the amount of data received in a burst. In addition, the iSCSI layer currently has no way to permit receiving a logical PDU which spans multiple PDUs. Instead, the driver presents each burst as a single, "large" PDU to the iSCSI target and initiators. This is done by rewriting the buffer offset and data length fields in the BHS of the final PDU as well as rewriting the DataSN so that the received PDUs appear to be in order. To track all this, cxgbei maintains a hash table of 'cxgbei_cmp' structures indexed by transfer tags for each offloaded iSCSI connection. When a SCSI_DATA_IN message is received, the ITT from the received BHS is used to find the necessary state in the hash table, whereas SCSI_DATA_OUT replies use the TTT as the key. The structure tracks the expected starting offset and DataSN of the next burst as well as the rewritten DataSN value used for the previously received PDU. Discussed with: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30458 --- sys/dev/cxgbe/cxgbei/cxgbei.c | 280 ++++++++++++++++++++++++++++++++++++-- sys/dev/cxgbe/cxgbei/cxgbei.h | 16 +++ sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 154 +++++++++++++++------ 3 files changed, 395 insertions(+), 55 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index f95c9f60163f..c70bda7e0436 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -222,27 +222,47 @@ do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m u_int tid = GET_TID(cpl); struct toepcb *toep = lookup_tid(sc, tid); struct icl_cxgbei_pdu *icp = toep->ulpcb2; + struct icl_pdu *ip; M_ASSERTPKTHDR(m); MPASS(m->m_pkthdr.len == be16toh(cpl->len) + sizeof(*cpl)); - /* Must already have received the header (but not the data). */ - MPASS(icp != NULL); - MPASS(icp->icp_flags == ICPF_RX_HDR); - MPASS(icp->ip.ip_data_mbuf == NULL); - + if (icp == NULL) { + /* + * T6 completion enabled, start of a new pdu. Header + * will come in completion CPL. + */ + ip = icl_cxgbei_new_pdu(M_NOWAIT); + if (ip == NULL) + CXGBE_UNIMPLEMENTED("PDU allocation failure"); + icp = ip_to_icp(ip); + } else { + /* T5 mode, header is already received. */ + MPASS(icp->icp_flags == ICPF_RX_HDR); + MPASS(icp->ip.ip_data_mbuf == NULL); + MPASS(icp->ip.ip_data_len == m->m_pkthdr.len - sizeof(*cpl)); + } + /* Trim the cpl header from mbuf. */ m_adj(m, sizeof(*cpl)); - MPASS(icp->ip.ip_data_len == m->m_pkthdr.len); icp->icp_flags |= ICPF_RX_FLBUF; icp->ip.ip_data_mbuf = m; toep->ofld_rxq->rx_iscsi_fl_pdus++; toep->ofld_rxq->rx_iscsi_fl_octets += m->m_pkthdr.len; + /* + * For T6, save the icp for further processing in the + * completion handler. + */ + if (icp->icp_flags == ICPF_RX_FLBUF) { + MPASS(toep->ulpcb2 == NULL); + toep->ulpcb2 = icp; + } + #if 0 - CTR3(KTR_CXGBE, "%s: tid %u, cpl->len %u", __func__, tid, - be16toh(cpl->len)); + CTR4(KTR_CXGBE, "%s: tid %u, cpl->len %u, icp %p", __func__, tid, + be16toh(cpl->len), icp); #endif return (0); @@ -304,15 +324,17 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) __func__, tid, pdu_len, inp->inp_flags); INP_WUNLOCK(inp); icl_cxgbei_conn_pdu_free(NULL, ip); -#ifdef INVARIANTS toep->ulpcb2 = NULL; -#endif return (0); } + /* + * T6+ does not report data PDUs received via DDP without F + * set. This can result in gaps in the TCP sequence space. + */ tp = intotcpcb(inp); - MPASS(icp->icp_seq == tp->rcv_nxt); - tp->rcv_nxt += pdu_len; + MPASS(chip_id(sc) >= CHELSIO_T6 || icp->icp_seq == tp->rcv_nxt); + tp->rcv_nxt = icp->icp_seq + pdu_len; tp->t_rcvtime = ticks; /* @@ -342,9 +364,7 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) CURVNET_RESTORE(); icl_cxgbei_conn_pdu_free(NULL, ip); -#ifdef INVARIANTS toep->ulpcb2 = NULL; -#endif return (0); } MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); @@ -399,10 +419,238 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) SOCKBUF_UNLOCK(sb); INP_WUNLOCK(inp); -#ifdef INVARIANTS toep->ulpcb2 = NULL; + + return (0); +} + +static int +do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) +{ + struct epoch_tracker et; + struct adapter *sc = iq->adapter; + struct cpl_rx_iscsi_cmp *cpl = mtod(m, struct cpl_rx_iscsi_cmp *); + u_int tid = GET_TID(cpl); + struct toepcb *toep = lookup_tid(sc, tid); + struct icl_cxgbei_pdu *icp = toep->ulpcb2; + struct icl_pdu *ip; + struct cxgbei_cmp *cmp; + struct inpcb *inp = toep->inp; +#ifdef INVARIANTS + uint16_t len = be16toh(cpl->len); +#endif + struct socket *so; + struct sockbuf *sb; + struct tcpcb *tp; + struct icl_cxgbei_conn *icc; + struct icl_conn *ic; + struct iscsi_bhs_data_out *bhsdo; + u_int val = be32toh(cpl->ddpvld); + u_int npdus, pdu_len, data_digest_len, hdr_digest_len; + uint32_t prev_seg_len; + + M_ASSERTPKTHDR(m); + MPASS(m->m_pkthdr.len == len + sizeof(*cpl)); + + if ((val & F_DDP_PDU) == 0) { + MPASS(icp != NULL); + MPASS((icp->icp_flags & ICPF_RX_STATUS) == 0); + ip = &icp->ip; + } + + if (icp == NULL) { + /* T6 completion enabled, start of a new PDU. */ + ip = icl_cxgbei_new_pdu(M_NOWAIT); + if (ip == NULL) + CXGBE_UNIMPLEMENTED("PDU allocation failure"); + icp = ip_to_icp(ip); + } + pdu_len = G_ISCSI_PDU_LEN(be16toh(cpl->pdu_len_ddp)); + +#if 0 + CTR5(KTR_CXGBE, + "%s: tid %u, cpl->len %u, ddpvld 0x%08x, icp %p", + __func__, tid, pdu_len, val, icp); #endif + /* Copy header */ + m_copydata(m, sizeof(*cpl), ISCSI_BHS_SIZE, (caddr_t)ip->ip_bhs); + bhsdo = (struct iscsi_bhs_data_out *)ip->ip_bhs; + ip->ip_data_len = bhsdo->bhsdo_data_segment_len[0] << 16 | + bhsdo->bhsdo_data_segment_len[1] << 8 | + bhsdo->bhsdo_data_segment_len[2]; + icp->icp_seq = ntohl(cpl->seq); + icp->icp_flags |= ICPF_RX_HDR; + icp->icp_flags |= ICPF_RX_STATUS; + + if (val & F_DDP_PADDING_ERR) + icp->icp_flags |= ICPF_PAD_ERR; + if (val & F_DDP_HDRCRC_ERR) + icp->icp_flags |= ICPF_HCRC_ERR; + if (val & F_DDP_DATACRC_ERR) + icp->icp_flags |= ICPF_DCRC_ERR; + + INP_WLOCK(inp); + if (__predict_false(inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) { + CTR4(KTR_CXGBE, "%s: tid %u, rx (%d bytes), inp_flags 0x%x", + __func__, tid, pdu_len, inp->inp_flags); + INP_WUNLOCK(inp); + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + m_freem(m); + return (0); + } + + tp = intotcpcb(inp); + + /* + * If icc is NULL, the connection is being closed in + * icl_cxgbei_conn_close(), just drop this data. + */ + icc = toep->ulpcb; + if (__predict_false(icc == NULL)) { + CTR4(KTR_CXGBE, "%s: tid %u, excess rx (%d bytes), icc %p", + __func__, tid, pdu_len, icc); + + /* + * Update rcv_nxt so the sequence number of the FIN + * doesn't appear wrong. + */ + tp->rcv_nxt = icp->icp_seq + pdu_len; + tp->t_rcvtime = ticks; + INP_WUNLOCK(inp); + + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + m_freem(m); + return (0); + } + + data_digest_len = (icc->ulp_submode & ULP_CRC_DATA) ? + ISCSI_DATA_DIGEST_SIZE : 0; + hdr_digest_len = (icc->ulp_submode & ULP_CRC_HEADER) ? + ISCSI_HEADER_DIGEST_SIZE : 0; + MPASS(roundup2(ip->ip_data_len, 4) == pdu_len - len - data_digest_len); + + if (val & F_DDP_PDU && ip->ip_data_mbuf == NULL) { + MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0); + MPASS(ip->ip_data_len > 0); + icp->icp_flags |= ICPF_RX_DDP; + bhsdo = (struct iscsi_bhs_data_out *)ip->ip_bhs; + + switch (ip->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) { + case ISCSI_BHS_OPCODE_SCSI_DATA_IN: + cmp = cxgbei_find_cmp(icc, + be32toh(bhsdo->bhsdo_initiator_task_tag)); + break; + case ISCSI_BHS_OPCODE_SCSI_DATA_OUT: + cmp = cxgbei_find_cmp(icc, + be32toh(bhsdo->bhsdo_target_transfer_tag)); + break; + default: + __assert_unreachable(); + } + MPASS(cmp != NULL); + + /* Must be the final PDU. */ + MPASS(bhsdo->bhsdo_flags & BHSDO_FLAGS_F); + + /* + * The difference between the end of the last burst + * and the offset of the last PDU in this burst is + * the additional data received via DDP. + */ + prev_seg_len = be32toh(bhsdo->bhsdo_buffer_offset) - + cmp->next_buffer_offset; + + if (prev_seg_len != 0) { + /* + * Since cfiscsi doesn't know about previous + * headers, pretend that the entire r2t data + * length was received in this single segment. + */ + ip->ip_data_len += prev_seg_len; + bhsdo->bhsdo_data_segment_len[2] = ip->ip_data_len; + bhsdo->bhsdo_data_segment_len[1] = ip->ip_data_len >> 8; + bhsdo->bhsdo_data_segment_len[0] = ip->ip_data_len >> 16; + bhsdo->bhsdo_buffer_offset = + htobe32(cmp->next_buffer_offset); + + npdus = htobe32(bhsdo->bhsdo_datasn) - cmp->last_datasn; + } else { + MPASS(htobe32(bhsdo->bhsdo_datasn) == + cmp->last_datasn + 1); + npdus = 1; + } + + 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 { + MPASS(icp->icp_flags & (ICPF_RX_FLBUF)); + MPASS(ip->ip_data_len == ip->ip_data_mbuf->m_pkthdr.len); + MPASS(icp->icp_seq == tp->rcv_nxt); + } + + tp->rcv_nxt = icp->icp_seq + pdu_len; + tp->t_rcvtime = ticks; + + /* + * Don't update the window size or return credits since RX + * flow control is disabled. + */ + + so = inp->inp_socket; + sb = &so->so_rcv; + SOCKBUF_LOCK(sb); + if (__predict_false(sb->sb_state & SBS_CANTRCVMORE)) { + CTR5(KTR_CXGBE, + "%s: tid %u, excess rx (%d bytes), icc %p, sb_state 0x%x", + __func__, tid, pdu_len, icc, sb->sb_state); + SOCKBUF_UNLOCK(sb); + INP_WUNLOCK(inp); + + CURVNET_SET(so->so_vnet); + NET_EPOCH_ENTER(et); + INP_WLOCK(inp); + tp = tcp_drop(tp, ECONNRESET); + if (tp != NULL) + INP_WUNLOCK(inp); + NET_EPOCH_EXIT(et); + CURVNET_RESTORE(); + + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + m_freem(m); + return (0); + } + MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); + ic = &icc->ic; + icl_cxgbei_new_pdu_set_conn(ip, ic); + + /* Enqueue the PDU to the received pdus queue. */ + STAILQ_INSERT_TAIL(&icc->rcvd_pdus, ip, ip_next); + if ((icc->rx_flags & RXF_ACTIVE) == 0) { + struct cxgbei_worker_thread_softc *cwt = &cwt_softc[icc->cwt]; + + mtx_lock(&cwt->cwt_lock); + icc->rx_flags |= RXF_ACTIVE; + TAILQ_INSERT_TAIL(&cwt->rx_head, icc, rx_link); + if (cwt->cwt_state == CWT_SLEEPING) { + cwt->cwt_state = CWT_RUNNING; + cv_signal(&cwt->cwt_cv); + } + mtx_unlock(&cwt->cwt_lock); + } + SOCKBUF_UNLOCK(sb); + INP_WUNLOCK(inp); + + toep->ulpcb2 = NULL; + m_freem(m); + return (0); } @@ -669,6 +917,7 @@ cxgbei_mod_load(void) t4_register_cpl_handler(CPL_ISCSI_HDR, do_rx_iscsi_hdr); t4_register_cpl_handler(CPL_ISCSI_DATA, do_rx_iscsi_data); t4_register_cpl_handler(CPL_RX_ISCSI_DDP, do_rx_iscsi_ddp); + t4_register_cpl_handler(CPL_RX_ISCSI_CMP, do_rx_iscsi_cmp); rc = start_worker_threads(); if (rc != 0) @@ -699,6 +948,7 @@ cxgbei_mod_unload(void) t4_register_cpl_handler(CPL_ISCSI_HDR, NULL); t4_register_cpl_handler(CPL_ISCSI_DATA, NULL); t4_register_cpl_handler(CPL_RX_ISCSI_DDP, NULL); + t4_register_cpl_handler(CPL_RX_ISCSI_CMP, NULL); return (0); } diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 9941e817b9cb..45d3398d545c 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -53,6 +53,17 @@ enum { RXF_ACTIVE = 1 << 0, /* In the worker thread's queue */ }; +struct cxgbei_cmp { + LIST_ENTRY(cxgbei_cmp) link; + + uint32_t tt; /* Transfer tag. */ + + uint32_t next_datasn; + uint32_t next_buffer_offset; + uint32_t last_datasn; +}; +LIST_HEAD(cxgbei_cmp_head, cxgbei_cmp); + struct icl_cxgbei_conn { struct icl_conn ic; @@ -67,6 +78,10 @@ struct icl_cxgbei_conn { u_int cwt; STAILQ_HEAD(, icl_pdu) rcvd_pdus; /* protected by so_rcv lock */ TAILQ_ENTRY(icl_cxgbei_conn) rx_link; /* protected by cwt lock */ + + struct cxgbei_cmp_head *cmp_table; /* protected by cmp_lock */ + struct mtx cmp_lock; + unsigned long cmp_hash_mask; }; static inline struct icl_cxgbei_conn * @@ -128,5 +143,6 @@ int icl_cxgbei_mod_unload(void); struct icl_pdu *icl_cxgbei_new_pdu(int); void icl_cxgbei_new_pdu_set_conn(struct icl_pdu *, struct icl_conn *); void icl_cxgbei_conn_pdu_free(struct icl_conn *, struct icl_pdu *); +struct cxgbei_cmp *cxgbei_find_cmp(struct icl_cxgbei_conn *, uint32_t); #endif diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 17d5685f1c1a..b9f7c6355b6f 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -100,6 +99,16 @@ __FBSDID("$FreeBSD$"); #include "tom/t4_tom.h" #include "cxgbei.h" +/* + * Use the page pod tag for the TT hash. + */ +#define TT_HASH(icc, tt) (G_PPOD_TAG(tt) & (icc)->cmp_hash_mask) + +struct cxgbei_ddp_state { + struct ppod_reservation prsv; + struct cxgbei_cmp cmp; +}; + static MALLOC_DEFINE(M_CXGBEI, "cxgbei", "cxgbei(4)"); SYSCTL_NODE(_kern_icl, OID_AUTO, cxgbei, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, @@ -117,7 +126,6 @@ static int recvspace = 1048576; SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, recvspace, CTLFLAG_RWTUN, &recvspace, 0, "Default receive socket buffer size"); -static uma_zone_t prsv_zone; static volatile u_int icl_cxgbei_ncons; #define ICL_CONN_LOCK(X) mtx_lock(X->ic_lock) @@ -555,6 +563,9 @@ icl_cxgbei_new_conn(const char *name, struct mtx *lock) icc->icc_signature = CXGBEI_CONN_SIGNATURE; STAILQ_INIT(&icc->rcvd_pdus); + icc->cmp_table = hashinit(64, M_CXGBEI, &icc->cmp_hash_mask); + mtx_init(&icc->cmp_lock, "cxgbei_cmp", NULL, MTX_DEF); + ic = &icc->ic; ic->ic_lock = lock; @@ -586,6 +597,8 @@ icl_cxgbei_conn_free(struct icl_conn *ic) cv_destroy(&ic->ic_send_cv); cv_destroy(&ic->ic_receive_cv); + mtx_destroy(&icc->cmp_lock); + hashdestroy(icc->cmp_table, M_CXGBEI, icc->cmp_hash_mask); kobj_delete((struct kobj *)icc, M_CXGBE); refcount_release(&icl_cxgbei_ncons); } @@ -904,6 +917,61 @@ icl_cxgbei_conn_close(struct icl_conn *ic) soclose(so); } +static void +cxgbei_insert_cmp(struct icl_cxgbei_conn *icc, struct cxgbei_cmp *cmp, + uint32_t tt) +{ +#ifdef INVARIANTS + struct cxgbei_cmp *cmp2; +#endif + + cmp->tt = tt; + + mtx_lock(&icc->cmp_lock); +#ifdef INVARIANTS + LIST_FOREACH(cmp2, &icc->cmp_table[TT_HASH(icc, tt)], link) { + KASSERT(cmp2->tt != tt, ("%s: duplicate cmp", __func__)); + } +#endif + LIST_INSERT_HEAD(&icc->cmp_table[TT_HASH(icc, tt)], cmp, link); + mtx_unlock(&icc->cmp_lock); +} + +struct cxgbei_cmp * +cxgbei_find_cmp(struct icl_cxgbei_conn *icc, uint32_t tt) +{ + struct cxgbei_cmp *cmp; + + mtx_lock(&icc->cmp_lock); + LIST_FOREACH(cmp, &icc->cmp_table[TT_HASH(icc, tt)], link) { + if (cmp->tt == tt) + break; + } + mtx_unlock(&icc->cmp_lock); + return (cmp); +} + +static void +cxgbei_rm_cmp(struct icl_cxgbei_conn *icc, struct cxgbei_cmp *cmp) +{ +#ifdef INVARIANTS + struct cxgbei_cmp *cmp2; +#endif + + mtx_lock(&icc->cmp_lock); + +#ifdef INVARIANTS + LIST_FOREACH(cmp2, &icc->cmp_table[TT_HASH(icc, cmp->tt)], link) { + if (cmp2 == cmp) + goto found; + } + panic("%s: could not find cmp", __func__); +found: +#endif + LIST_REMOVE(cmp, link); + mtx_unlock(&icc->cmp_lock); +} + int icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, struct ccb_scsiio *csio, uint32_t *ittp, void **arg) @@ -913,6 +981,7 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, struct adapter *sc = icc->sc; struct cxgbei_data *ci = sc->iscsi_ulp_softc; struct ppod_region *pr = &ci->pr; + struct cxgbei_ddp_state *ddp; struct ppod_reservation *prsv; uint32_t itt; int rc = 0; @@ -943,30 +1012,32 @@ no_ddp: * Reserve resources for DDP, update the itt that should be used in the * PDU, and save DDP specific state for this I/O in *arg. */ - - prsv = uma_zalloc(prsv_zone, M_NOWAIT); - if (prsv == NULL) { + ddp = malloc(sizeof(*ddp), M_CXGBEI, M_NOWAIT | M_ZERO); + if (ddp == NULL) { rc = ENOMEM; goto no_ddp; } + prsv = &ddp->prsv; /* XXX add support for all CAM_DATA_ types */ MPASS((csio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR); rc = t4_alloc_page_pods_for_buf(pr, (vm_offset_t)csio->data_ptr, csio->dxfer_len, prsv); if (rc != 0) { - uma_zfree(prsv_zone, prsv); + free(ddp, M_CXGBEI); goto no_ddp; } rc = t4_write_page_pods_for_buf(sc, toep, prsv, (vm_offset_t)csio->data_ptr, csio->dxfer_len); - if (rc != 0) { + if (__predict_false(rc != 0)) { t4_free_page_pods(prsv); - uma_zfree(prsv_zone, prsv); + free(ddp, M_CXGBEI); goto no_ddp; } + ddp->cmp.last_datasn = -1; + cxgbei_insert_cmp(icc, &ddp->cmp, prsv->prsv_tag); *ittp = htobe32(prsv->prsv_tag); *arg = prsv; counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); @@ -978,10 +1049,11 @@ icl_cxgbei_conn_task_done(struct icl_conn *ic, void *arg) { if (arg != NULL) { - struct ppod_reservation *prsv = arg; + struct cxgbei_ddp_state *ddp = arg; - t4_free_page_pods(prsv); - uma_zfree(prsv_zone, prsv); + cxgbei_rm_cmp(ic_to_icc(ic), &ddp->cmp); + t4_free_page_pods(&ddp->prsv); + free(ddp, M_CXGBEI); } } @@ -1009,7 +1081,7 @@ ddp_sgl_check(struct ctl_sg_entry *sg, int entries, int xferlen) /* XXXNP: PDU should be passed in as parameter, like on the initiator. */ #define io_to_request_pdu(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr) -#define io_to_ppod_reservation(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr) +#define io_to_ddp_state(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr) int icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, @@ -1021,6 +1093,7 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, struct adapter *sc = icc->sc; struct cxgbei_data *ci = sc->iscsi_ulp_softc; struct ppod_region *pr = &ci->pr; + struct cxgbei_ddp_state *ddp; struct ppod_reservation *prsv; struct ctl_sg_entry *sgl, sg_entry; int sg_entries = ctsio->kern_sg_entries; @@ -1064,7 +1137,7 @@ no_ddp: ttt = *tttp & M_PPOD_TAG; ttt = V_PPOD_TAG(ttt) | pr->pr_invalid_bit; *tttp = htobe32(ttt); - MPASS(io_to_ppod_reservation(io) == NULL); + MPASS(io_to_ddp_state(io) == NULL); if (rc != 0) counter_u64_add( toep->ofld_rxq->rx_iscsi_ddp_setup_error, 1); @@ -1086,17 +1159,17 @@ no_ddp: * Reserve resources for DDP, update the ttt that should be used * in the PDU, and save DDP specific state for this I/O. */ - - MPASS(io_to_ppod_reservation(io) == NULL); - prsv = uma_zalloc(prsv_zone, M_NOWAIT); - if (prsv == NULL) { + MPASS(io_to_ddp_state(io) == NULL); + ddp = malloc(sizeof(*ddp), M_CXGBEI, M_NOWAIT | M_ZERO); + if (ddp == NULL) { rc = ENOMEM; goto no_ddp; } + prsv = &ddp->prsv; rc = t4_alloc_page_pods_for_sgl(pr, sgl, sg_entries, prsv); if (rc != 0) { - uma_zfree(prsv_zone, prsv); + free(ddp, M_CXGBEI); goto no_ddp; } @@ -1104,12 +1177,16 @@ no_ddp: xferlen); if (__predict_false(rc != 0)) { t4_free_page_pods(prsv); - uma_zfree(prsv_zone, prsv); + free(ddp, M_CXGBEI); goto no_ddp; } + ddp->cmp.next_buffer_offset = ctsio->kern_rel_offset + + first_burst; + ddp->cmp.last_datasn = -1; + cxgbei_insert_cmp(icc, &ddp->cmp, prsv->prsv_tag); *tttp = htobe32(prsv->prsv_tag); - io_to_ppod_reservation(io) = prsv; + io_to_ddp_state(io) = ddp; *arg = ctsio; counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); return (0); @@ -1119,16 +1196,19 @@ no_ddp: * In the middle of an I/O. A non-NULL page pod reservation indicates * that a DDP buffer is being used for the I/O. */ - - prsv = io_to_ppod_reservation(ctsio); - if (prsv == NULL) + ddp = io_to_ddp_state(ctsio); + if (ddp == NULL) goto no_ddp; + prsv = &ddp->prsv; alias = (prsv->prsv_tag & pr->pr_alias_mask) >> pr->pr_alias_shift; alias++; 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); *arg = ctsio; @@ -1140,16 +1220,19 @@ icl_cxgbei_conn_transfer_done(struct icl_conn *ic, void *arg) { struct ctl_scsiio *ctsio = arg; - if (ctsio != NULL && (ctsio->kern_data_len == ctsio->ext_data_filled || - ic->ic_disconnecting)) { - struct ppod_reservation *prsv; + if (ctsio != NULL) { + struct cxgbei_ddp_state *ddp; - prsv = io_to_ppod_reservation(ctsio); - MPASS(prsv != NULL); + ddp = io_to_ddp_state(ctsio); + MPASS(ddp != NULL); - t4_free_page_pods(prsv); - uma_zfree(prsv_zone, prsv); - io_to_ppod_reservation(ctsio) = NULL; + cxgbei_rm_cmp(ic_to_icc(ic), &ddp->cmp); + if (ctsio->kern_data_len == ctsio->ext_data_filled || + ic->ic_disconnecting) { + t4_free_page_pods(&ddp->prsv); + free(ddp, M_CXGBEI); + io_to_ddp_state(ctsio) = NULL; + } } } @@ -1208,13 +1291,6 @@ icl_cxgbei_mod_load(void) { int rc; - /* - * Space to track pagepod reservations. - */ - prsv_zone = uma_zcreate("Pagepod reservations", - sizeof(struct ppod_reservation), NULL, NULL, NULL, NULL, - UMA_ALIGN_CACHE, 0); - refcount_init(&icl_cxgbei_ncons, 0); rc = icl_register("cxgbei", false, -100, icl_cxgbei_limits, @@ -1232,8 +1308,6 @@ icl_cxgbei_mod_unload(void) icl_unregister("cxgbei", false); - uma_zdestroy(prsv_zone); - return (0); } #endif From owner-dev-commits-src-main@freebsd.org Sat May 29 00:02: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 B62806355E3; Sat, 29 May 2021 00:02: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 4FsMDx4VQNz3Dxk; Sat, 29 May 2021 00:02: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 7BE0620A03; Sat, 29 May 2021 00:02: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 14T02P1k072684; Sat, 29 May 2021 00:02:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T02P2V072683; Sat, 29 May 2021 00:02:25 GMT (envelope-from git) Date: Sat, 29 May 2021 00:02:25 GMT Message-Id: <202105290002.14T02P2V072683@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: f949967c8eb3 - main - cxgbei: Fix a race between transfer setup and a peer reset. 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: f949967c8eb3ab5e5a965e3cf07a726dfdc81263 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, 29 May 2021 00:02:25 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f949967c8eb3ab5e5a965e3cf07a726dfdc81263 commit f949967c8eb3ab5e5a965e3cf07a726dfdc81263 Author: John Baldwin AuthorDate: 2021-05-20 23:03:19 +0000 Commit: John Baldwin CommitDate: 2021-05-28 23:47:04 +0000 cxgbei: Fix a race between transfer setup and a peer reset. In 4427ac3675f9, the TOM driver stopped sending work requests to program iSCSI page pods directly and instead queued them to be written asynchronously with iSCSI PDUs. The queue of mbufs to send is protected by the inp lock. However, the inp cannot be safely obtained from the toep since a RST from the remote peer might have cleared toep->inp asynchronously in an ithread. To fix, obtain the inp from the socket as is already done in icl_cxgbei_conn_pdu_queue_cb() and fail the new transfer setup with ECONNRESET if the connection has been reset. To avoid passing sockets or inps into the page pod routines, pull the mbufq out of the two relevant page pod routines such that the routines queue new work request mbufs to a caller-supplied mbufq. Reported by: Jithesh Arakkan @ Chelsio Fixes: 4427ac3675f91df039d54a23518132e0e0fede86 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 44 +++++++++++++++++++++++++++++++++++++-- sys/dev/cxgbe/tom/t4_ddp.c | 31 +++++++-------------------- sys/dev/cxgbe/tom/t4_tom.h | 4 ++-- 3 files changed, 51 insertions(+), 28 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index b9f7c6355b6f..01759d929c0e 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -983,6 +983,8 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, struct ppod_region *pr = &ci->pr; struct cxgbei_ddp_state *ddp; struct ppod_reservation *prsv; + struct inpcb *inp; + struct mbufq mq; uint32_t itt; int rc = 0; @@ -1028,14 +1030,32 @@ no_ddp: goto no_ddp; } + mbufq_init(&mq, INT_MAX); rc = t4_write_page_pods_for_buf(sc, toep, prsv, - (vm_offset_t)csio->data_ptr, csio->dxfer_len); + (vm_offset_t)csio->data_ptr, csio->dxfer_len, &mq); if (__predict_false(rc != 0)) { + mbufq_drain(&mq); t4_free_page_pods(prsv); free(ddp, M_CXGBEI); goto no_ddp; } + /* + * Do not get inp from toep->inp as the toepcb might have + * detached already. + */ + inp = sotoinpcb(ic->ic_socket); + INP_WLOCK(inp); + if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) != 0) { + INP_WUNLOCK(inp); + mbufq_drain(&mq); + t4_free_page_pods(prsv); + free(ddp, M_CXGBEI); + return (ECONNRESET); + } + mbufq_concat(&toep->ulp_pduq, &mq); + INP_WUNLOCK(inp); + ddp->cmp.last_datasn = -1; cxgbei_insert_cmp(icc, &ddp->cmp, prsv->prsv_tag); *ittp = htobe32(prsv->prsv_tag); @@ -1096,6 +1116,8 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, struct cxgbei_ddp_state *ddp; struct ppod_reservation *prsv; struct ctl_sg_entry *sgl, sg_entry; + struct inpcb *inp; + struct mbufq mq; int sg_entries = ctsio->kern_sg_entries; uint32_t ttt; int xferlen, rc = 0, alias; @@ -1173,14 +1195,32 @@ no_ddp: goto no_ddp; } + mbufq_init(&mq, INT_MAX); rc = t4_write_page_pods_for_sgl(sc, toep, prsv, sgl, sg_entries, - xferlen); + xferlen, &mq); if (__predict_false(rc != 0)) { + mbufq_drain(&mq); t4_free_page_pods(prsv); free(ddp, M_CXGBEI); goto no_ddp; } + /* + * Do not get inp from toep->inp as the toepcb might + * have detached already. + */ + inp = sotoinpcb(ic->ic_socket); + INP_WLOCK(inp); + if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) != 0) { + INP_WUNLOCK(inp); + mbufq_drain(&mq); + t4_free_page_pods(prsv); + free(ddp, M_CXGBEI); + return (ECONNRESET); + } + mbufq_concat(&toep->ulp_pduq, &mq); + INP_WUNLOCK(inp); + ddp->cmp.next_buffer_offset = ctsio->kern_rel_offset + first_burst; ddp->cmp.last_datasn = -1; diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index 34c01674659a..2b58cb60d4fd 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -1175,9 +1175,9 @@ alloc_raw_wr_mbuf(int len) int t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, - struct ppod_reservation *prsv, vm_offset_t buf, int buflen) + struct ppod_reservation *prsv, vm_offset_t buf, int buflen, + struct mbufq *wrq) { - struct inpcb *inp = toep->inp; struct ulp_mem_io *ulpmc; struct ulptx_idata *ulpsc; struct pagepod *ppod; @@ -1187,7 +1187,6 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, struct ppod_region *pr = prsv->prsv_pr; uintptr_t end_pva, pva, pa; struct mbuf *m; - struct mbufq wrq; cmd = htobe32(V_ULPTX_CMD(ULP_TX_MEM_WRITE)); if (is_t4(sc)) @@ -1199,7 +1198,6 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, ppod_addr = pr->pr_start + (prsv->prsv_tag & pr->pr_tag_mask); pva = trunc_page(buf); end_pva = trunc_page(buf + buflen - 1); - mbufq_init(&wrq, INT_MAX); for (i = 0; i < prsv->prsv_nppods; ppod_addr += chunk) { /* How many page pods are we writing in this cycle */ @@ -1209,10 +1207,8 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, len = roundup2(sizeof(*ulpmc) + sizeof(*ulpsc) + chunk, 16); m = alloc_raw_wr_mbuf(len); - if (m == NULL) { - mbufq_drain(&wrq); + if (m == NULL) return (ENOMEM); - } ulpmc = mtod(m, struct ulp_mem_io *); INIT_ULPTX_WR(ulpmc, len, 0, toep->tid); @@ -1258,13 +1254,9 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, pva -= ddp_pgsz; } - mbufq_enqueue(&wrq, m); + mbufq_enqueue(wrq, m); } - INP_WLOCK(inp); - mbufq_concat(&toep->ulp_pduq, &wrq); - INP_WUNLOCK(inp); - MPASS(pva <= end_pva); return (0); @@ -1273,9 +1265,8 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, int t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, struct ppod_reservation *prsv, struct ctl_sg_entry *sgl, int entries, - int xferlen) + int xferlen, struct mbufq *wrq) { - struct inpcb *inp = toep->inp; struct ulp_mem_io *ulpmc; struct ulptx_idata *ulpsc; struct pagepod *ppod; @@ -1285,7 +1276,6 @@ t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, struct ppod_region *pr = prsv->prsv_pr; uintptr_t pva, pa; struct mbuf *m; - struct mbufq wrq; MPASS(sgl != NULL); MPASS(entries > 0); @@ -1298,7 +1288,6 @@ t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, offset = (vm_offset_t)sgl->addr & PAGE_MASK; ppod_addr = pr->pr_start + (prsv->prsv_tag & pr->pr_tag_mask); pva = trunc_page((vm_offset_t)sgl->addr); - mbufq_init(&wrq, INT_MAX); for (i = 0; i < prsv->prsv_nppods; ppod_addr += chunk) { /* How many page pods are we writing in this cycle */ @@ -1308,10 +1297,8 @@ t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, len = roundup2(sizeof(*ulpmc) + sizeof(*ulpsc) + chunk, 16); m = alloc_raw_wr_mbuf(len); - if (m == NULL) { - mbufq_drain(&wrq); + if (m == NULL) return (ENOMEM); - } ulpmc = mtod(m, struct ulp_mem_io *); INIT_ULPTX_WR(ulpmc, len, 0, toep->tid); @@ -1378,13 +1365,9 @@ t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, } } - mbufq_enqueue(&wrq, m); + mbufq_enqueue(wrq, m); } - INP_WLOCK(inp); - mbufq_concat(&toep->ulp_pduq, &wrq); - INP_WUNLOCK(inp); - return (0); } diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index c7984f838735..21cfb1df6e16 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -443,9 +443,9 @@ int t4_alloc_page_pods_for_sgl(struct ppod_region *, struct ctl_sg_entry *, int, int t4_write_page_pods_for_ps(struct adapter *, struct sge_wrq *, int, struct pageset *); int t4_write_page_pods_for_buf(struct adapter *, struct toepcb *, - struct ppod_reservation *, vm_offset_t, int); + struct ppod_reservation *, vm_offset_t, int, struct mbufq *); int t4_write_page_pods_for_sgl(struct adapter *, struct toepcb *, - struct ppod_reservation *, struct ctl_sg_entry *, int, int); + struct ppod_reservation *, struct ctl_sg_entry *, int, int, struct mbufq *); void t4_free_page_pods(struct ppod_reservation *); int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *, struct mbuf **, struct mbuf **, int *); From owner-dev-commits-src-main@freebsd.org Sat May 29 00:02: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 058156355E4; Sat, 29 May 2021 00:02: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 4FsMDy5N0Zz3Dvm; Sat, 29 May 2021 00:02: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 88DA220981; Sat, 29 May 2021 00:02: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 14T02QRm073148; Sat, 29 May 2021 00:02:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T02Qfw073137; Sat, 29 May 2021 00:02:26 GMT (envelope-from git) Date: Sat, 29 May 2021 00:02:26 GMT Message-Id: <202105290002.14T02Qfw073137@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: 677cb9722a64 - main - cxgbe tom: Free pending iSCSI mbufs on connection shutdown. 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: 677cb9722a64d3f944d3e374e0ef1bb0e45644b5 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, 29 May 2021 00:02:27 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=677cb9722a64d3f944d3e374e0ef1bb0e45644b5 commit 677cb9722a64d3f944d3e374e0ef1bb0e45644b5 Author: John Baldwin AuthorDate: 2021-05-21 00:16:23 +0000 Commit: John Baldwin CommitDate: 2021-05-28 23:47:31 +0000 cxgbe tom: Free pending iSCSI mbufs on connection shutdown. If an iSCSI connection is shutdown abruptly (e.g. by a RST from the peer), pending iSCSI PDUs and page pod work requests can be in the ulp_pduq when the final CPL is received indicating the death of the connection. Reported by: Jithesh Arakkan @ Chelsio --- sys/dev/cxgbe/tom/t4_tom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 97693ab74000..1c9999be339d 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -1024,6 +1024,7 @@ final_cpl_received(struct toepcb *toep) tls_detach(toep); toep->inp = NULL; toep->flags &= ~TPF_CPL_PENDING; + mbufq_drain(&toep->ulp_pduq); mbufq_drain(&toep->ulp_pdu_reclaimq); if (!(toep->flags & TPF_ATTACHED)) From owner-dev-commits-src-main@freebsd.org Sat May 29 02:37: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 0947863772F; Sat, 29 May 2021 02:37: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 4FsQhP6d6Hz3NGd; Sat, 29 May 2021 02:37: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 CB96D22866; Sat, 29 May 2021 02:37: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 14T2bviN071799; Sat, 29 May 2021 02:37:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T2bvfv071798; Sat, 29 May 2021 02:37:57 GMT (envelope-from git) Date: Sat, 29 May 2021 02:37:57 GMT Message-Id: <202105290237.14T2bvfv071798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 5c9e9eb7a27f - main - Fix fsck_ufs segfault when it needs to rerun. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c9e9eb7a27feb24136c16706f3db8ce7c8bbc47 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, 29 May 2021 02:37:58 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=5c9e9eb7a27feb24136c16706f3db8ce7c8bbc47 commit 5c9e9eb7a27feb24136c16706f3db8ce7c8bbc47 Author: Kirk McKusick AuthorDate: 2021-05-29 02:41:05 +0000 Commit: Kirk McKusick CommitDate: 2021-05-29 02:41:50 +0000 Fix fsck_ufs segfault when it needs to rerun. The segfault was being hit in the rerun of Pass 1 in ginode() when trying to get an inode that needs to be repaired. When the first run of fsck_ffs finishes it clears the inode cache, but ginode() was failing to check properly and tried to access the deallocated cache entry. Reported by: Peter Holm Reviewed by: Chuck Silvers Tested by: Peter Holm and Chuck Silvers MFC after: 3 days Sponsored by: Netflix --- sbin/fsck_ffs/inode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index d4e5723f559f..ba2d5892238e 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -416,14 +416,14 @@ void ginode(ino_t inumber, struct inode *ip) { ufs2_daddr_t iblk; - static ino_t startinum = -1; if (inumber < UFS_ROOTINO || inumber > maxino) errx(EEXIT, "bad inode number %ju to ginode", (uintmax_t)inumber); ip->i_number = inumber; - if (startinum != -1 && - inumber >= startinum && inumber < startinum + INOPB(&sblock)) { + if (icachebp != NULL && + inumber >= icachebp->b_index && + inumber < icachebp->b_index + INOPB(&sblock)) { /* take an additional reference for the returned inode */ icachebp->b_refcnt++; } else { @@ -433,14 +433,14 @@ ginode(ino_t inumber, struct inode *ip) brelse(icachebp); icachebp = getdatablk(iblk, sblock.fs_bsize, BT_INODES); if (icachebp->b_errs != 0) { + icachebp = NULL; ip->i_bp = NULL; ip->i_dp = &zino; return; } - startinum = rounddown(inumber, INOPB(&sblock)); /* take a cache-hold reference on new icachebp */ icachebp->b_refcnt++; - icachebp->b_index = startinum; + icachebp->b_index = rounddown(inumber, INOPB(&sblock)); } ip->i_bp = icachebp; if (sblock.fs_magic == FS_UFS1_MAGIC) { From owner-dev-commits-src-main@freebsd.org Sat May 29 02:57: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 ADE2F637C12; Sat, 29 May 2021 02:57: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 4FsR7S4XpCz3Nn1; Sat, 29 May 2021 02:57: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 8012A22AC7; Sat, 29 May 2021 02:57: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 14T2vuXV097512; Sat, 29 May 2021 02:57:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T2vud1097511; Sat, 29 May 2021 02:57:56 GMT (envelope-from git) Date: Sat, 29 May 2021 02:57:56 GMT Message-Id: <202105290257.14T2vud1097511@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 871291c8d478 - main - Revert "fsdb: add missing bufinit() call" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 871291c8d478c5898fc7b4a700b6ab7733bb1b37 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, 29 May 2021 02:57:56 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=871291c8d478c5898fc7b4a700b6ab7733bb1b37 commit 871291c8d478c5898fc7b4a700b6ab7733bb1b37 Author: Robert Wing AuthorDate: 2021-05-29 02:51:25 +0000 Commit: Robert Wing CommitDate: 2021-05-29 02:51:25 +0000 Revert "fsdb: add missing bufinit() call" This reverts commit 84768d114951e88288024f09d4beae0956c3cf21. --- sbin/fsdb/fsdb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index b8f0dd9f9772..785aeb2b5a75 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -111,7 +111,6 @@ main(int argc, char *argv[]) fsys = argv[0]; sblock_init(); - bufinit(); if (!setup(fsys)) errx(1, "cannot set up file system `%s'", fsys); if (fswritefd < 0) From owner-dev-commits-src-main@freebsd.org Sat May 29 03:01:21 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 1AC02637F06; Sat, 29 May 2021 03:01:21 +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 4FsRCM6j6jz3P0R; Sat, 29 May 2021 03:01: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 B4688228D2; Sat, 29 May 2021 03:01: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 14T31Afv010985; Sat, 29 May 2021 03:01:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T31AQh010984; Sat, 29 May 2021 03:01:10 GMT (envelope-from git) Date: Sat, 29 May 2021 03:01:10 GMT Message-Id: <202105290301.14T31AQh010984@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 9b0f1d64b06c - main - Revert "Fix fsck_ufs segfaults with gjournal (SU+J)" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b0f1d64b06cdeacb7ee5a1ca95bb23c5381f12c 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, 29 May 2021 03:01:21 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=9b0f1d64b06cdeacb7ee5a1ca95bb23c5381f12c commit 9b0f1d64b06cdeacb7ee5a1ca95bb23c5381f12c Author: Robert Wing AuthorDate: 2021-05-29 02:59:07 +0000 Commit: Robert Wing CommitDate: 2021-05-29 02:59:07 +0000 Revert "Fix fsck_ufs segfaults with gjournal (SU+J)" Fix fsck for 32-bit platforms. This reverts commit f190f9193bc10a8193c87e0a02fa91400e4eb159. --- sbin/fsck_ffs/main.c | 1 - sbin/fsck_ffs/setup.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 642e321fdd35..401ee10f9be3 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -272,7 +272,6 @@ checkfilesys(char *filesys) * exit status will cause a foreground check to be run. */ sblock_init(); - bufinit(); if (bkgrdcheck) { if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0) exit(3); /* Cannot read superblock */ diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index d69beff879e9..0ae7f1bbb28f 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -298,6 +298,7 @@ setup(char *dev) (uintmax_t)numdirs * sizeof(struct inoinfo *)); goto badsb; } + bufinit(); if (sblock.fs_flags & FS_DOSOFTDEP) usedsoftdep = 1; else From owner-dev-commits-src-main@freebsd.org Sat May 29 03:37: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 469F3638418; Sat, 29 May 2021 03:37: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 4FsS141YK5z3QdQ; Sat, 29 May 2021 03:37: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 1D814230E4; Sat, 29 May 2021 03:37: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 14T3bS03052263; Sat, 29 May 2021 03:37:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T3bS2k052262; Sat, 29 May 2021 03:37:28 GMT (envelope-from git) Date: Sat, 29 May 2021 03:37:28 GMT Message-Id: <202105290337.14T3bS2k052262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: e5f5b6a75c0a - main - .github: Attempt to un-break Clang 9 action MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5f5b6a75c0aa0f51a399e2002d15b51211630b5 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, 29 May 2021 03:37:28 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=e5f5b6a75c0aa0f51a399e2002d15b51211630b5 commit e5f5b6a75c0aa0f51a399e2002d15b51211630b5 Author: Jessica Clarke AuthorDate: 2021-05-29 03:36:36 +0000 Commit: Jessica Clarke CommitDate: 2021-05-29 03:36:36 +0000 .github: Attempt to un-break Clang 9 action GitHub removed Clang 9 from the 20.04 image[1], breaking this build. Thus, manually add the specific versioned packages we need for the Ubuntu jobs to ensure they're installed. Note that we don't do the same for macOS, as Homebrew does not allow multiple llvm@N to co-exist, giving an error if you attempt to install a second one. In practice we don't actually use the compiler field here for anything other than the build name, it's only the cross-bindir that matters, so when it eventually moves to 12 the name will get confusing but the job will still work. MFC after: immediately [1] https://github.com/actions/virtual-environments/commit/15a610677be406d250c1f6732b03c8b87e693a0a --- .github/workflows/cross-bootstrap-tools.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cross-bootstrap-tools.yml b/.github/workflows/cross-bootstrap-tools.yml index f002cb0fbbe2..22aa1065d44b 100644 --- a/.github/workflows/cross-bootstrap-tools.yml +++ b/.github/workflows/cross-bootstrap-tools.yml @@ -18,11 +18,11 @@ jobs: - os: ubuntu-20.04 compiler: clang-9 cross-bindir: /usr/lib/llvm-9/bin - pkgs: bmake libarchive-dev + pkgs: bmake libarchive-dev clang-9 lld-9 - os: ubuntu-20.04 compiler: clang-10 cross-bindir: /usr/lib/llvm-10/bin - pkgs: bmake libarchive-dev + pkgs: bmake libarchive-dev clang-10 lld-10 - os: macOS-latest compiler: clang-11 pkgs: bmake libarchive From owner-dev-commits-src-main@freebsd.org Sat May 29 05:06: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 1485D639415; Sat, 29 May 2021 05:06: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 4FsTzd6nQCz3ld6; Sat, 29 May 2021 05:06:21 +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 D11CF244BB; Sat, 29 May 2021 05:06:21 +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 14T56LOE071461; Sat, 29 May 2021 05:06:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T56L7P071460; Sat, 29 May 2021 05:06:21 GMT (envelope-from git) Date: Sat, 29 May 2021 05:06:21 GMT Message-Id: <202105290506.14T56L7P071460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f0f47121653e - main - nvme: fix a race between failing the controller and failing requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0f47121653e88197d8537572294b90f5aef7f17 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, 29 May 2021 05:06:22 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f0f47121653e88197d8537572294b90f5aef7f17 commit f0f47121653e88197d8537572294b90f5aef7f17 Author: Warner Losh AuthorDate: 2021-05-29 05:01:52 +0000 Commit: Warner Losh CommitDate: 2021-05-29 05:05:40 +0000 nvme: fix a race between failing the controller and failing requests Part of the nvme recovery process for errors is to reset the card. Sometimes, this results in failing the entire controller. When nda is in use, we free the sim, which will sleep until all the I/O has completed. However, with only one thread, the request fail task never runs once the reset thread sleeps here. Create two threads to allow I/O to fail until it's all processed and the reset task can proceed. This is a temporary kludge until I can work out questions that arose during the review, not least is what was the race that queueing to a failure task solved. The original commit is vague and other error paths in the same context do a direct failure. I'll investigate that more completely before committing changing that to a direct failure. mav@ raised this issue during the review, but didn't otherwise object. Multiple threads, though, solve the problem in the mean time until other such means can be perfected. Reviewed by: jhb@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30366 --- sys/dev/nvme/nvme_ctrlr.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index b6befb2c88d0..d8760158a75f 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1429,9 +1429,20 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) if (nvme_ctrlr_construct_admin_qpair(ctrlr) != 0) return (ENXIO); + /* + * Create 2 threads for the taskqueue. The reset thread will block when + * it detects that the controller has failed until all I/O has been + * failed up the stack. The fail_req task needs to be able to run in + * this case to finish the request failure for some cases. + * + * We could partially solve this race by draining the failed requeust + * queue before proceding to free the sim, though nothing would stop + * new I/O from coming in after we do that drain, but before we reach + * cam_sim_free, so this big hammer is used instead. + */ ctrlr->taskqueue = taskqueue_create("nvme_taskq", M_WAITOK, taskqueue_thread_enqueue, &ctrlr->taskqueue); - taskqueue_start_threads(&ctrlr->taskqueue, 1, PI_DISK, "nvme taskq"); + taskqueue_start_threads(&ctrlr->taskqueue, 2, PI_DISK, "nvme taskq"); ctrlr->is_resetting = 0; ctrlr->is_initialized = 0; From owner-dev-commits-src-main@freebsd.org Sat May 29 06:21: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 E1F9F639FE1; Sat, 29 May 2021 06:21: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 4FsWfh5x0xz3r2F; Sat, 29 May 2021 06:21: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 B3BAE255FE; Sat, 29 May 2021 06:21: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 14T6Lmsu078268; Sat, 29 May 2021 06:21:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T6LmrC078267; Sat, 29 May 2021 06:21:48 GMT (envelope-from git) Date: Sat, 29 May 2021 06:21:48 GMT Message-Id: <202105290621.14T6LmrC078267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: aa462cab60c8 - main - linux: fix architecture returned for uname on aarch64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa462cab60c8957a97f612d36ac0a4dfa501bbbe 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, 29 May 2021 06:21:49 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=aa462cab60c8957a97f612d36ac0a4dfa501bbbe commit aa462cab60c8957a97f612d36ac0a4dfa501bbbe Author: Edward Tomasz Napierala AuthorDate: 2021-05-28 23:01:55 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-28 23:02:02 +0000 linux: fix architecture returned for uname on aarch64 Previously it would return "arm64", which was breaking build for Linux kernel. While here, reshuffle entries in the auxv vector to match real Linux. Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30500 --- sys/arm64/linux/linux_locore.asm | 2 +- sys/arm64/linux/linux_sysvec.c | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/arm64/linux/linux_locore.asm b/sys/arm64/linux/linux_locore.asm index 0383e6770954..5f0729b363e8 100644 --- a/sys/arm64/linux/linux_locore.asm +++ b/sys/arm64/linux/linux_locore.asm @@ -40,7 +40,7 @@ .globl linux_platform linux_platform: - .asciz "arm64" + .asciz "aarch64" .text diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index e20e0fd32b91..4db319cd96fd 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -172,11 +172,11 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) #if 0 /* LINUXTODO: implement arm64 LINUX_AT_HWCAP */ AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); #endif + AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz); AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz); AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY(pos, AT_PHENT, args->phent); AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum); - AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz); AUXARGS_ENTRY(pos, AT_BASE, args->base); AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); @@ -185,15 +185,14 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); AUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid); -#if 0 /* LINUXTODO: implement arm64 LINUX_AT_PLATFORM */ - AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); -#endif AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary); if (imgp->execpathp != 0) AUXARGS_ENTRY_PTR(pos, LINUX_AT_EXECFN, imgp->execpathp); if (args->execfd != -1) AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); + AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); AUXARGS_ENTRY(pos, AT_NULL, 0); + free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); @@ -464,13 +463,8 @@ linux_vdso_install(const void *param) linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; - printf("LINUXTODO: %s: fix linux_kplatform\n", __func__); -#if 0 linux_kplatform = linux_shared_page_mapping + (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); -#else - linux_kplatform = "arm64"; -#endif } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, linux_vdso_install, NULL); From owner-dev-commits-src-main@freebsd.org Sat May 29 08:03: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 203D563C164; Sat, 29 May 2021 08:03:07 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4FsYvZ4Vznz4R8l; Sat, 29 May 2021 08:03:06 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from [192.168.42.21] (cpc91232-cmbg18-2-0-cust554.5-4.cable.virginm.net [82.2.126.43]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 9FF114E6D9; Sat, 29 May 2021 08:02:58 +0000 (UTC) Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.20\)) Subject: Re: git: e779604f1d4e - main - Clean up early arm64 pmap code From: Andrew Turner X-Priority: 3 (Normal) In-Reply-To: <424236367.2001.1621851607455@localhost> Date: Sat, 29 May 2021 09:02:57 +0100 Cc: "dev-commits-src-all@freebsd.org" , "src-committers@freebsd.org" , "dev-commits-src-main@freebsd.org" Message-Id: <994489C4-45DA-49A9-ACC8-FF2CF04D2F4A@freebsd.org> References: <424236367.2001.1621851607455@localhost> To: Ronald Klop X-Mailer: Apple Mail (2.3445.104.20) X-Rspamd-Queue-Id: 4FsYvZ4Vznz4R8l X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:14061, ipnet:139.59.160.0/20, country:US] Content-Type: text/plain; charset=utf-8 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: Sat, 29 May 2021 08:03:07 -0000 Other than simplifying the code it also helps downstream in CheriBSD = where init_pt_va could be different sizes based on the kernel = configuration. Rather than changing the size of this variable it=E2=80=99s= easier to just ask the hardware to perform the translation. Andrew > On 24 May 2021, at 11:20, Ronald Klop wrote: >=20 > Hi, >=20 > Out of curiosity. What is the expected gain? (Next to simplicity of = the code of course.) >=20 > Ronald >=20 > Van: Andrew Turner > Datum: 24 mei 2021 11:44 > Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, = dev-commits-src-main@FreeBSD.org > Onderwerp: git: e779604f1d4e - main - Clean up early arm64 pmap code >=20 > The branch main has been updated by andrew: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3De779604f1d4e5fd0cdf3a9d1bb756b16= 8f97b39c = >=20 > commit e779604f1d4e5fd0cdf3a9d1bb756b168f97b39c > Author: Andrew Turner > AuthorDate: 2021-05-20 06:52:15 +0000 > Commit: Andrew Turner > CommitDate: 2021-05-24 09:22:19 +0000 >=20 > Clean up early arm64 pmap code > =20 > Early in the arm64 pmap code we need to translate between a = virtual > address and a physical address. Rather than manually walking the = page > table we can ask the hardware to do it for us. > =20 > Reviewed by: kib, markj > Sponsored by: Innovate UK > Differential Revision: https://reviews.freebsd.org/D30357 = > --- > sys/arm64/arm64/locore.S | 6 ------ > sys/arm64/arm64/pmap.c | 28 +++------------------------- > sys/arm64/include/vmparam.h | 1 - > 3 files changed, 3 insertions(+), 32 deletions(-) >=20 > diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S > index f5e6bbd604a5..472a052e9903 100644 > --- a/sys/arm64/arm64/locore.S > +++ b/sys/arm64/arm64/locore.S > @@ -735,10 +735,6 @@ ENTRY(abort) > b abort > END(abort) > =20 > - .align 3 > -init_pt_va: > - .quad pagetable /* XXX: Keep page tables VA */ > - > .section .init_pagetable, "aw", %nobits > .align PAGE_SHIFT > /* > @@ -773,8 +769,6 @@ pagetable_end: > el2_pagetable: > .space PAGE_SIZE > =20 > - .globl init_pt_va > - > .align 4 > initstack: > .space (PAGE_SIZE * KSTACK_PAGES) > diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c > index a3be232a56bf..bc5d228af5ad 100644 > --- a/sys/arm64/arm64/pmap.c > +++ b/sys/arm64/arm64/pmap.c > @@ -742,35 +742,13 @@ pmap_resident_count_dec(pmap_t pmap, int count) > pmap->pm_stats.resident_count -=3D count; > } > =20 > -static pt_entry_t * > -pmap_early_page_idx(vm_offset_t l1pt, vm_offset_t va, u_int *l1_slot, > - u_int *l2_slot) > -{ > - pt_entry_t *l2; > - pd_entry_t *l1; > - > - l1 =3D (pd_entry_t *)l1pt; > - *l1_slot =3D (va >> L1_SHIFT) & Ln_ADDR_MASK; > - > - /* Check locore has used a table L1 map */ > - KASSERT((l1[*l1_slot] & ATTR_DESCR_MASK) =3D=3D L1_TABLE, > - ("Invalid bootstrap L1 table")); > - /* Find the address of the L2 table */ > - l2 =3D (pt_entry_t *)init_pt_va; > - *l2_slot =3D pmap_l2_index(va); > - > - return (l2); > -} > - > static vm_paddr_t > pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va) > { > - u_int l1_slot, l2_slot; > - pt_entry_t *l2; > - > - l2 =3D pmap_early_page_idx(l1pt, va, &l1_slot, &l2_slot); > + vm_paddr_t pa_page; > =20 > - return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET)); > + pa_page =3D arm64_address_translate_s1e1r(va) & PAR_PA_MASK; > + return (pa_page | (va & PAR_LOW_MASK)); > } > =20 > static vm_offset_t > diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h > index 4a90c7711e01..a42c68d52887 100644 > --- a/sys/arm64/include/vmparam.h > +++ b/sys/arm64/include/vmparam.h > @@ -228,7 +228,6 @@ extern vm_paddr_t dmap_phys_base; > extern vm_paddr_t dmap_phys_max; > extern vm_offset_t dmap_max_addr; > extern vm_offset_t vm_max_kernel_address; > -extern vm_offset_t init_pt_va; > =20 > #endif > =20 > _______________________________________________ > 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" >=20 >=20 >=20 From owner-dev-commits-src-main@freebsd.org Sat May 29 08:26: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 054EA63C2D4; Sat, 29 May 2021 08:26: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 4FsZQd6XJ3z4TTm; Sat, 29 May 2021 08:26: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 BEF4D26FA8; Sat, 29 May 2021 08:26: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 14T8QXl7038761; Sat, 29 May 2021 08:26:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14T8QXqF038760; Sat, 29 May 2021 08:26:33 GMT (envelope-from git) Date: Sat, 29 May 2021 08:26:33 GMT Message-Id: <202105290826.14T8QXqF038760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: e0fa04e257c1 - main - cxgbe(4): Update firmwares to 1.25.6.0. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0fa04e257c1af4c793a70a124ba41e592570c14 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, 29 May 2021 08:26:34 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=e0fa04e257c1af4c793a70a124ba41e592570c14 commit e0fa04e257c1af4c793a70a124ba41e592570c14 Author: Navdeep Parhar AuthorDate: 2021-05-25 20:47:06 +0000 Commit: Navdeep Parhar CommitDate: 2021-05-29 08:00:20 +0000 cxgbe(4): Update firmwares to 1.25.6.0. Changes since 1.25.0.0 are listed here. This list comes from the Release Notes for the "Chelsio Unified Wire v3.14.0.3 for Linux" release dated 2021-05-21. Fixes ----- BASE: - Fixed Back to back T6 100G-CR4 link coming up with NO FEC sometimes. - [T5] Try to bring up link in 1G speed if link doesn't come up on 10G. - Fixed a bug to not allow BaseR fec in 100G speed. - Fixed linkup issues on BT adapter in 1G and 100M speed. - Fixed an issue to allow driver to send VI_ENABLE multiple times (once with rx disable and then later rx enable). - Fixed rate limiting not working on class number 16 to 30. - Fixed backward compatibility issue in port type interpretation with vpd version 0x80. ETH: - Fixed a case when firmware failed to deliver NIC WR completion to host. - No rate limit support for WR ETH_TX_PKTS2 due to performance reasons. OFLD - Fixed a connection hang in SO adapters when tp_plen_max (set by driver) is more than the window size. - Added fw_filter_vnic_mode to firmware API file (t4fw_interface.h) - Use correct rx channel in coprocessor crypto completion (CPL_FW6_PLD). This was causing out of order completion to host. FOiSCSI - Fixed a crash due to unaligned access of ipv6 address. - Fixed a crash during lun reset. Enhancements ------------ ETH: - Rate limiting support added for encapsulated (vxlan, nvgre, geneve) NIC TCP packets. OFLD: - More than 128 SGLs supported in FW_RI_FR_NSMR_WR. Now, more than 16GB (upto 64GB) of PBLs can be written with single FW_RI_FR_NSMR_WR. Obtained from: Chelsio Communications MFC after: 1 month Sponsored by: Chelsio Communications --- sys/conf/files | 6 +++--- sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin | Bin 569856 -> 0 bytes sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin | Bin 0 -> 570368 bytes sys/dev/cxgbe/firmware/t4fw_interface.h | 23 +++++++++++++---------- sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin | Bin 673792 -> 0 bytes sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin | Bin 0 -> 675840 bytes sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin | Bin 731648 -> 0 bytes sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin | Bin 0 -> 730112 bytes sys/modules/cxgbe/t4_firmware/Makefile | 2 +- sys/modules/cxgbe/t5_firmware/Makefile | 2 +- sys/modules/cxgbe/t6_firmware/Makefile | 2 +- 11 files changed, 19 insertions(+), 16 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index ab170244f9d0..d7e35b5f6c21 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1525,7 +1525,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.25.0.40.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.25.6.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1559,7 +1559,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule \ clean "t5fw.fwo" t5fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.25.0.40.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.25.6.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1593,7 +1593,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule \ clean "t6fw.fwo" t6fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.25.0.40.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.25.6.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" diff --git a/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin b/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin deleted file mode 100644 index 075478fdf040..000000000000 Binary files a/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin and /dev/null differ diff --git a/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin new file mode 100644 index 000000000000..45e805198f59 Binary files /dev/null and b/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h index 30a2e1760052..0f877cb5a045 100644 --- a/sys/dev/cxgbe/firmware/t4fw_interface.h +++ b/sys/dev/cxgbe/firmware/t4fw_interface.h @@ -4839,7 +4839,9 @@ enum fw_params_param_dev { FW_PARAMS_PARAM_DEV_TCB_CACHE_FLUSH = 0x2D, FW_PARAMS_PARAM_DEV_FILTER = 0x2E, FW_PARAMS_PARAM_DEV_CLIP2_CMD = 0x2F, + FW_PARAMS_PARAM_DEV_DEV_512SGL_MR = 0x30, FW_PARAMS_PARAM_DEV_KTLS_HW = 0x31, + FW_PARAMS_PARAM_DEV_VI_ENABLE_INGRESS_AFTER_LINKUP = 0x32, }; /* @@ -4874,11 +4876,12 @@ enum fw_params_param_dev_diag { enum fw_params_param_dev_filter{ FW_PARAM_DEV_FILTER_VNIC_MODE = 0x00, FW_PARAM_DEV_FILTER_MODE_MASK = 0x01, +}; - /* VNIC modes */ - FW_VNIC_MODE_PF_VF = 0, - FW_VNIC_MODE_OUTER_VLAN = 1, - FW_VNIC_MODE_ENCAP_EN = 2, +enum fw_filter_vnic_mode { + FW_VNIC_MODE_PF_VF = 0, + FW_VNIC_MODE_OUTER_VLAN = 1, + FW_VNIC_MODE_ENCAP_EN = 2, }; enum fw_params_param_dev_ktls_hw { @@ -9989,18 +9992,18 @@ enum fw_hdr_chip { enum { T4FW_VERSION_MAJOR = 1, T4FW_VERSION_MINOR = 25, - T4FW_VERSION_MICRO = 0, - T4FW_VERSION_BUILD = 40, + T4FW_VERSION_MICRO = 6, + T4FW_VERSION_BUILD = 0, T5FW_VERSION_MAJOR = 1, T5FW_VERSION_MINOR = 25, - T5FW_VERSION_MICRO = 0, - T5FW_VERSION_BUILD = 40, + T5FW_VERSION_MICRO = 6, + T5FW_VERSION_BUILD = 0, T6FW_VERSION_MAJOR = 1, T6FW_VERSION_MINOR = 25, - T6FW_VERSION_MICRO = 0, - T6FW_VERSION_BUILD = 40, + T6FW_VERSION_MICRO = 6, + T6FW_VERSION_BUILD = 0, }; enum { diff --git a/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin b/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin deleted file mode 100644 index 1d115d65a1ba..000000000000 Binary files a/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin and /dev/null differ diff --git a/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin new file mode 100644 index 000000000000..6c2d1374c87a Binary files /dev/null and b/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin b/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin deleted file mode 100644 index acddb1cf8bfd..000000000000 Binary files a/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin and /dev/null differ diff --git a/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin new file mode 100644 index 000000000000..1cf05565ffff Binary files /dev/null and b/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin differ diff --git a/sys/modules/cxgbe/t4_firmware/Makefile b/sys/modules/cxgbe/t4_firmware/Makefile index f5bc4830771b..48ac2766a560 100644 --- a/sys/modules/cxgbe/t4_firmware/Makefile +++ b/sys/modules/cxgbe/t4_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER= 1.25.0.40 +T4FW_VER= 1.25.6.0 FIRMWS+= t4fw-${T4FW_VER}.bin:t4fw:${T4FW_VER} .include diff --git a/sys/modules/cxgbe/t5_firmware/Makefile b/sys/modules/cxgbe/t5_firmware/Makefile index 89106cb4a497..3b54df8b222b 100644 --- a/sys/modules/cxgbe/t5_firmware/Makefile +++ b/sys/modules/cxgbe/t5_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T5FW_VER= 1.25.0.40 +T5FW_VER= 1.25.6.0 FIRMWS+= t5fw-${T5FW_VER}.bin:t5fw:${T5FW_VER} .include diff --git a/sys/modules/cxgbe/t6_firmware/Makefile b/sys/modules/cxgbe/t6_firmware/Makefile index 071db2bab2dc..e7b39839b5e4 100644 --- a/sys/modules/cxgbe/t6_firmware/Makefile +++ b/sys/modules/cxgbe/t6_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T6FW_VER= 1.25.0.40 +T6FW_VER= 1.25.6.0 FIRMWS+= t6fw-${T6FW_VER}.bin:t6fw:${T6FW_VER} .include From owner-dev-commits-src-main@freebsd.org Sat May 29 14:59: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 0494664222F; Sat, 29 May 2021 14:59: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 4Fsl886TX3z3QpW; Sat, 29 May 2021 14:59: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 C428A3BFD; Sat, 29 May 2021 14:59: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 14TExaKO056960; Sat, 29 May 2021 14:59:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TExadZ056959; Sat, 29 May 2021 14:59:36 GMT (envelope-from git) Date: Sat, 29 May 2021 14:59:36 GMT Message-Id: <202105291459.14TExadZ056959@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: d81f999ac223 - main - rtld direct exec: add option to ignore LD_ variables 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: d81f999ac22342789f2b3e21206d83d410be4df3 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, 29 May 2021 14:59:37 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d81f999ac22342789f2b3e21206d83d410be4df3 commit d81f999ac22342789f2b3e21206d83d410be4df3 Author: Konstantin Belousov AuthorDate: 2021-05-28 23:59:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-29 14:59:09 +0000 rtld direct exec: add option to ignore LD_ variables Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/rtld.1 | 10 +++++++++- libexec/rtld-elf/rtld.c | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 index 7f633ce0b486..16466c7a853e 100644 --- a/libexec/rtld-elf/rtld.1 +++ b/libexec/rtld-elf/rtld.1 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 24, 2021 +.Dd May 29, 2021 .Dt RTLD 1 .Os .Sh NAME @@ -131,6 +131,7 @@ all the environment variables listed below, but is being prefixed with .Ev LD_32_ , for example: .Ev LD_32_TRACE_LOADED_OBJECTS . +If the activated image is setuid or setgid, the variables are ignored. .Bl -tag -width ".Ev LD_LIBMAP_DISABLE" .It Ev LD_DUMP_REL_POST If set, @@ -313,6 +314,8 @@ The syntax of the direct invocation is .Op Fl b Ar exe .Op Fl f Ar fd .Op Fl p +.Op Fl t +.Op Fl v .Op Fl - .Pa image_path .Op Ar image arguments @@ -353,6 +356,11 @@ character, uses the search path provided by the environment variable .Dv PATH to find the binary to execute. +.It Fl t +Ignore all +.Ev LD_ +environment variables that otherwise affect the dynamic +linker behavior. .It Fl v Display information about this run-time linker binary, then exit. .It Fl - diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 75c502e8cc85..a517de83b8f5 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -5793,6 +5793,8 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, break; } else if (opt == 'p') { *use_pathp = true; + } else if (opt == 't') { + trust = false; } else if (opt == 'v') { machine[0] = '\0'; mib[0] = CTL_HW; @@ -5863,6 +5865,7 @@ print_usage(const char *argv0) " -b Execute instead of , arg0 is \n" " -f Execute instead of searching for \n" " -p Search in PATH for named binary\n" + " -t Ignore LD_ environment variables\n" " -v Display identification information\n" " -- End of RTLD options\n" " Name of process to execute\n" From owner-dev-commits-src-main@freebsd.org Sat May 29 17:52: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 605B3645603; Sat, 29 May 2021 17:52: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 4Fspzc2GYnz3vnp; Sat, 29 May 2021 17:52: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 36C3B69AE; Sat, 29 May 2021 17:52: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 14THqSXU094335; Sat, 29 May 2021 17:52:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14THqSna094332; Sat, 29 May 2021 17:52:28 GMT (envelope-from git) Date: Sat, 29 May 2021 17:52:28 GMT Message-Id: <202105291752.14THqSna094332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 83043a741d11 - main - linux: deduplicate DUMMY() entries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 83043a741d114d7fd4a018e9c70330036ae44f81 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, 29 May 2021 17:52:28 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=83043a741d114d7fd4a018e9c70330036ae44f81 commit 83043a741d114d7fd4a018e9c70330036ae44f81 Author: Edward Tomasz Napierala AuthorDate: 2021-05-29 06:32:50 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-29 17:51:36 +0000 linux: deduplicate DUMMY() entries No functional changes. Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30524 --- sys/arm64/linux/linux_dummy_machdep.c | 7 ------- sys/compat/linux/linux_dummy.c | 10 ++++++++++ sys/x86/linux/linux_dummy_x86.c | 10 ---------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/sys/arm64/linux/linux_dummy_machdep.c b/sys/arm64/linux/linux_dummy_machdep.c index 47b6ac093cb1..4bd339de4af5 100644 --- a/sys/arm64/linux/linux_dummy_machdep.c +++ b/sys/arm64/linux/linux_dummy_machdep.c @@ -61,11 +61,4 @@ DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); DUMMY(semtimedop); -DUMMY(statx); -DUMMY(io_pgetevents); DUMMY(kexec_file_load); -DUMMY(rseq); -DUMMY(pidfd_send_signal); -DUMMY(io_uring_setup); -DUMMY(io_uring_enter); -DUMMY(io_uring_register); diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c index 5f174d0e4994..fef09809822b 100644 --- a/sys/compat/linux/linux_dummy.c +++ b/sys/compat/linux/linux_dummy.c @@ -147,6 +147,16 @@ DUMMY(faccessat2); DUMMY(process_madvise); DUMMY(epoll_pwait2); DUMMY(mount_setattr); +/* Linux 4.11: */ +DUMMY(statx); +/* Linux 4.18: */ +DUMMY(io_pgetevents); +DUMMY(rseq); +/* Linux 5.0: */ +DUMMY(pidfd_send_signal); +DUMMY(io_uring_setup); +DUMMY(io_uring_enter); +DUMMY(io_uring_register); #define DUMMY_XATTR(s) \ int \ diff --git a/sys/x86/linux/linux_dummy_x86.c b/sys/x86/linux/linux_dummy_x86.c index 1defe4e9674e..d6a1ce38da48 100644 --- a/sys/x86/linux/linux_dummy_x86.c +++ b/sys/x86/linux/linux_dummy_x86.c @@ -57,13 +57,3 @@ DUMMY(quotactl); DUMMY(inotify_init); /* Linux 2.6.22: */ DUMMY(signalfd); -/* Linux 4.11: */ -DUMMY(statx); -/* Linux 4.18: */ -DUMMY(io_pgetevents); -DUMMY(rseq); -/* Linux 5.0: */ -DUMMY(pidfd_send_signal); -DUMMY(io_uring_setup); -DUMMY(io_uring_enter); -DUMMY(io_uring_register); From owner-dev-commits-src-main@freebsd.org Sat May 29 20:15: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 62898647019; Sat, 29 May 2021 20:15: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 4Fst88246gz4YDF; Sat, 29 May 2021 20:15: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 2ADB310A89; Sat, 29 May 2021 20:15: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 14TKF4V8080509; Sat, 29 May 2021 20:15:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TKF4Tu080508; Sat, 29 May 2021 20:15:04 GMT (envelope-from git) Date: Sat, 29 May 2021 20:15:04 GMT Message-Id: <202105292015.14TKF4Tu080508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 09947faee84b - main - Apply r350335(5d18382b728) to powerpc64 radix pmap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 09947faee84b84f8126fd9dcf30ea8fd9a0cae92 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, 29 May 2021 20:15:04 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=09947faee84b84f8126fd9dcf30ea8fd9a0cae92 commit 09947faee84b84f8126fd9dcf30ea8fd9a0cae92 Author: Justin Hibbits AuthorDate: 2021-05-09 16:07:28 +0000 Commit: Justin Hibbits CommitDate: 2021-05-29 20:14:32 +0000 Apply r350335(5d18382b728) to powerpc64 radix pmap Simplify pmap_clear_modify() a bit, by assuming that since the superpage demotion succeeded, all 4k mappings from it are valid. Deindent the surrounding code, as there are no 'else' branches in the code anyway. --- sys/powerpc/aim/mmu_radix.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 8f38b57e7852..e86bfa94c7ae 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -2433,28 +2433,24 @@ restart: va = pv->pv_va; l3e = pmap_pml3e(pmap, va); oldl3e = be64toh(*l3e); - if ((oldl3e & PG_RW) != 0) { - if (pmap_demote_l3e_locked(pmap, l3e, va, &lock)) { - if ((oldl3e & PG_W) == 0) { - /* - * Write protect the mapping to a - * single page so that a subsequent - * write access may repromote. - */ - va += VM_PAGE_TO_PHYS(m) - (oldl3e & - PG_PS_FRAME); - pte = pmap_l3e_to_pte(l3e, va); - oldpte = be64toh(*pte); - if ((oldpte & PG_V) != 0) { - while (!atomic_cmpset_long(pte, - htobe64(oldpte), - htobe64((oldpte | RPTE_EAA_R) & ~(PG_M | PG_RW)))) - oldpte = be64toh(*pte); - vm_page_dirty(m); - pmap_invalidate_page(pmap, va); - } - } - } + if ((oldl3e & PG_RW) != 0 && + pmap_demote_l3e_locked(pmap, l3e, va, &lock) && + (oldl3e & PG_W) == 0) { + /* + * Write protect the mapping to a + * single page so that a subsequent + * write access may repromote. + */ + va += VM_PAGE_TO_PHYS(m) - (oldl3e & + PG_PS_FRAME); + pte = pmap_l3e_to_pte(l3e, va); + oldpte = be64toh(*pte); + while (!atomic_cmpset_long(pte, + htobe64(oldpte), + htobe64((oldpte | RPTE_EAA_R) & ~(PG_M | PG_RW)))) + oldpte = be64toh(*pte); + vm_page_dirty(m); + pmap_invalidate_page(pmap, va); } PMAP_UNLOCK(pmap); } From owner-dev-commits-src-main@freebsd.org Sat May 29 20:15: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 395D2646E37; Sat, 29 May 2021 20:15: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 4Fst870wF8z4Y9V; Sat, 29 May 2021 20:15: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 08F5E107BB; Sat, 29 May 2021 20:15: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 14TKF2TC080488; Sat, 29 May 2021 20:15:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TKF21L080487; Sat, 29 May 2021 20:15:02 GMT (envelope-from git) Date: Sat, 29 May 2021 20:15:02 GMT Message-Id: <202105292015.14TKF21L080487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: b40538683ac2 - main - Apply r355991(50079417a5c28caeca3f423b981047db76e8f5cb) to powerpc64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b40538683ac2486431ae9e6039124387cea3097f 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, 29 May 2021 20:15:03 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=b40538683ac2486431ae9e6039124387cea3097f commit b40538683ac2486431ae9e6039124387cea3097f Author: Justin Hibbits AuthorDate: 2021-05-29 20:14:26 +0000 Commit: Justin Hibbits CommitDate: 2021-05-29 20:14:26 +0000 Apply r355991(50079417a5c28caeca3f423b981047db76e8f5cb) to powerpc64 Micro-optimize control flow in _pmap_unwire_ptp(), and eliminate unnecessary parentheses. --- sys/powerpc/aim/mmu_radix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 6ab2edf17dd9..8f38b57e7852 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -4722,7 +4722,7 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free) /* * unmap the page table page */ - if (m->pindex >= (NUPDE + NUPDPE)) { + if (m->pindex >= NUPDE + NUPDPE) { /* PDP page */ pml1_entry_t *pml1; pml1 = pmap_pml1e(pmap, va); @@ -4746,7 +4746,7 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free) pdpg = PHYS_TO_VM_PAGE(be64toh(*pmap_pml2e(pmap, va)) & PG_FRAME); pmap_unwire_ptp(pmap, va, pdpg, free); } - if (m->pindex >= NUPDE && m->pindex < (NUPDE + NUPDPE)) { + else if (m->pindex >= NUPDE && m->pindex < (NUPDE + NUPDPE)) { /* We just released a PD, unhold the matching PDP */ vm_page_t pdppg; From owner-dev-commits-src-main@freebsd.org Sat May 29 20:15: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 B73F96471D5; Sat, 29 May 2021 20:15: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 4Fst894dnyz4Y2X; Sat, 29 May 2021 20:15: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 4B49E107BC; Sat, 29 May 2021 20:15: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 14TKF5qW080530; Sat, 29 May 2021 20:15:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TKF5m8080529; Sat, 29 May 2021 20:15:05 GMT (envelope-from git) Date: Sat, 29 May 2021 20:15:05 GMT Message-Id: <202105292015.14TKF5m8080529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 811e645d286d - main - Apply r350463(43ded0a321a) to powerpc64 radix pmap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 811e645d286d0b97c02d1b66a59a76c327d46c35 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, 29 May 2021 20:15:05 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=811e645d286d0b97c02d1b66a59a76c327d46c35 commit 811e645d286d0b97c02d1b66a59a76c327d46c35 Author: Justin Hibbits AuthorDate: 2021-05-10 00:19:07 +0000 Commit: Justin Hibbits CommitDate: 2021-05-29 20:14:33 +0000 Apply r350463(43ded0a321a) to powerpc64 radix pmap Invalidate the last page of a demoted superpage mapping, instead of the first page, as it results in slightly more promotions and fewer failures. While here, replace 'boolean_t's with 'bool's in mmu_radix_advise(). --- sys/powerpc/aim/mmu_radix.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index e86bfa94c7ae..83eda03f9556 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -2207,11 +2207,11 @@ mmu_radix_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t *pte; vm_offset_t va, va_next; vm_page_t m; - boolean_t anychanged; + bool anychanged; if (advice != MADV_DONTNEED && advice != MADV_FREE) return; - anychanged = FALSE; + anychanged = false; PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { l1e = pmap_pml1e(pmap, sva); @@ -2252,17 +2252,25 @@ mmu_radix_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, /* * Unless the page mappings are wired, remove the * mapping to a single page so that a subsequent - * access may repromote. Since the underlying page - * table page is fully populated, this removal never - * frees a page table page. + * access may repromote. Choosing the last page + * within the address range [sva, min(va_next, eva)) + * generally results in more repromotions. Since the + * underlying page table page is fully populated, this + * removal never frees a page table page. */ if ((oldl3e & PG_W) == 0) { - pte = pmap_l3e_to_pte(l3e, sva); + va = eva; + if (va > va_next) + va = va_next; + va -= PAGE_SIZE; + KASSERT(va >= sva, + ("mmu_radix_advise: no address gap")); + pte = pmap_l3e_to_pte(l3e, va); KASSERT((be64toh(*pte) & PG_V) != 0, ("pmap_advise: invalid PTE")); - pmap_remove_pte(pmap, pte, sva, be64toh(*l3e), NULL, + pmap_remove_pte(pmap, pte, va, be64toh(*l3e), NULL, &lock); - anychanged = TRUE; + anychanged = true; } if (lock != NULL) rw_wunlock(lock); @@ -2291,7 +2299,7 @@ mmu_radix_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, atomic_clear_long(pte, htobe64(PG_A)); else goto maybe_invlrng; - anychanged = TRUE; + anychanged = true; continue; maybe_invlrng: if (va != va_next) { From owner-dev-commits-src-main@freebsd.org Sat May 29 21:04: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 E2B90647F30; Sat, 29 May 2021 21:04: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 4FsvFW62Ykz4cnC; Sat, 29 May 2021 21:04: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 B741011511; Sat, 29 May 2021 21:04: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 14TL4lX1047010; Sat, 29 May 2021 21:04:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TL4lZU047009; Sat, 29 May 2021 21:04:47 GMT (envelope-from git) Date: Sat, 29 May 2021 21:04:47 GMT Message-Id: <202105292104.14TL4lZU047009@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: 6d3e78ad6c11 - main - VFS_QUOTACTL(9): allow implementation to indicate busy state changes 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: 6d3e78ad6c11849ad3d36feeb10c412c93b56073 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, 29 May 2021 21:04:48 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=6d3e78ad6c11849ad3d36feeb10c412c93b56073 commit 6d3e78ad6c11849ad3d36feeb10c412c93b56073 Author: Jason A. Harmening AuthorDate: 2021-05-11 15:54:58 +0000 Commit: Jason A. Harmening CommitDate: 2021-05-29 21:05:39 +0000 VFS_QUOTACTL(9): allow implementation to indicate busy state changes Instead of requiring all implementations of vfs_quotactl to unbusy the mount for Q_QUOTAON and Q_QUOTAOFF, add an "mp_busy" in/out param to VFS_QUOTACTL(9). The implementation may then indicate to the caller whether it needed to unbusy the mount. Reviewed By: kib, markj Differential Revision: https://reviews.freebsd.org/D30218 --- share/man/man9/VFS_QUOTACTL.9 | 32 ++++++++++++++++++++-- .../openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 15 ++++++++++ sys/fs/nullfs/null_vfsops.c | 30 ++++++++++++++++++-- sys/fs/smbfs/smbfs_vfsops.c | 3 +- sys/fs/unionfs/union_vfsops.c | 28 +++++++++++++++++-- sys/kern/vfs_default.c | 4 +-- sys/kern/vfs_init.c | 6 ++-- sys/kern/vfs_syscalls.c | 19 ++++++------- sys/sys/mount.h | 7 +++-- sys/sys/param.h | 2 +- sys/ufs/ufs/quota.h | 2 +- sys/ufs/ufs/ufs_quota.c | 21 ++++++-------- sys/ufs/ufs/ufs_vfsops.c | 19 +++++-------- 13 files changed, 135 insertions(+), 53 deletions(-) diff --git a/share/man/man9/VFS_QUOTACTL.9 b/share/man/man9/VFS_QUOTACTL.9 index 8d0cb113ce1e..210f71631353 100644 --- a/share/man/man9/VFS_QUOTACTL.9 +++ b/share/man/man9/VFS_QUOTACTL.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2020 +.Dd May 29, 2021 .Dt VFS_QUOTACTL 9 .Os .Sh NAME @@ -39,12 +39,38 @@ .In sys/mount.h .In sys/vnode.h .Ft int -.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "void *arg" +.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "void *arg" "bool *mp_busy" .Sh DESCRIPTION Implement file system quotas. +.Pp +The +.Fa mp_busy +argument is an input/output parameter. +.Fn VFS_QUOTACTL +must be called with +.Fa mp +marked busy through +.Xr vfs_busy 9 +and +.Fa *mp_busy +set to true. +The filesystem implementation of +.Fn VFS_QUOTACTL +may then unbusy +.Fa mp +using +.Xr vfs_unbusy 9 +prior to performing quota file I/O. +In this case the implementation must set +.Fa *mp_busy +to false to indicate that the caller must not unbusy +.Fa mp +upon completion of +.Fn VFS_QUOTACTL . +.Pp See .Xr quotactl 2 -for a description of the arguments. +for a description of the remaining arguments. .Sh SEE ALSO .Xr quotactl 2 , .Xr vnode 9 diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index a537342f9678..4f2d7df87fc0 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -102,7 +102,12 @@ SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0, "ZPL_VERSION"); /* END CSTYLED */ +#if __FreeBSD_version >= 1400018 +static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, + bool *mp_busy); +#else static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg); +#endif static int zfs_mount(vfs_t *vfsp); static int zfs_umount(vfs_t *vfsp, int fflag); static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); @@ -267,7 +272,11 @@ done: } static int +#if __FreeBSD_version >= 1400018 +zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, bool *mp_busy) +#else zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) +#endif { zfsvfs_t *zfsvfs = vfsp->vfs_data; struct thread *td; @@ -291,8 +300,10 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) break; default: error = EINVAL; +#if __FreeBSD_version < 1400018 if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) vfs_unbusy(vfsp); +#endif goto done; } } @@ -351,11 +362,15 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) case Q_QUOTAON: // As far as I can tell, you can't turn quotas on or off on zfs error = 0; +#if __FreeBSD_version < 1400018 vfs_unbusy(vfsp); +#endif break; case Q_QUOTAOFF: error = ENOTSUP; +#if __FreeBSD_version < 1400018 vfs_unbusy(vfsp); +#endif break; case Q_SETQUOTA: error = copyin(arg, &dqblk, sizeof (dqblk)); diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 0bb98072edf4..0ad2385116a9 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -294,13 +294,39 @@ nullfs_root(mp, flags, vpp) } static int -nullfs_quotactl(mp, cmd, uid, arg) +nullfs_quotactl(mp, cmd, uid, arg, mp_busy) struct mount *mp; int cmd; uid_t uid; void *arg; + bool *mp_busy; { - return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg); + struct mount *lowermp; + struct null_mount *mntdata; + int error; + bool unbusy; + + mntdata = MOUNTTONULLMOUNT(mp); + lowermp = atomic_load_ptr(&mntdata->nullm_vfs); + KASSERT(*mp_busy == true, ("upper mount not busy")); + /* + * See comment in sys_quotactl() for an explanation of why the + * lower mount needs to be busied by the caller of VFS_QUOTACTL() + * but may be unbusied by the implementation. We must unbusy + * the upper mount for the same reason; otherwise a namei lookup + * issued by the VFS_QUOTACTL() implementation could traverse the + * upper mount and deadlock. + */ + vfs_unbusy(mp); + *mp_busy = false; + unbusy = true; + error = vfs_busy(lowermp, 0); + if (error == 0) + error = VFS_QUOTACTL(lowermp, cmd, uid, arg, &unbusy); + if (unbusy) + vfs_unbusy(lowermp); + + return (error); } static int diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index d19816a7869c..a1ae565c6341 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -352,11 +352,12 @@ out: */ /* ARGSUSED */ static int -smbfs_quotactl(mp, cmd, uid, arg) +smbfs_quotactl(mp, cmd, uid, arg, mp_busy) struct mount *mp; int cmd; uid_t uid; void *arg; + bool *mp_busy; { SMBVDEBUG("return EOPNOTSUPP\n"); return EOPNOTSUPP; diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index ae95bd9c005c..bd264c7bcdb5 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -371,16 +371,38 @@ unionfs_root(struct mount *mp, int flags, struct vnode **vpp) } static int -unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg) +unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg, + bool *mp_busy) { + struct mount *uppermp; struct unionfs_mount *ump; + int error; + bool unbusy; ump = MOUNTTOUNIONFSMOUNT(mp); - + uppermp = atomic_load_ptr(&ump->um_uppervp->v_mount); + KASSERT(*mp_busy == true, ("upper mount not busy")); + /* + * See comment in sys_quotactl() for an explanation of why the + * lower mount needs to be busied by the caller of VFS_QUOTACTL() + * but may be unbusied by the implementation. We must unbusy + * the upper mount for the same reason; otherwise a namei lookup + * issued by the VFS_QUOTACTL() implementation could traverse the + * upper mount and deadlock. + */ + vfs_unbusy(mp); + *mp_busy = false; + unbusy = true; + error = vfs_busy(uppermp, 0); /* * Writing is always performed to upper vnode. */ - return (VFS_QUOTACTL(ump->um_uppervp->v_mount, cmd, uid, arg)); + if (error == 0) + error = VFS_QUOTACTL(uppermp, cmd, uid, arg, &unbusy); + if (unbusy) + vfs_unbusy(uppermp); + + return (error); } static int diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index ace9ad1d37c3..63bca7810847 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1350,13 +1350,13 @@ vfs_stdstatfs (mp, sbp) } int -vfs_stdquotactl (mp, cmds, uid, arg) +vfs_stdquotactl (mp, cmds, uid, arg, mp_busy) struct mount *mp; int cmds; uid_t uid; void *arg; + bool *mp_busy; { - return (EOPNOTSUPP); } diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 3365ddb11474..112b4c76e575 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -212,12 +212,14 @@ vfs_cachedroot_sigdefer(struct mount *mp, int flags, struct vnode **vpp) } static int -vfs_quotactl_sigdefer(struct mount *mp, int cmd, uid_t uid, void *arg) +vfs_quotactl_sigdefer(struct mount *mp, int cmd, uid_t uid, void *arg, + bool *mp_busy) { int prev_stops, rc; prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); - rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_quotactl)(mp, cmd, uid, arg); + rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_quotactl)(mp, cmd, uid, arg, + mp_busy); sigallowstop(prev_stops); return (rc); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 55780b0474ee..2f4a6036ef88 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -89,8 +89,6 @@ __FBSDID("$FreeBSD$"); #include -#include - MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); static int kern_chflagsat(struct thread *td, int fd, const char *path, @@ -195,6 +193,7 @@ sys_quotactl(struct thread *td, struct quotactl_args *uap) struct mount *mp; struct nameidata nd; int error; + bool mp_busy; AUDIT_ARG_CMD(uap->cmd); AUDIT_ARG_UID(uap->uid); @@ -213,21 +212,21 @@ sys_quotactl(struct thread *td, struct quotactl_args *uap) vfs_rel(mp); return (error); } - error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg); + mp_busy = true; + error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg, &mp_busy); /* - * Since quota on operation typically needs to open quota - * file, the Q_QUOTAON handler needs to unbusy the mount point + * Since quota on/off operations typically need to open quota + * files, the implementation may need to unbusy the mount point * before calling into namei. Otherwise, unmount might be - * started between two vfs_busy() invocations (first is our, + * started between two vfs_busy() invocations (first is ours, * second is from mount point cross-walk code in lookup()), * causing deadlock. * - * Require that Q_QUOTAON handles the vfs_busy() reference on - * its own, always returning with ubusied mount point. + * Avoid unbusying mp if the implementation indicates it has + * already done so. */ - if ((uap->cmd >> SUBCMDSHIFT) != Q_QUOTAON && - (uap->cmd >> SUBCMDSHIFT) != Q_QUOTAOFF) + if (mp_busy) vfs_unbusy(mp); vfs_rel(mp); return (error); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index a1d4bfd15ddb..684d8c3eb780 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -759,7 +759,8 @@ struct mntarg; typedef int vfs_cmount_t(struct mntarg *ma, void *data, uint64_t flags); typedef int vfs_unmount_t(struct mount *mp, int mntflags); typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp); -typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg); +typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg, + bool *mp_busy); typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp); typedef int vfs_sync_t(struct mount *mp, int waitfor); typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags, @@ -832,10 +833,10 @@ vfs_statfs_t __vfs_statfs; _rc = (*(MP)->mnt_op->vfs_cachedroot)(MP, FLAGS, VPP); \ _rc; }) -#define VFS_QUOTACTL(MP, C, U, A) ({ \ +#define VFS_QUOTACTL(MP, C, U, A, MP_BUSY) ({ \ int _rc; \ \ - _rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A); \ + _rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, MP_BUSY); \ _rc; }) #define VFS_STATFS(MP, SBP) ({ \ diff --git a/sys/sys/param.h b/sys/sys/param.h index 959f0b94ca70..c63452973daf 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400017 +#define __FreeBSD_version 1400018 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/ufs/ufs/quota.h b/sys/ufs/ufs/quota.h index e154f8234705..eb3db9c300d0 100644 --- a/sys/ufs/ufs/quota.h +++ b/sys/ufs/ufs/quota.h @@ -232,7 +232,7 @@ int getinoquota(struct inode *); int qsync(struct mount *); int qsyncvp(struct vnode *); int quotaoff(struct thread *, struct mount *, int); -int quotaon(struct thread *, struct mount *, int, void *); +int quotaon(struct thread *, struct mount *, int, void *, bool *); int getquota32(struct thread *, struct mount *, u_long, int, void *); int setquota32(struct thread *, struct mount *, u_long, int, void *); int setuse32(struct thread *, struct mount *, u_long, int, void *); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 4dff74f75945..143e0afbf1e3 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -492,7 +492,8 @@ chkdquot(struct inode *ip) * Q_QUOTAON - set up a quota file for a particular filesystem. */ int -quotaon(struct thread *td, struct mount *mp, int type, void *fname) +quotaon(struct thread *td, struct mount *mp, int type, void *fname, + bool *mp_busy) { struct ufsmount *ump; struct vnode *vp, **vpp; @@ -502,15 +503,11 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) struct nameidata nd; error = priv_check(td, PRIV_UFS_QUOTAON); - if (error != 0) { - vfs_unbusy(mp); + if (error != 0) return (error); - } - if ((mp->mnt_flag & MNT_RDONLY) != 0) { - vfs_unbusy(mp); + if ((mp->mnt_flag & MNT_RDONLY) != 0) return (EROFS); - } ump = VFSTOUFS(mp); dq = NODQUOT; @@ -518,7 +515,9 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, td); flags = FREAD | FWRITE; vfs_ref(mp); + KASSERT(*mp_busy, ("%s called without busied mount", __func__)); vfs_unbusy(mp); + *mp_busy = false; error = vn_open(&nd, &flags, 0, NULL); if (error != 0) { vfs_rel(mp); @@ -529,10 +528,9 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) error = vfs_busy(mp, MBF_NOWAIT); vfs_rel(mp); if (error == 0) { - if (vp->v_type != VREG) { + *mp_busy = true; + if (vp->v_type != VREG) error = EACCES; - vfs_unbusy(mp); - } } if (error != 0) { VOP_UNLOCK(vp); @@ -545,7 +543,6 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) UFS_UNLOCK(ump); VOP_UNLOCK(vp); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); - vfs_unbusy(mp); return (EALREADY); } ump->um_qflags[type] |= QTF_OPENING|QTF_CLOSING; @@ -556,7 +553,6 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) ump->um_qflags[type] &= ~(QTF_OPENING|QTF_CLOSING); UFS_UNLOCK(ump); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); - vfs_unbusy(mp); return (error); } VOP_UNLOCK(vp); @@ -640,7 +636,6 @@ again: ("quotaon: leaking flags")); UFS_UNLOCK(ump); - vfs_unbusy(mp); return (error); } diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index 0f45baed634f..33ef7bc2c3d1 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -87,17 +87,14 @@ ufs_root(mp, flags, vpp) * Do operations associated with quotas */ int -ufs_quotactl(mp, cmds, id, arg) +ufs_quotactl(mp, cmds, id, arg, mp_busy) struct mount *mp; int cmds; uid_t id; void *arg; + bool *mp_busy; { #ifndef QUOTA - if ((cmds >> SUBCMDSHIFT) == Q_QUOTAON || - (cmds >> SUBCMDSHIFT) == Q_QUOTAOFF) - vfs_unbusy(mp); - return (EOPNOTSUPP); #else struct thread *td; @@ -117,25 +114,23 @@ ufs_quotactl(mp, cmds, id, arg) break; default: - if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) - vfs_unbusy(mp); return (EINVAL); } } - if ((u_int)type >= MAXQUOTAS) { - if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) - vfs_unbusy(mp); + if ((u_int)type >= MAXQUOTAS) return (EINVAL); - } switch (cmd) { case Q_QUOTAON: - error = quotaon(td, mp, type, arg); + error = quotaon(td, mp, type, arg, mp_busy); break; case Q_QUOTAOFF: vfs_ref(mp); + KASSERT(*mp_busy, + ("%s called without busied mount", __func__)); vfs_unbusy(mp); + *mp_busy = false; vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); error = quotaoff(td, mp, type); vn_finished_write(mp); From owner-dev-commits-src-main@freebsd.org Sat May 29 21:42: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 A8CBA6480F4; Sat, 29 May 2021 21:42: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 4Fsw4b4SYmz4fmb; Sat, 29 May 2021 21:42: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 81B1F11E04; Sat, 29 May 2021 21:42: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 14TLg70x096257; Sat, 29 May 2021 21:42:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TLg7ol096256; Sat, 29 May 2021 21:42:07 GMT (envelope-from git) Date: Sat, 29 May 2021 21:42:07 GMT Message-Id: <202105292142.14TLg7ol096256@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: 54256e7954d7 - main - Fix userspace build after commit 6d3e78ad6c11 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: 54256e7954d7efeee53bd1ab4d08d0c772b55f4d 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, 29 May 2021 21:42:07 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=54256e7954d7efeee53bd1ab4d08d0c772b55f4d commit 54256e7954d7efeee53bd1ab4d08d0c772b55f4d Author: Jason A. Harmening AuthorDate: 2021-05-29 21:45:09 +0000 Commit: Jason A. Harmening CommitDate: 2021-05-29 21:45:42 +0000 Fix userspace build after commit 6d3e78ad6c11 Reported by: jenkins --- sys/sys/mount.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 684d8c3eb780..6c1cd82ee84f 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -43,6 +43,8 @@ #include #include #include +#else +#include #endif /* From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04: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 4286A648B4C; Sat, 29 May 2021 22:04: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 4FswZ817KRz4hKX; Sat, 29 May 2021 22:04:16 +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 0EEFA11FAD; Sat, 29 May 2021 22:04: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 14TM4FYr026145; Sat, 29 May 2021 22:04:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4FDQ026144; Sat, 29 May 2021 22:04:15 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:15 GMT Message-Id: <202105292204.14TM4FDQ026144@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: 528f8f38953d - main - proc: add PROC_WAIT_UNLOCKED 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: 528f8f38953d92aa917cbe70d3c72d89440624ca 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, 29 May 2021 22:04:16 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=528f8f38953d92aa917cbe70d3c72d89440624ca commit 528f8f38953d92aa917cbe70d3c72d89440624ca Author: Mateusz Guzik AuthorDate: 2021-05-27 14:29:14 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:09 +0000 proc: add PROC_WAIT_UNLOCKED --- sys/sys/proc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 8098bb9468ec..2630c2b5a1d0 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -913,6 +913,7 @@ extern pid_t pid_max; #define PROC_TRYLOCK(p) mtx_trylock(&(p)->p_mtx) #define PROC_UNLOCK(p) mtx_unlock(&(p)->p_mtx) #define PROC_LOCKED(p) mtx_owned(&(p)->p_mtx) +#define PROC_WAIT_UNLOCKED(p) mtx_wait_unlocked(&(p)->p_mtx) #define PROC_LOCK_ASSERT(p, type) mtx_assert(&(p)->p_mtx, (type)) /* Lock and unlock a process group. */ From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04: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 67FED648AC6; Sat, 29 May 2021 22:04: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 4FswZ926Czz4hMc; Sat, 29 May 2021 22:04: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 30221120E9; Sat, 29 May 2021 22:04: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 14TM4HHr026166; Sat, 29 May 2021 22:04:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4HSc026165; Sat, 29 May 2021 22:04:17 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:17 GMT Message-Id: <202105292204.14TM4HSc026165@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: 9bfddb3ac4ce - main - fd: use PROC_WAIT_UNLOCKED when clearing p_fd/p_pd 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: 9bfddb3ac4ce8a2fbd5bb212a263747343a931e7 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, 29 May 2021 22:04:17 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=9bfddb3ac4ce8a2fbd5bb212a263747343a931e7 commit 9bfddb3ac4ce8a2fbd5bb212a263747343a931e7 Author: Mateusz Guzik AuthorDate: 2021-05-27 14:29:26 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:09 +0000 fd: use PROC_WAIT_UNLOCKED when clearing p_fd/p_pd --- sys/kern/kern_descrip.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 09eb0770bcda..36092c9acd42 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2198,13 +2198,28 @@ pdinit(struct pwddesc *pdp, bool keeplock) return (newpdp); } +/* + * Hold either filedesc or pwddesc of the passed process. + * + * The process lock is used to synchronize against the target exiting and + * freeing the data. + * + * Clearing can be ilustrated in 3 steps: + * 1. set the pointer to NULL. Either routine can race against it, hence + * atomic_load_ptr. + * 2. observe the process lock as not taken. Until then fdhold/pdhold can + * race to either still see the pointer or find NULL. It is still safe to + * grab a reference as clearing is stalled. + * 3. after the lock is observed as not taken, any fdhold/pdhold calls are + * guaranteed to see NULL, making it safe to finish clearing + */ static struct filedesc * fdhold(struct proc *p) { struct filedesc *fdp; PROC_LOCK_ASSERT(p, MA_OWNED); - fdp = p->p_fd; + fdp = atomic_load_ptr(&p->p_fd); if (fdp != NULL) refcount_acquire(&fdp->fd_holdcnt); return (fdp); @@ -2216,7 +2231,7 @@ pdhold(struct proc *p) struct pwddesc *pdp; PROC_LOCK_ASSERT(p, MA_OWNED); - pdp = p->p_pd; + pdp = atomic_load_ptr(&p->p_pd); if (pdp != NULL) refcount_acquire(&pdp->pd_refcount); return (pdp); @@ -2582,9 +2597,12 @@ fdescfree(struct thread *td) if (p->p_fdtol != NULL) fdclearlocks(td); - PROC_LOCK(p); - p->p_fd = NULL; - PROC_UNLOCK(p); + /* + * Check fdhold for an explanation. + */ + atomic_store_ptr(&p->p_fd, NULL); + atomic_thread_fence_seq_cst(); + PROC_WAIT_UNLOCKED(p); if (refcount_release(&fdp->fd_refcnt) == 0) return; @@ -2602,9 +2620,12 @@ pdescfree(struct thread *td) pdp = p->p_pd; MPASS(pdp != NULL); - PROC_LOCK(p); - p->p_pd = NULL; - PROC_UNLOCK(p); + /* + * Check pdhold for an explanation. + */ + atomic_store_ptr(&p->p_pd, NULL); + atomic_thread_fence_seq_cst(); + PROC_WAIT_UNLOCKED(p); pddrop(pdp); } From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04: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 F0D7C648E32; Sat, 29 May 2021 22:04: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 4FswZC4Wgjz4hH0; Sat, 29 May 2021 22:04: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 75ED612185; Sat, 29 May 2021 22:04: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 14TM4JOH026215; Sat, 29 May 2021 22:04:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4JM5026214; Sat, 29 May 2021 22:04:19 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:19 GMT Message-Id: <202105292204.14TM4JM5026214@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: 478c52f1e365 - main - vfs: slightly rework vn_rlimit_fsize 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: 478c52f1e3654213c7d79096a2bc7f908e0b501d 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, 29 May 2021 22:04:20 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=478c52f1e3654213c7d79096a2bc7f908e0b501d commit 478c52f1e3654213c7d79096a2bc7f908e0b501d Author: Mateusz Guzik AuthorDate: 2021-05-29 17:33:50 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:09 +0000 vfs: slightly rework vn_rlimit_fsize --- sys/kern/vfs_vnops.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 34fcef1b7e1f..019aefead0b3 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -2363,12 +2363,25 @@ vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, off_t lim; bool ktr_write; - if (vp->v_type != VREG || td == NULL || - (td->td_pflags2 & TDP2_ACCT) != 0) + if (td == NULL) return (0); + + /* + * There are conditions where the limit is to be ignored. + * However, since it is almost never reached, check it first. + */ ktr_write = (td->td_pflags & TDP_INKTRACE) != 0; - lim = ktr_write ? td->td_ktr_io_lim : lim_cur(td, RLIMIT_FSIZE); - if ((uoff_t)uio->uio_offset + uio->uio_resid <= lim) + lim = lim_cur(td, RLIMIT_FSIZE); + if (__predict_false(ktr_write)) + lim = td->td_ktr_io_lim; + if (__predict_true((uoff_t)uio->uio_offset + uio->uio_resid <= lim)) + return (0); + + /* + * The limit is reached. + */ + if (vp->v_type != VREG || + (td->td_pflags2 & TDP2_ACCT) != 0) return (0); if (!ktr_write || ktr_filesize_limit_signal) { From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04: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 C8EE7648ACA; Sat, 29 May 2021 22:04: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 4FswZB4B7tz4hdn; Sat, 29 May 2021 22:04: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 57EFE12184; Sat, 29 May 2021 22:04: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 14TM4I4i026189; Sat, 29 May 2021 22:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4I4O026188; Sat, 29 May 2021 22:04:18 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:18 GMT Message-Id: <202105292204.14TM4I4O026188@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: dde5c031ed0d - main - Fix up macro use in lim_cur 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: dde5c031ed0d93d080442b26133e9ea800bbcd22 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, 29 May 2021 22:04:18 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dde5c031ed0d93d080442b26133e9ea800bbcd22 commit dde5c031ed0d93d080442b26133e9ea800bbcd22 Author: Mateusz Guzik AuthorDate: 2021-05-29 17:46:37 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:09 +0000 Fix up macro use in lim_cur --- sys/sys/resourcevar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index e83b170ca291..d1c9e6d4985f 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -135,7 +135,7 @@ rlim_t lim_cur(struct thread *td, int which); int _which = (which); \ if (__builtin_constant_p(which) && which != RLIMIT_DATA && \ which != RLIMIT_STACK && which != RLIMIT_VMEM) { \ - _rlim = td->td_limit->pl_rlimit[which].rlim_cur; \ + _rlim = _td->td_limit->pl_rlimit[_which].rlim_cur; \ } else { \ _rlim = lim_cur(_td, _which); \ } \ From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04:21 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 DFB22648AD6; Sat, 29 May 2021 22:04: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 4FswZD4vPPz4hKh; Sat, 29 May 2021 22:04: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 8FD4C11FAE; Sat, 29 May 2021 22:04: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 14TM4KjU026236; Sat, 29 May 2021 22:04:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4Klh026235; Sat, 29 May 2021 22:04:20 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:20 GMT Message-Id: <202105292204.14TM4Klh026235@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: d81aefa8b7dd - main - vfs: use the sentinel trick in locked lookup path parsing 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: d81aefa8b7dd8cbeffeda541fca9962802404983 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, 29 May 2021 22:04:21 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d81aefa8b7dd8cbeffeda541fca9962802404983 commit d81aefa8b7dd8cbeffeda541fca9962802404983 Author: Mateusz Guzik AuthorDate: 2021-05-25 17:34:26 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:09 +0000 vfs: use the sentinel trick in locked lookup path parsing --- sys/kern/vfs_lookup.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 5336bf87ec68..e0b98c9f5661 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -850,6 +850,7 @@ lookup(struct nameidata *ndp) { char *cp; /* pointer into pathname argument */ char *prev_ni_next; /* saved ndp->ni_next */ + char *nulchar; /* location of '\0' in cn_pnbuf */ struct vnode *dp = NULL; /* the directory we are searching */ struct vnode *tdp; /* saved dp */ struct mount *mp; /* mount table entry */ @@ -909,9 +910,23 @@ dirloop: * cnp->cn_nameptr for callers that need the name. Callers needing * the name set the SAVENAME flag. When done, they assume * responsibility for freeing the pathname buffer. + * + * Store / as a temporary sentinel so that we only have one character + * to test for. Pathnames tend to be short so this should not be + * resulting in cache misses. */ - for (cp = cnp->cn_nameptr; *cp != 0 && *cp != '/'; cp++) + nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; + KASSERT(*nulchar == '\0', + ("%s: expected nul at %p; string [%s]\n", __func__, nulchar, + cnp->cn_pnbuf)); + *nulchar = '/'; + for (cp = cnp->cn_nameptr; *cp != '/'; cp++) { + KASSERT(*cp != '\0', + ("%s: encountered unexpected nul; string [%s]\n", __func__, + cnp->cn_nameptr)); continue; + } + *nulchar = '\0'; cnp->cn_namelen = cp - cnp->cn_nameptr; if (cnp->cn_namelen > NAME_MAX) { error = ENAMETOOLONG; From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04: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 1FA69648E34; Sat, 29 May 2021 22:04: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 4FswZF6Zfmz4hMx; Sat, 29 May 2021 22:04:21 +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 BA73412186; Sat, 29 May 2021 22:04:21 +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 14TM4LHx026257; Sat, 29 May 2021 22:04:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4LsL026256; Sat, 29 May 2021 22:04:21 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:21 GMT Message-Id: <202105292204.14TM4LsL026256@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: 3cf75ca220fb - main - vfs: retire unused vn_seqc_write_begin_unheld* 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: 3cf75ca220fb6a9006fa0481b97e154602f6f554 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, 29 May 2021 22:04:22 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3cf75ca220fb6a9006fa0481b97e154602f6f554 commit 3cf75ca220fb6a9006fa0481b97e154602f6f554 Author: Mateusz Guzik AuthorDate: 2021-05-29 02:26:19 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:09 +0000 vfs: retire unused vn_seqc_write_begin_unheld* --- sys/kern/vfs_subr.c | 21 ++------------------- sys/sys/vnode.h | 2 -- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 6a3cf2aa7505..7c9604457aef 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -6861,25 +6861,17 @@ vn_dir_check_exec(struct vnode *vp, struct componentname *cnp) * to prevent the vnode from getting freed. */ void -vn_seqc_write_begin_unheld_locked(struct vnode *vp) +vn_seqc_write_begin_locked(struct vnode *vp) { ASSERT_VI_LOCKED(vp, __func__); + VNPASS(vp->v_holdcnt > 0, vp); VNPASS(vp->v_seqc_users >= 0, vp); vp->v_seqc_users++; if (vp->v_seqc_users == 1) seqc_sleepable_write_begin(&vp->v_seqc); } -void -vn_seqc_write_begin_locked(struct vnode *vp) -{ - - ASSERT_VI_LOCKED(vp, __func__); - VNPASS(vp->v_holdcnt > 0, vp); - vn_seqc_write_begin_unheld_locked(vp); -} - void vn_seqc_write_begin(struct vnode *vp) { @@ -6889,15 +6881,6 @@ vn_seqc_write_begin(struct vnode *vp) VI_UNLOCK(vp); } -void -vn_seqc_write_begin_unheld(struct vnode *vp) -{ - - VI_LOCK(vp); - vn_seqc_write_begin_unheld_locked(vp); - VI_UNLOCK(vp); -} - void vn_seqc_write_end_locked(struct vnode *vp) { diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index a61ef2611b0a..ed5867b80754 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -788,8 +788,6 @@ int vn_io_fault_uiomove(char *data, int xfersize, struct uio *uio); int vn_io_fault_pgmove(vm_page_t ma[], vm_offset_t offset, int xfersize, struct uio *uio); -void vn_seqc_write_begin_unheld_locked(struct vnode *vp); -void vn_seqc_write_begin_unheld(struct vnode *vp); void vn_seqc_write_begin_locked(struct vnode *vp); void vn_seqc_write_begin(struct vnode *vp); void vn_seqc_write_end_locked(struct vnode *vp); From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04: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 86CC9648EA2; Sat, 29 May 2021 22:04: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 4FswZK2jvrz4hfF; Sat, 29 May 2021 22:04: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 25BEA11FAF; Sat, 29 May 2021 22:04: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 14TM4PJt026326; Sat, 29 May 2021 22:04:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4PDS026325; Sat, 29 May 2021 22:04:25 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:25 GMT Message-Id: <202105292204.14TM4PDS026325@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: 331a7601c9c2 - main - tmpfs: save on common case relocking in tmpfs_reclaim 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: 331a7601c9c21c1e55c57c5338e7affced9c7b7c 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, 29 May 2021 22:04:25 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=331a7601c9c21c1e55c57c5338e7affced9c7b7c commit 331a7601c9c21c1e55c57c5338e7affced9c7b7c Author: Mateusz Guzik AuthorDate: 2021-05-29 01:36:50 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:10 +0000 tmpfs: save on common case relocking in tmpfs_reclaim --- sys/fs/tmpfs/tmpfs_vnops.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 43a2aa77dbbb..5d0d80639046 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1525,26 +1525,18 @@ tmpfs_reclaim(struct vop_reclaim_args *v) struct vnode *vp; struct tmpfs_mount *tmp; struct tmpfs_node *node; - bool unlock, tm_locked; + bool unlock; vp = v->a_vp; node = VP_TO_TMPFS_NODE(vp); tmp = VFS_TO_TMPFS(vp->v_mount); - tm_locked = false; if (vp->v_type == VREG) tmpfs_destroy_vobject(vp, node->tn_reg.tn_aobj); vp->v_object = NULL; -relock: + TMPFS_LOCK(tmp); TMPFS_NODE_LOCK(node); - if (!tm_locked && node->tn_links == 0 && - (node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0) { - TMPFS_NODE_UNLOCK(node); - TMPFS_LOCK(tmp); - tm_locked = true; - goto relock; - } tmpfs_free_vp(vp); /* @@ -1552,19 +1544,16 @@ relock: * we must free its associated data structures (now that the vnode * is being reclaimed). */ + unlock = true; if (node->tn_links == 0 && (node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0) { - MPASS(tm_locked); node->tn_vpstate = TMPFS_VNODE_DOOMED; unlock = !tmpfs_free_node_locked(tmp, node, true); - } else { - unlock = true; } if (unlock) { TMPFS_NODE_UNLOCK(node); - if (tm_locked) - TMPFS_UNLOCK(tmp); + TMPFS_UNLOCK(tmp); } MPASS(vp->v_data == NULL); From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04: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 832E3648E9A; Sat, 29 May 2021 22:04: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 4FswZH0kdbz4hSW; Sat, 29 May 2021 22:04: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 DE5BC120EA; Sat, 29 May 2021 22:04: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 14TM4MpP026278; Sat, 29 May 2021 22:04:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4M7Q026277; Sat, 29 May 2021 22:04:22 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:22 GMT Message-Id: <202105292204.14TM4M7Q026277@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: 7fbeaf33b8e1 - main - tmpfs: drop useless parent locking from tmpfs_dir_getdotdotdent 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: 7fbeaf33b8e1a5e69af42a77c78a6fcb3029f1ca 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, 29 May 2021 22:04:23 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7fbeaf33b8e1a5e69af42a77c78a6fcb3029f1ca commit 7fbeaf33b8e1a5e69af42a77c78a6fcb3029f1ca Author: Mateusz Guzik AuthorDate: 2021-05-29 15:38:21 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:10 +0000 tmpfs: drop useless parent locking from tmpfs_dir_getdotdotdent The id field is immutable until the node gets freed. --- sys/fs/tmpfs/tmpfs_subr.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 8b75c58d69a2..df5bc12047be 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -1436,10 +1436,7 @@ tmpfs_dir_getdotdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node, if (parent == NULL) return (ENOENT); - TMPFS_NODE_LOCK(parent); dent.d_fileno = parent->tn_id; - TMPFS_NODE_UNLOCK(parent); - dent.d_off = next; dent.d_type = DT_DIR; dent.d_namlen = 2; From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04: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 568CD648B5D; Sat, 29 May 2021 22:04: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 4FswZJ1lrZz4hNB; Sat, 29 May 2021 22:04: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 095A811BE1; Sat, 29 May 2021 22:04: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 14TM4Nq2026299; Sat, 29 May 2021 22:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4Ng4026298; Sat, 29 May 2021 22:04:23 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:23 GMT Message-Id: <202105292204.14TM4Ng4026298@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: 439d942b9e7a - main - tmpfs: drop a redundant NULL check in tmpfs_alloc_vp 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: 439d942b9e7ab4df2bb7a628602069d31788df17 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, 29 May 2021 22:04:24 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=439d942b9e7ab4df2bb7a628602069d31788df17 commit 439d942b9e7ab4df2bb7a628602069d31788df17 Author: Mateusz Guzik AuthorDate: 2021-05-29 01:10:53 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:10 +0000 tmpfs: drop a redundant NULL check in tmpfs_alloc_vp --- sys/fs/tmpfs/tmpfs_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index df5bc12047be..322641b5b853 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -831,7 +831,7 @@ loop: * Make sure the vnode is still there after * getting the interlock to avoid racing a free. */ - if (node->tn_vnode == NULL || node->tn_vnode != vp) { + if (node->tn_vnode != vp) { vput(vp); TMPFS_NODE_LOCK(node); goto loop; From owner-dev-commits-src-main@freebsd.org Sat May 29 23:50: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 7FF9E64A72C; Sat, 29 May 2021 23:50:49 +0000 (UTC) (envelope-from rebecca@bsdio.com) Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fsyx52Xhqz4pPc; Sat, 29 May 2021 23:50:48 +0000 (UTC) (envelope-from rebecca@bsdio.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=bsdio.com; s=xmission; h=Subject:Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:To:Sender:Reply-To:Cc:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=OTCJuqU0/AreSqaU1XQ3wMgQRCQQ18Gyjco9GMpFDic=; b=sGswnpjG5RZWHLgOmuvveabGy+ 5Ck8ADwdZGGJwUrWUgO2wzz3mZvgCtVwZnO34kcaD2q1J1vYfLsrDLMMRMKEmlKuHrzNpwZ/3wvDQ 5mqkD/GC2G6F965tTQP3ydIizjzhpVGtRaeYdjGFhz2x6LqhklvsCI39u8Ru0p6mW6Gk=; Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1ln8j8-00Gb19-TZ; Sat, 29 May 2021 17:50:47 -0600 Received: from mta4.zcs.xmission.com ([166.70.13.68]) by in02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1ln8j7-001Loh-UX; Sat, 29 May 2021 17:50:46 -0600 Received: from localhost (localhost [127.0.0.1]) by mta4.zcs.xmission.com (Postfix) with ESMTP id B021D501013; Sat, 29 May 2021 17:50:45 -0600 (MDT) X-Amavis-Modified: Mail body modified (using disclaimer) - mta4.zcs.xmission.com Received: from mta4.zcs.xmission.com ([127.0.0.1]) by localhost (mta4.zcs.xmission.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id OS1DT_2rZgWL; Sat, 29 May 2021 17:50:45 -0600 (MDT) Received: from photon.int.bsdio.com (c-174-52-16-57.hsd1.ut.comcast.net [174.52.16.57]) by mta4.zcs.xmission.com (Postfix) with ESMTPSA id 68A8350100E; Sat, 29 May 2021 17:50:45 -0600 (MDT) To: "Jason A. Harmening" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202105292142.14TLg7ol096256@gitrepo.freebsd.org> From: Rebecca Cran Message-ID: <387f2176-0cb0-fcbc-1294-f2dfc0ffa9d7@bsdio.com> Date: Sat, 29 May 2021 17:50:44 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <202105292142.14TLg7ol096256@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-XM-SPF: eid=1ln8j7-001Loh-UX; ; ; mid=<387f2176-0cb0-fcbc-1294-f2dfc0ffa9d7@bsdio.com>; ; ; hst=in02.mta.xmission.com; ; ; ip=166.70.13.68; ; ; frm=rebecca@bsdio.com; ; ; spf=none X-SA-Exim-Connect-IP: 166.70.13.68 X-SA-Exim-Mail-From: rebecca@bsdio.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa07.xmission.com X-Spam-Level: ***** X-Spam-Status: No, score=5.4 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,LotsOfNums_01,NICE_REPLY_A,T_TM2_M_HEADER_IN_MSG, TooManyTo_001,TooManyTo_002,TooManyTo_003,XMSubLong,XMSubMetaSxObfu_03, XMSubMetaSx_00,XM_B_Unicode autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 0.7 XMSubLong Long Subject * 0.5 TooManyTo_002 Multiple "To" Header Recipients 3x (uncommon) * 0.3 TooManyTo_001 Multiple "To" Header Recipients 2x (uncommon) * 0.6 TooManyTo_003 Multiple "To" Header Recipients 4x (uncommon) * 0.0 XM_B_Unicode BODY: Testing for specific types of unicode * 1.2 LotsOfNums_01 BODY: Lots of long strings of numbers * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; IP=ok Body=1 Fuz1=1] [Fuz2=1] * 1.0 XMSubMetaSx_00 1+ Sexy Words * 1.2 XMSubMetaSxObfu_03 Obfuscated Sexy Noun-People * -0.0 NICE_REPLY_A Looks like a legit reply (A) X-Spam-DCC: XMission; sa07 1397; IP=ok Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *****;"Jason A. Harmening" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org X-Spam-Relay-Country: X-Spam-Timing: total 482 ms - load_scoreonly_sql: 0.07 (0.0%), signal_user_changed: 12 (2.4%), b_tie_ro: 10 (2.1%), parse: 1.32 (0.3%), extract_message_metadata: 5 (1.1%), get_uri_detail_list: 1.32 (0.3%), tests_pri_-1000: 2.9 (0.6%), tests_pri_-950: 1.31 (0.3%), tests_pri_-900: 1.07 (0.2%), tests_pri_-90: 103 (21.4%), check_bayes: 102 (21.1%), b_tokenize: 6 (1.3%), b_tok_get_all: 6 (1.2%), b_comp_prob: 2.0 (0.4%), b_tok_touch_all: 84 (17.5%), b_finish: 0.85 (0.2%), tests_pri_0: 341 (70.7%), check_dkim_signature: 0.90 (0.2%), check_dkim_adsp: 95 (19.8%), poll_dns_idle: 85 (17.7%), tests_pri_10: 2.9 (0.6%), tests_pri_500: 9 (1.8%), rewrite_mail: 0.00 (0.0%) Subject: Re: git: 54256e7954d7 - main - Fix userspace build after commit 6d3e78ad6c11 X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) X-Rspamd-Queue-Id: 4Fsyx52Xhqz4pPc 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: Sat, 29 May 2021 23:50:49 -0000 On 5/29/21 3:42 PM, Jason A. Harmening wrote: > The branch main has been updated by jah: > > URL: https://cgit.FreeBSD.org/src/commit/?id=54256e7954d7efeee53bd1ab4d08d0c772b55f4d > > commit 54256e7954d7efeee53bd1ab4d08d0c772b55f4d > Author: Jason A. Harmening > AuthorDate: 2021-05-29 21:45:09 +0000 > Commit: Jason A. Harmening > CommitDate: 2021-05-29 21:45:42 +0000 > > Fix userspace build after commit 6d3e78ad6c11 > > Reported by: jenkins > --- > sys/sys/mount.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sys/sys/mount.h b/sys/sys/mount.h > index 684d8c3eb780..6c1cd82ee84f 100644 > --- a/sys/sys/mount.h > +++ b/sys/sys/mount.h > @@ -43,6 +43,8 @@ > #include > #include > #include > +#else > +#include > #endif > > /* I'm seeing this error even with this commit: --- lib/libprocstat__L --- In file included from /usr/src/lib/libprocstat/msdosfs.c:51: /usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/mount.h:765:7: error: unknown type name 'bool'                     bool *mp_busy);                     ^ -- Rebecca Cran From owner-dev-commits-src-main@freebsd.org Sat May 29 23:57: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 B686264AA8D; Sat, 29 May 2021 23:57:16 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 4Fsz4X4YBWz4pbq; Sat, 29 May 2021 23:57:16 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-pj1-x1036.google.com with SMTP id m8-20020a17090a4148b029015fc5d36343so4591537pjg.1; Sat, 29 May 2021 16:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=pmcrA+8tHP9H9x4LcbTDDtT8qtq4icKAvyQ0gYfZW6A=; b=h75+coVLfk9DgqmznX3QGGiN1V6RHL1+Ml5M9TGuAUJKyM0ioR6k/eC9lto1KDQ8jn QKuWeTggHt6EFyYh5Vrk3J80Fv6Mdc//z+Y9ywPzs19gIuXaUhPC3eKpAyAPzFohWoWy 22bUXeaP8/4bPoQypdgnIRva0vsyJ6LRW1t3EYKE7y9fcUctX52ecJPbGWEC8Bv+s2vz /0a5jpSuNbP3cJvMTeCcGhoMGaPU2OkCvobWiPxqouSnnB3qzitUCruW2XLv4+SeW3bN qsv4uoFDV7v1xyCuiyVxaCDKovDkJH8zKqmEGM+dWzyGFIWuhIFbdgR2sqjtThDop+4W r5nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pmcrA+8tHP9H9x4LcbTDDtT8qtq4icKAvyQ0gYfZW6A=; b=QzMq67b0VQxyBSR+Gl4AhtlMMaJ49G1f91XQKDdQTCAHjnBMfWwDf6frUiB8STv0G9 Hk2zrFKKlxD9J0lQza6IxL2MqtZIUeVN6g8j4CkH0snZpLvxMggEgnlFN/UsytWSlVzn 785i5nktU6gJ+UOneBKzeAxo/JTgxcdPuhqoWJSbVYbCCrcquZqhVdljjTiJWIKCG+pR 5ktGiGgtIHQa1xyJL7ruGmpho2k+W6MXHQS+ypHh8pN7hTspPFTdfK2xsMVuNeYl1LLY IupiUy5dqT4Lc8xTun+Up0wftvFEzh91OTDx0ALR0egxUubgnjivAzdu26KMqogJnKSF 2AKg== X-Gm-Message-State: AOAM530xHD/MQTAFhNb9Se0ZTAu4xQgW6xh3kU2w8e/F4E2ejr8beSRI GGmlfcHtiSXpW1akGzQ1+/FQbo7b0Owr X-Google-Smtp-Source: ABdhPJxXUSrHIm+isysX3vYFPfH8U6GHzGXqLeC3EShauanOtRgHDXyXyQFCWaErYQ+0TvUfvnF2LQ== X-Received: by 2002:a17:90a:4216:: with SMTP id o22mr11906158pjg.3.1622332634441; Sat, 29 May 2021 16:57:14 -0700 (PDT) Received: from [192.168.42.3] ([97.73.80.132]) by smtp.googlemail.com with ESMTPSA id x15sm129817pfp.79.2021.05.29.16.57.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 May 2021 16:57:13 -0700 (PDT) Subject: Re: git: 54256e7954d7 - main - Fix userspace build after commit 6d3e78ad6c11 To: Rebecca Cran , "Jason A. Harmening" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202105292142.14TLg7ol096256@gitrepo.freebsd.org> <387f2176-0cb0-fcbc-1294-f2dfc0ffa9d7@bsdio.com> From: Jason Harmening Message-ID: <802d7249-9fbf-d3da-9b70-9865e10a39c4@gmail.com> Date: Sat, 29 May 2021 17:01:50 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <387f2176-0cb0-fcbc-1294-f2dfc0ffa9d7@bsdio.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Fsz4X4YBWz4pbq X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.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: Sat, 29 May 2021 23:57:16 -0000 On 5/29/21 4:50 PM, Rebecca Cran wrote: > On 5/29/21 3:42 PM, Jason A. Harmening wrote: >> The branch main has been updated by jah: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=54256e7954d7efeee53bd1ab4d08d0c772b55f4d >> >> >> commit 54256e7954d7efeee53bd1ab4d08d0c772b55f4d >> Author:     Jason A. Harmening >> AuthorDate: 2021-05-29 21:45:09 +0000 >> Commit:     Jason A. Harmening >> CommitDate: 2021-05-29 21:45:42 +0000 >> >>      Fix userspace build after commit  6d3e78ad6c11 >>      Reported by: jenkins >> --- >>   sys/sys/mount.h | 2 ++ >>   1 file changed, 2 insertions(+) >> >> diff --git a/sys/sys/mount.h b/sys/sys/mount.h >> index 684d8c3eb780..6c1cd82ee84f 100644 >> --- a/sys/sys/mount.h >> +++ b/sys/sys/mount.h >> @@ -43,6 +43,8 @@ >>   #include >>   #include >>   #include >> +#else >> +#include >>   #endif >>   /* > > I'm seeing this error even with this commit: > > > --- lib/libprocstat__L --- > In file included from /usr/src/lib/libprocstat/msdosfs.c:51: > /usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/mount.h:765:7: error: > unknown type name 'bool' >                     bool *mp_busy); >                     ^ Yes, it turns out parts of libprocstat like to pretend they're kernel components for the purpose of including mount.h. I think this should fix it, but I'm waiting for buildworld to finish to be sure: diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 6c1cd82ee84..3c7f4b9a427 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -38,6 +38,7 @@ #include #include #ifdef _KERNEL +#include #include #include From owner-dev-commits-src-main@freebsd.org Sun May 30 00:47: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 57C9964B2F2; Sun, 30 May 2021 00:47: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 4Ft0Bg22NHz4s5J; Sun, 30 May 2021 00:47: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 293E613C51; Sun, 30 May 2021 00:47: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 14U0ldoh039000; Sun, 30 May 2021 00:47:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14U0ldeD038999; Sun, 30 May 2021 00:47:39 GMT (envelope-from git) Date: Sun, 30 May 2021 00:47:39 GMT Message-Id: <202105300047.14U0ldeD038999@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: 271fcf1c28ef - main - Revert commits 6d3e78ad6c11 and 54256e7954d7 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: 271fcf1c28efd22342212b1ccaa3dba4fc059627 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, 30 May 2021 00:47:39 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=271fcf1c28efd22342212b1ccaa3dba4fc059627 commit 271fcf1c28efd22342212b1ccaa3dba4fc059627 Author: Jason A. Harmening AuthorDate: 2021-05-30 00:46:46 +0000 Commit: Jason A. Harmening CommitDate: 2021-05-30 00:48:02 +0000 Revert commits 6d3e78ad6c11 and 54256e7954d7 Parts of libprocstat like to pretend they're kernel components for the sake of including mount.h, and including sys/types.h in the _KERNEL case doesn't fix the build for some reason. Revert both the VFS_QUOTACTL() change and the follow-up "fix" for now. --- share/man/man9/VFS_QUOTACTL.9 | 32 ++-------------------- .../openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 15 ---------- sys/fs/nullfs/null_vfsops.c | 30 ++------------------ sys/fs/smbfs/smbfs_vfsops.c | 3 +- sys/fs/unionfs/union_vfsops.c | 28 ++----------------- sys/kern/vfs_default.c | 4 +-- sys/kern/vfs_init.c | 6 ++-- sys/kern/vfs_syscalls.c | 19 +++++++------ sys/sys/mount.h | 9 ++---- sys/sys/param.h | 2 +- sys/ufs/ufs/quota.h | 2 +- sys/ufs/ufs/ufs_quota.c | 21 ++++++++------ sys/ufs/ufs/ufs_vfsops.c | 19 ++++++++----- 13 files changed, 53 insertions(+), 137 deletions(-) diff --git a/share/man/man9/VFS_QUOTACTL.9 b/share/man/man9/VFS_QUOTACTL.9 index 210f71631353..8d0cb113ce1e 100644 --- a/share/man/man9/VFS_QUOTACTL.9 +++ b/share/man/man9/VFS_QUOTACTL.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 29, 2021 +.Dd December 17, 2020 .Dt VFS_QUOTACTL 9 .Os .Sh NAME @@ -39,38 +39,12 @@ .In sys/mount.h .In sys/vnode.h .Ft int -.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "void *arg" "bool *mp_busy" +.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "void *arg" .Sh DESCRIPTION Implement file system quotas. -.Pp -The -.Fa mp_busy -argument is an input/output parameter. -.Fn VFS_QUOTACTL -must be called with -.Fa mp -marked busy through -.Xr vfs_busy 9 -and -.Fa *mp_busy -set to true. -The filesystem implementation of -.Fn VFS_QUOTACTL -may then unbusy -.Fa mp -using -.Xr vfs_unbusy 9 -prior to performing quota file I/O. -In this case the implementation must set -.Fa *mp_busy -to false to indicate that the caller must not unbusy -.Fa mp -upon completion of -.Fn VFS_QUOTACTL . -.Pp See .Xr quotactl 2 -for a description of the remaining arguments. +for a description of the arguments. .Sh SEE ALSO .Xr quotactl 2 , .Xr vnode 9 diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index 4f2d7df87fc0..a537342f9678 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -102,12 +102,7 @@ SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0, "ZPL_VERSION"); /* END CSTYLED */ -#if __FreeBSD_version >= 1400018 -static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, - bool *mp_busy); -#else static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg); -#endif static int zfs_mount(vfs_t *vfsp); static int zfs_umount(vfs_t *vfsp, int fflag); static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); @@ -272,11 +267,7 @@ done: } static int -#if __FreeBSD_version >= 1400018 -zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, bool *mp_busy) -#else zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) -#endif { zfsvfs_t *zfsvfs = vfsp->vfs_data; struct thread *td; @@ -300,10 +291,8 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) break; default: error = EINVAL; -#if __FreeBSD_version < 1400018 if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) vfs_unbusy(vfsp); -#endif goto done; } } @@ -362,15 +351,11 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) case Q_QUOTAON: // As far as I can tell, you can't turn quotas on or off on zfs error = 0; -#if __FreeBSD_version < 1400018 vfs_unbusy(vfsp); -#endif break; case Q_QUOTAOFF: error = ENOTSUP; -#if __FreeBSD_version < 1400018 vfs_unbusy(vfsp); -#endif break; case Q_SETQUOTA: error = copyin(arg, &dqblk, sizeof (dqblk)); diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 0ad2385116a9..0bb98072edf4 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -294,39 +294,13 @@ nullfs_root(mp, flags, vpp) } static int -nullfs_quotactl(mp, cmd, uid, arg, mp_busy) +nullfs_quotactl(mp, cmd, uid, arg) struct mount *mp; int cmd; uid_t uid; void *arg; - bool *mp_busy; { - struct mount *lowermp; - struct null_mount *mntdata; - int error; - bool unbusy; - - mntdata = MOUNTTONULLMOUNT(mp); - lowermp = atomic_load_ptr(&mntdata->nullm_vfs); - KASSERT(*mp_busy == true, ("upper mount not busy")); - /* - * See comment in sys_quotactl() for an explanation of why the - * lower mount needs to be busied by the caller of VFS_QUOTACTL() - * but may be unbusied by the implementation. We must unbusy - * the upper mount for the same reason; otherwise a namei lookup - * issued by the VFS_QUOTACTL() implementation could traverse the - * upper mount and deadlock. - */ - vfs_unbusy(mp); - *mp_busy = false; - unbusy = true; - error = vfs_busy(lowermp, 0); - if (error == 0) - error = VFS_QUOTACTL(lowermp, cmd, uid, arg, &unbusy); - if (unbusy) - vfs_unbusy(lowermp); - - return (error); + return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg); } static int diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index a1ae565c6341..d19816a7869c 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -352,12 +352,11 @@ out: */ /* ARGSUSED */ static int -smbfs_quotactl(mp, cmd, uid, arg, mp_busy) +smbfs_quotactl(mp, cmd, uid, arg) struct mount *mp; int cmd; uid_t uid; void *arg; - bool *mp_busy; { SMBVDEBUG("return EOPNOTSUPP\n"); return EOPNOTSUPP; diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index bd264c7bcdb5..ae95bd9c005c 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -371,38 +371,16 @@ unionfs_root(struct mount *mp, int flags, struct vnode **vpp) } static int -unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg, - bool *mp_busy) +unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg) { - struct mount *uppermp; struct unionfs_mount *ump; - int error; - bool unbusy; ump = MOUNTTOUNIONFSMOUNT(mp); - uppermp = atomic_load_ptr(&ump->um_uppervp->v_mount); - KASSERT(*mp_busy == true, ("upper mount not busy")); - /* - * See comment in sys_quotactl() for an explanation of why the - * lower mount needs to be busied by the caller of VFS_QUOTACTL() - * but may be unbusied by the implementation. We must unbusy - * the upper mount for the same reason; otherwise a namei lookup - * issued by the VFS_QUOTACTL() implementation could traverse the - * upper mount and deadlock. - */ - vfs_unbusy(mp); - *mp_busy = false; - unbusy = true; - error = vfs_busy(uppermp, 0); + /* * Writing is always performed to upper vnode. */ - if (error == 0) - error = VFS_QUOTACTL(uppermp, cmd, uid, arg, &unbusy); - if (unbusy) - vfs_unbusy(uppermp); - - return (error); + return (VFS_QUOTACTL(ump->um_uppervp->v_mount, cmd, uid, arg)); } static int diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 63bca7810847..ace9ad1d37c3 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1350,13 +1350,13 @@ vfs_stdstatfs (mp, sbp) } int -vfs_stdquotactl (mp, cmds, uid, arg, mp_busy) +vfs_stdquotactl (mp, cmds, uid, arg) struct mount *mp; int cmds; uid_t uid; void *arg; - bool *mp_busy; { + return (EOPNOTSUPP); } diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 112b4c76e575..3365ddb11474 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -212,14 +212,12 @@ vfs_cachedroot_sigdefer(struct mount *mp, int flags, struct vnode **vpp) } static int -vfs_quotactl_sigdefer(struct mount *mp, int cmd, uid_t uid, void *arg, - bool *mp_busy) +vfs_quotactl_sigdefer(struct mount *mp, int cmd, uid_t uid, void *arg) { int prev_stops, rc; prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); - rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_quotactl)(mp, cmd, uid, arg, - mp_busy); + rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_quotactl)(mp, cmd, uid, arg); sigallowstop(prev_stops); return (rc); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 2f4a6036ef88..55780b0474ee 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -89,6 +89,8 @@ __FBSDID("$FreeBSD$"); #include +#include + MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); static int kern_chflagsat(struct thread *td, int fd, const char *path, @@ -193,7 +195,6 @@ sys_quotactl(struct thread *td, struct quotactl_args *uap) struct mount *mp; struct nameidata nd; int error; - bool mp_busy; AUDIT_ARG_CMD(uap->cmd); AUDIT_ARG_UID(uap->uid); @@ -212,21 +213,21 @@ sys_quotactl(struct thread *td, struct quotactl_args *uap) vfs_rel(mp); return (error); } - mp_busy = true; - error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg, &mp_busy); + error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg); /* - * Since quota on/off operations typically need to open quota - * files, the implementation may need to unbusy the mount point + * Since quota on operation typically needs to open quota + * file, the Q_QUOTAON handler needs to unbusy the mount point * before calling into namei. Otherwise, unmount might be - * started between two vfs_busy() invocations (first is ours, + * started between two vfs_busy() invocations (first is our, * second is from mount point cross-walk code in lookup()), * causing deadlock. * - * Avoid unbusying mp if the implementation indicates it has - * already done so. + * Require that Q_QUOTAON handles the vfs_busy() reference on + * its own, always returning with ubusied mount point. */ - if (mp_busy) + if ((uap->cmd >> SUBCMDSHIFT) != Q_QUOTAON && + (uap->cmd >> SUBCMDSHIFT) != Q_QUOTAOFF) vfs_unbusy(mp); vfs_rel(mp); return (error); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 6c1cd82ee84f..a1d4bfd15ddb 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -43,8 +43,6 @@ #include #include #include -#else -#include #endif /* @@ -761,8 +759,7 @@ struct mntarg; typedef int vfs_cmount_t(struct mntarg *ma, void *data, uint64_t flags); typedef int vfs_unmount_t(struct mount *mp, int mntflags); typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp); -typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg, - bool *mp_busy); +typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg); typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp); typedef int vfs_sync_t(struct mount *mp, int waitfor); typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags, @@ -835,10 +832,10 @@ vfs_statfs_t __vfs_statfs; _rc = (*(MP)->mnt_op->vfs_cachedroot)(MP, FLAGS, VPP); \ _rc; }) -#define VFS_QUOTACTL(MP, C, U, A, MP_BUSY) ({ \ +#define VFS_QUOTACTL(MP, C, U, A) ({ \ int _rc; \ \ - _rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, MP_BUSY); \ + _rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A); \ _rc; }) #define VFS_STATFS(MP, SBP) ({ \ diff --git a/sys/sys/param.h b/sys/sys/param.h index c63452973daf..959f0b94ca70 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400018 +#define __FreeBSD_version 1400017 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/ufs/ufs/quota.h b/sys/ufs/ufs/quota.h index eb3db9c300d0..e154f8234705 100644 --- a/sys/ufs/ufs/quota.h +++ b/sys/ufs/ufs/quota.h @@ -232,7 +232,7 @@ int getinoquota(struct inode *); int qsync(struct mount *); int qsyncvp(struct vnode *); int quotaoff(struct thread *, struct mount *, int); -int quotaon(struct thread *, struct mount *, int, void *, bool *); +int quotaon(struct thread *, struct mount *, int, void *); int getquota32(struct thread *, struct mount *, u_long, int, void *); int setquota32(struct thread *, struct mount *, u_long, int, void *); int setuse32(struct thread *, struct mount *, u_long, int, void *); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 143e0afbf1e3..4dff74f75945 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -492,8 +492,7 @@ chkdquot(struct inode *ip) * Q_QUOTAON - set up a quota file for a particular filesystem. */ int -quotaon(struct thread *td, struct mount *mp, int type, void *fname, - bool *mp_busy) +quotaon(struct thread *td, struct mount *mp, int type, void *fname) { struct ufsmount *ump; struct vnode *vp, **vpp; @@ -503,11 +502,15 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname, struct nameidata nd; error = priv_check(td, PRIV_UFS_QUOTAON); - if (error != 0) + if (error != 0) { + vfs_unbusy(mp); return (error); + } - if ((mp->mnt_flag & MNT_RDONLY) != 0) + if ((mp->mnt_flag & MNT_RDONLY) != 0) { + vfs_unbusy(mp); return (EROFS); + } ump = VFSTOUFS(mp); dq = NODQUOT; @@ -515,9 +518,7 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname, NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, td); flags = FREAD | FWRITE; vfs_ref(mp); - KASSERT(*mp_busy, ("%s called without busied mount", __func__)); vfs_unbusy(mp); - *mp_busy = false; error = vn_open(&nd, &flags, 0, NULL); if (error != 0) { vfs_rel(mp); @@ -528,9 +529,10 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname, error = vfs_busy(mp, MBF_NOWAIT); vfs_rel(mp); if (error == 0) { - *mp_busy = true; - if (vp->v_type != VREG) + if (vp->v_type != VREG) { error = EACCES; + vfs_unbusy(mp); + } } if (error != 0) { VOP_UNLOCK(vp); @@ -543,6 +545,7 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname, UFS_UNLOCK(ump); VOP_UNLOCK(vp); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); + vfs_unbusy(mp); return (EALREADY); } ump->um_qflags[type] |= QTF_OPENING|QTF_CLOSING; @@ -553,6 +556,7 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname, ump->um_qflags[type] &= ~(QTF_OPENING|QTF_CLOSING); UFS_UNLOCK(ump); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); + vfs_unbusy(mp); return (error); } VOP_UNLOCK(vp); @@ -636,6 +640,7 @@ again: ("quotaon: leaking flags")); UFS_UNLOCK(ump); + vfs_unbusy(mp); return (error); } diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index 33ef7bc2c3d1..0f45baed634f 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -87,14 +87,17 @@ ufs_root(mp, flags, vpp) * Do operations associated with quotas */ int -ufs_quotactl(mp, cmds, id, arg, mp_busy) +ufs_quotactl(mp, cmds, id, arg) struct mount *mp; int cmds; uid_t id; void *arg; - bool *mp_busy; { #ifndef QUOTA + if ((cmds >> SUBCMDSHIFT) == Q_QUOTAON || + (cmds >> SUBCMDSHIFT) == Q_QUOTAOFF) + vfs_unbusy(mp); + return (EOPNOTSUPP); #else struct thread *td; @@ -114,23 +117,25 @@ ufs_quotactl(mp, cmds, id, arg, mp_busy) break; default: + if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) + vfs_unbusy(mp); return (EINVAL); } } - if ((u_int)type >= MAXQUOTAS) + if ((u_int)type >= MAXQUOTAS) { + if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) + vfs_unbusy(mp); return (EINVAL); + } switch (cmd) { case Q_QUOTAON: - error = quotaon(td, mp, type, arg, mp_busy); + error = quotaon(td, mp, type, arg); break; case Q_QUOTAOFF: vfs_ref(mp); - KASSERT(*mp_busy, - ("%s called without busied mount", __func__)); vfs_unbusy(mp); - *mp_busy = false; vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); error = quotaoff(td, mp, type); vn_finished_write(mp); From owner-dev-commits-src-main@freebsd.org Sun May 30 00:48: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 B642364B795; Sun, 30 May 2021 00:48:57 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 4Ft0D94WnXz4sJK; Sun, 30 May 2021 00:48:57 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-pl1-x632.google.com with SMTP id t21so3426497plo.2; Sat, 29 May 2021 17:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=QM+bp4/WJubVE8I1HS6ZU8/G+KSQWhPV6GTYFgmzpsE=; b=fwWJ4hWAQkTL3S788025N029iypEV6MEl4gpihujcKS2bG3mRpOUhqkSaQlyygu4KH p6H5asdAQAElyQecDnbvOfQBP9DtYbPhao4aE9a/cTTQaRXtKwg1GpmhD3EU7XFy37rj dpT3NrMiUyhpJHiL6+M+JiNnLTKMlP7XXBFob07xrh6RqUF5uWyshN50GhumTSNr6/qp rVOqGXIikM7N4AkC+HtjbnokK1ktG2KpNl092RJ/6SKWeHBXe6LZT+NXBeJXUgMtdVhO IvKuE1w56EPUu+q7OqSUFcur8TM/aejG0g34bQbrCCIslyG4MYlaVvdqYDO3E3uN9FJe 4zAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QM+bp4/WJubVE8I1HS6ZU8/G+KSQWhPV6GTYFgmzpsE=; b=ozezQZ8Zik3vdesTt07zEuFTncYSlv4HtgZQuVjG47Q/voqdh0PQDJzzGcw4E3Ezfx UCC2zEAlhXBNtaiBOpdW6L6wpKTBYigieJS63DnPkO4MRtJ27DgTS96UmWAY789nhe7i FZyZpwEGGcyN95EjrTT55FJPsszOxpKu0/LJ+JlBQtRnogUdFzLhf8MWees0iUPIyR10 BtfZYW4jnRWJFlTgVeJiloVtTg3ihDy4ylNhsjcJGK65UP6DO07FgVsV0LvFx0/4GSM8 GTTKAbyAFmXxnyxSLX64N+XMuN4pka8H3sAAfvlUDtutycrWUzxYfVOVntMbQq515FPg AxPw== X-Gm-Message-State: AOAM530CQRU7KNZUlMrk3s76FcwwWXDJgyP+1k7E/Z/rbYsFWkZBGifc 4mCIGCpLhBeImR9sxBmbu83GNHVWy8qo X-Google-Smtp-Source: ABdhPJz7nBlRasgSEfu+unSNkJb47M30DMzYQN5XVkrnnSZP4aHdym/GQungkvMq13xKpRDtPdIkhQ== X-Received: by 2002:a17:90a:b294:: with SMTP id c20mr11852644pjr.236.1622335736057; Sat, 29 May 2021 17:48:56 -0700 (PDT) Received: from [192.168.42.3] ([97.73.80.132]) by smtp.googlemail.com with ESMTPSA id h20sm76201pfq.83.2021.05.29.17.48.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 May 2021 17:48:55 -0700 (PDT) Subject: Re: git: 54256e7954d7 - main - Fix userspace build after commit 6d3e78ad6c11 To: Rebecca Cran , "Jason A. Harmening" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202105292142.14TLg7ol096256@gitrepo.freebsd.org> <387f2176-0cb0-fcbc-1294-f2dfc0ffa9d7@bsdio.com> From: Jason Harmening Message-ID: <556c2008-19b4-5c56-0c80-2e1c7f857608@gmail.com> Date: Sat, 29 May 2021 17:53:33 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <387f2176-0cb0-fcbc-1294-f2dfc0ffa9d7@bsdio.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Ft0D94WnXz4sJK 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)[] 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, 30 May 2021 00:48:57 -0000 Actually that doesn't fix it, so I've reverted both commits for now. I'm not sure what other BS is going on here. On 5/29/21 4:50 PM, Rebecca Cran wrote: > On 5/29/21 3:42 PM, Jason A. Harmening wrote: >> The branch main has been updated by jah: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=54256e7954d7efeee53bd1ab4d08d0c772b55f4d >> >> >> commit 54256e7954d7efeee53bd1ab4d08d0c772b55f4d >> Author:     Jason A. Harmening >> AuthorDate: 2021-05-29 21:45:09 +0000 >> Commit:     Jason A. Harmening >> CommitDate: 2021-05-29 21:45:42 +0000 >> >>      Fix userspace build after commit  6d3e78ad6c11 >>      Reported by: jenkins >> --- >>   sys/sys/mount.h | 2 ++ >>   1 file changed, 2 insertions(+) >> >> diff --git a/sys/sys/mount.h b/sys/sys/mount.h >> index 684d8c3eb780..6c1cd82ee84f 100644 >> --- a/sys/sys/mount.h >> +++ b/sys/sys/mount.h >> @@ -43,6 +43,8 @@ >>   #include >>   #include >>   #include >> +#else >> +#include >>   #endif >>   /* > > I'm seeing this error even with this commit: > > > --- lib/libprocstat__L --- > In file included from /usr/src/lib/libprocstat/msdosfs.c:51: > /usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/mount.h:765:7: error: > unknown type name 'bool' >                     bool *mp_busy); >                     ^ > From owner-dev-commits-src-main@freebsd.org Sun May 30 01:19: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 CA6D864C0B1; Sun, 30 May 2021 01:19:19 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 4Ft0vB5Mc6z4vJM; Sun, 30 May 2021 01:19:18 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-pl1-x632.google.com with SMTP id v12so3421954plo.10; Sat, 29 May 2021 18:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=rkSfaLBLJ/zliehRJiveuF6KMbVehsPHexTO9PrXdUc=; b=IY2bpJ7nb2M5+ULAnkUtaoKuwyCDiB1CEMEzkW8Lgfb2fms5LwgJGdeY/mQDhk1Pmt q2s4l4YjbtyFHsGxvPJLtMpdS0ELEBziIpaznpyVcy34kYvdzy9BgicpYRW9LCZGU/r6 n5m8rwQTZVYENSVMEygkHpf+jEUhmN3PafMZdSa9eNLtt+7OZw38cpiLP/H54tuSZIuX tmsXD2/64zUR7zaIaAOcjThcVrMxnZHNXLTgwvoj/bd1hoLIAmKEXQx1HQF+TvNHQSMu FvxdJzpWbHDwrAqzPrRzEdKI88UFMRbAkpeuQCiaHptHKHweX7OGRa087Y+MKhfsCu7g l0Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rkSfaLBLJ/zliehRJiveuF6KMbVehsPHexTO9PrXdUc=; b=Li9t/DEbC08ChuvTKpJiF+TE05ECUPqNDQekc+c70RKGcQnCK0LSbcUmVtXVXohw0R WXbsg+XiEb9n/O+t6uC+/k4hV4WMVs6zT/G0Zj79S3PFxhulq+KKFHwOpPPKTiaIRfwe rzHP/JBzhYMFw+3txNdwI4oSnEhHDfZxt6Z39GtVftaqFUjLJ+cU+urklOC5qLvXmZmg mNdyAKxIzV8NAKj5uMsOLM2vQd9z1ruK8QM+sxs4cfhfF2sAmuhSbPCTfT1i74uKov/a t1SvLJAD38qwuejj5Jp/5VA2FqIv+i7oDCBg2p6konPvffihWsWKEbimReKHLXlgTWUg /4og== X-Gm-Message-State: AOAM530lh/v8ucM4lFjyuzXV5y9pVvo2xUjpalOyonF838liT3KOYDiG l/oYooDR8VtsZQiCXAU/uEp8abv3m/17 X-Google-Smtp-Source: ABdhPJxpbk5xbmGQC0JUj8lUvyWGJMTj0oi844TJve2crXPXyz6wXzF/TsGSe4KIAMaM53O9e9hnUQ== X-Received: by 2002:a17:90a:3bc6:: with SMTP id e64mr12295481pjc.156.1622337557033; Sat, 29 May 2021 18:19:17 -0700 (PDT) Received: from [192.168.42.3] ([97.73.80.132]) by smtp.googlemail.com with ESMTPSA id b23sm7319885pjo.26.2021.05.29.18.19.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 May 2021 18:19:16 -0700 (PDT) Subject: Re: git: 54256e7954d7 - main - Fix userspace build after commit 6d3e78ad6c11 From: Jason Harmening To: Rebecca Cran , "Jason A. Harmening" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202105292142.14TLg7ol096256@gitrepo.freebsd.org> <387f2176-0cb0-fcbc-1294-f2dfc0ffa9d7@bsdio.com> <556c2008-19b4-5c56-0c80-2e1c7f857608@gmail.com> Message-ID: Date: Sat, 29 May 2021 18:23:54 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <556c2008-19b4-5c56-0c80-2e1c7f857608@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Ft0vB5Mc6z4vJM X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=IY2bpJ7n; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of jasonharmening@gmail.com designates 2607:f8b0:4864:20::632 as permitted sender) smtp.mailfrom=jasonharmening@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::632:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RECEIVED_SPAMHAUS_PBL(0.00)[97.73.80.132:received]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; NEURAL_SPAM_SHORT(1.00)[1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::632:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::632:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] 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, 30 May 2021 01:19:19 -0000 Ah, sys/types.h doesn't try to define bool unless bool isn't already defined *and* _KERNEL || STANDALONE is defined. The libprocstat offenders pull in a bunch of other system headers that pull in types.h before they fake-define _KERNEL, so there's never a chance for bool to be defined. And I should've known the "fix" of including stdbool was pointless, because the vfs_* function types obviously are only defined for kernel builds. So, it's either use _Bool or make libprocstat pay for its hackery by manually including stdbool.h. I'm kinda in favor of the latter:) On 5/29/21 5:53 PM, Jason Harmening wrote: > Actually that doesn't fix it, so I've reverted both commits for now. > I'm not sure what other BS is going on here. > > On 5/29/21 4:50 PM, Rebecca Cran wrote: >> On 5/29/21 3:42 PM, Jason A. Harmening wrote: >>> The branch main has been updated by jah: >>> >>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=54256e7954d7efeee53bd1ab4d08d0c772b55f4d >>> >>> >>> commit 54256e7954d7efeee53bd1ab4d08d0c772b55f4d >>> Author:     Jason A. Harmening >>> AuthorDate: 2021-05-29 21:45:09 +0000 >>> Commit:     Jason A. Harmening >>> CommitDate: 2021-05-29 21:45:42 +0000 >>> >>>      Fix userspace build after commit  6d3e78ad6c11 >>>      Reported by: jenkins >>> --- >>>   sys/sys/mount.h | 2 ++ >>>   1 file changed, 2 insertions(+) >>> >>> diff --git a/sys/sys/mount.h b/sys/sys/mount.h >>> index 684d8c3eb780..6c1cd82ee84f 100644 >>> --- a/sys/sys/mount.h >>> +++ b/sys/sys/mount.h >>> @@ -43,6 +43,8 @@ >>>   #include >>>   #include >>>   #include >>> +#else >>> +#include >>>   #endif >>>   /* >> >> I'm seeing this error even with this commit: >> >> >> --- lib/libprocstat__L --- >> In file included from /usr/src/lib/libprocstat/msdosfs.c:51: >> /usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/mount.h:765:7: error: >> unknown type name 'bool' >>                      bool *mp_busy); >>                      ^ >> From owner-dev-commits-src-main@freebsd.org Sun May 30 02: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 B6C7464D14A; Sun, 30 May 2021 02: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 4Ft30T4nd8z3Hr2; Sun, 30 May 2021 02: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 8C65D1592E; Sun, 30 May 2021 02: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 14U2s1Vv010293; Sun, 30 May 2021 02: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 14U2s1rr010292; Sun, 30 May 2021 02:54:01 GMT (envelope-from git) Date: Sun, 30 May 2021 02:54:01 GMT Message-Id: <202105300254.14U2s1rr010292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 0137a09d6e0b - main - Clean up spr.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0137a09d6e0bbf6215cabe762f0fdd88202b20f9 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, 30 May 2021 02:54:01 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=0137a09d6e0bbf6215cabe762f0fdd88202b20f9 commit 0137a09d6e0bbf6215cabe762f0fdd88202b20f9 Author: Justin Hibbits AuthorDate: 2021-05-30 02:53:16 +0000 Commit: Justin Hibbits CommitDate: 2021-05-30 02:53:16 +0000 Clean up spr.h Remove SPRs for CPUs FreeBSD doesn't run on Add debug register SPRs from the Freescale EREF --- sys/powerpc/include/spr.h | 81 ++++++----------------------------------------- 1 file changed, 9 insertions(+), 72 deletions(-) diff --git a/sys/powerpc/include/spr.h b/sys/powerpc/include/spr.h index 4cb39ea7e7be..a97e49e77d76 100644 --- a/sys/powerpc/include/spr.h +++ b/sys/powerpc/include/spr.h @@ -277,6 +277,7 @@ #define EPCR_PMGS 0x00200000 #define SPR_DBCR0 0x134 /* ..8 Debug Control Register 0 */ #define SPR_DBCR1 0x135 /* ..8 Debug Control Register 1 */ +#define SPR_DBCR2 0x136 /* ..8 Debug Control Register 2 */ #define SPR_IAC1 0x138 /* ..8 Instruction Address Compare 1 */ #define SPR_IAC2 0x139 /* ..8 Instruction Address Compare 2 */ #define SPR_IAC3 0x13a /* ..8 Instruction Address Compare 3 */ @@ -352,95 +353,31 @@ #define SPR_DBAT2L 0x21d /* .6. Data BAT Reg 2 Lower */ #define SPR_DBAT3U 0x21e /* .6. Data BAT Reg 3 Upper */ #define SPR_DBAT3L 0x21f /* .6. Data BAT Reg 3 Lower */ -#define SPR_IC_CST 0x230 /* ..8 Instruction Cache CSR */ -#define IC_CST_IEN 0x80000000 /* I cache is ENabled (RO) */ -#define IC_CST_CMD_INVALL 0x0c000000 /* I cache invalidate all */ -#define IC_CST_CMD_UNLOCKALL 0x0a000000 /* I cache unlock all */ -#define IC_CST_CMD_UNLOCK 0x08000000 /* I cache unlock block */ -#define IC_CST_CMD_LOADLOCK 0x06000000 /* I cache load & lock block */ -#define IC_CST_CMD_DISABLE 0x04000000 /* I cache disable */ -#define IC_CST_CMD_ENABLE 0x02000000 /* I cache enable */ -#define IC_CST_CCER1 0x00200000 /* I cache error type 1 (RO) */ -#define IC_CST_CCER2 0x00100000 /* I cache error type 2 (RO) */ -#define IC_CST_CCER3 0x00080000 /* I cache error type 3 (RO) */ #define SPR_IBAT4U 0x230 /* .6. Instruction BAT Reg 4 Upper */ -#define SPR_IC_ADR 0x231 /* ..8 Instruction Cache Address */ +#define SPR_DBCR3 0x231 /* ..8 Debug Control Register 3 */ #define SPR_IBAT4L 0x231 /* .6. Instruction BAT Reg 4 Lower */ -#define SPR_IC_DAT 0x232 /* ..8 Instruction Cache Data */ #define SPR_IBAT5U 0x232 /* .6. Instruction BAT Reg 5 Upper */ #define SPR_IBAT5L 0x233 /* .6. Instruction BAT Reg 5 Lower */ +#define SPR_DBCR4 0x233 /* ..8 Debug Control Register 4 */ #define SPR_IBAT6U 0x234 /* .6. Instruction BAT Reg 6 Upper */ +#define SPR_DBCR5 0x234 /* ..8 Debug Control Register 5 */ #define SPR_IBAT6L 0x235 /* .6. Instruction BAT Reg 6 Lower */ +#define SPR_IAC5 0x235 /* ..8 Instruction Address Compare 5 */ #define SPR_IBAT7U 0x236 /* .6. Instruction BAT Reg 7 Upper */ +#define SPR_IAC6 0x236 /* ..8 Instruction Address Compare 6 */ #define SPR_IBAT7L 0x237 /* .6. Instruction BAT Reg 7 Lower */ -#define SPR_DC_CST 0x230 /* ..8 Data Cache CSR */ -#define DC_CST_DEN 0x80000000 /* D cache ENabled (RO) */ -#define DC_CST_DFWT 0x40000000 /* D cache Force Write-Thru (RO) */ -#define DC_CST_LES 0x20000000 /* D cache Little Endian Swap (RO) */ -#define DC_CST_CMD_FLUSH 0x0e000000 /* D cache invalidate all */ -#define DC_CST_CMD_INVALL 0x0c000000 /* D cache invalidate all */ -#define DC_CST_CMD_UNLOCKALL 0x0a000000 /* D cache unlock all */ -#define DC_CST_CMD_UNLOCK 0x08000000 /* D cache unlock block */ -#define DC_CST_CMD_CLRLESWAP 0x07000000 /* D cache clr little-endian swap */ -#define DC_CST_CMD_LOADLOCK 0x06000000 /* D cache load & lock block */ -#define DC_CST_CMD_SETLESWAP 0x05000000 /* D cache set little-endian swap */ -#define DC_CST_CMD_DISABLE 0x04000000 /* D cache disable */ -#define DC_CST_CMD_CLRFWT 0x03000000 /* D cache clear forced write-thru */ -#define DC_CST_CMD_ENABLE 0x02000000 /* D cache enable */ -#define DC_CST_CMD_SETFWT 0x01000000 /* D cache set forced write-thru */ -#define DC_CST_CCER1 0x00200000 /* D cache error type 1 (RO) */ -#define DC_CST_CCER2 0x00100000 /* D cache error type 2 (RO) */ -#define DC_CST_CCER3 0x00080000 /* D cache error type 3 (RO) */ +#define SPR_IAC7 0x237 /* ..8 Instruction Address Compare 7 */ #define SPR_DBAT4U 0x238 /* .6. Data BAT Reg 4 Upper */ -#define SPR_DC_ADR 0x231 /* ..8 Data Cache Address */ +#define SPR_IAC8 0x238 /* ..8 Instruction Address Compare 8 */ #define SPR_DBAT4L 0x239 /* .6. Data BAT Reg 4 Lower */ -#define SPR_DC_DAT 0x232 /* ..8 Data Cache Data */ #define SPR_DBAT5U 0x23a /* .6. Data BAT Reg 5 Upper */ #define SPR_DBAT5L 0x23b /* .6. Data BAT Reg 5 Lower */ #define SPR_DBAT6U 0x23c /* .6. Data BAT Reg 6 Upper */ #define SPR_DBAT6L 0x23d /* .6. Data BAT Reg 6 Lower */ #define SPR_DBAT7U 0x23e /* .6. Data BAT Reg 7 Upper */ #define SPR_DBAT7L 0x23f /* .6. Data BAT Reg 7 Lower */ +#define SPR_DBCR6 0x25b /* ..8 Debug Control Register 6 */ #define SPR_SPRG8 0x25c /* ..8 SPR General 8 */ -#define SPR_MI_CTR 0x310 /* ..8 IMMU control */ -#define Mx_CTR_GPM 0x80000000 /* Group Protection Mode */ -#define Mx_CTR_PPM 0x40000000 /* Page Protection Mode */ -#define Mx_CTR_CIDEF 0x20000000 /* Cache-Inhibit DEFault */ -#define MD_CTR_WTDEF 0x20000000 /* Write-Through DEFault */ -#define Mx_CTR_RSV4 0x08000000 /* Reserve 4 TLB entries */ -#define MD_CTR_TWAM 0x04000000 /* TableWalk Assist Mode */ -#define Mx_CTR_PPCS 0x02000000 /* Priv/user state compare mode */ -#define Mx_CTR_TLB_INDX 0x000001f0 /* TLB index mask */ -#define Mx_CTR_TLB_INDX_BITPOS 8 /* TLB index shift */ - -#define SPR_MI_AP 0x312 /* ..8 IMMU access protection */ -#define Mx_GP_SUPER(n) (0 << (2*(15-(n)))) /* access is supervisor */ -#define Mx_GP_PAGE (1 << (2*(15-(n)))) /* access is page protect */ -#define Mx_GP_SWAPPED (2 << (2*(15-(n)))) /* access is swapped */ -#define Mx_GP_USER (3 << (2*(15-(n)))) /* access is user */ -#define SPR_MI_EPN 0x313 /* ..8 IMMU effective number */ -#define Mx_EPN_EPN 0xfffff000 /* Effective Page Number mask */ -#define Mx_EPN_EV 0x00000020 /* Entry Valid */ -#define Mx_EPN_ASID 0x0000000f /* Address Space ID */ -#define SPR_MI_TWC 0x315 /* ..8 IMMU tablewalk control */ -#define MD_TWC_L2TB 0xfffff000 /* Level-2 Tablewalk Base */ -#define Mx_TWC_APG 0x000001e0 /* Access Protection Group */ -#define Mx_TWC_G 0x00000010 /* Guarded memory */ -#define Mx_TWC_PS 0x0000000c /* Page Size (L1) */ -#define MD_TWC_WT 0x00000002 /* Write-Through */ -#define Mx_TWC_V 0x00000001 /* Entry Valid */ -#define SPR_MI_RPN 0x316 /* ..8 IMMU real (phys) page number */ -#define Mx_RPN_RPN 0xfffff000 /* Real Page Number */ -#define Mx_RPN_PP 0x00000ff0 /* Page Protection */ -#define Mx_RPN_SPS 0x00000008 /* Small Page Size */ -#define Mx_RPN_SH 0x00000004 /* SHared page */ -#define Mx_RPN_CI 0x00000002 /* Cache Inhibit */ -#define Mx_RPN_V 0x00000001 /* Valid */ -#define SPR_MD_CTR 0x318 /* ..8 DMMU control */ -#define SPR_M_CASID 0x319 /* ..8 CASID */ -#define M_CASID 0x0000000f /* Current AS Id */ -#define SPR_MD_AP 0x31a /* ..8 DMMU access protection */ -#define SPR_MD_EPN 0x31b /* ..8 DMMU effective number */ #define SPR_MMCRA 0x312 /* ... Monitor Mode Control Register A */ #define SPR_PMC1 0x313 /* ... PMC 1 */ From owner-dev-commits-src-main@freebsd.org Sun May 30 02:54: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 2078464D2B6; Sun, 30 May 2021 02:54: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 4Ft30V6p9qz3Hns; Sun, 30 May 2021 02:54: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 B958215D1B; Sun, 30 May 2021 02:54: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 14U2s2IV010317; Sun, 30 May 2021 02:54:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14U2s2tT010316; Sun, 30 May 2021 02:54:02 GMT (envelope-from git) Date: Sun, 30 May 2021 02:54:02 GMT Message-Id: <202105300254.14U2s2tT010316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 66b2b71df8aa - main - Wrap the default SPE config in its own #define MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66b2b71df8aa12b19862bfdc19acc0498165ab53 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, 30 May 2021 02:54:03 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=66b2b71df8aa12b19862bfdc19acc0498165ab53 commit 66b2b71df8aa12b19862bfdc19acc0498165ab53 Author: Justin Hibbits AuthorDate: 2021-05-30 02:53:26 +0000 Commit: Justin Hibbits CommitDate: 2021-05-30 02:53:26 +0000 Wrap the default SPE config in its own #define No functional change. Cleans up the code a little. --- sys/powerpc/include/spr.h | 2 ++ sys/powerpc/powerpc/exec_machdep.c | 6 ++---- sys/powerpc/powerpc/swtch32.S | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/powerpc/include/spr.h b/sys/powerpc/include/spr.h index a97e49e77d76..2e2c3306cee1 100644 --- a/sys/powerpc/include/spr.h +++ b/sys/powerpc/include/spr.h @@ -337,6 +337,8 @@ #define SPEFSCR_FUNFE 0x00000008 #define SPEFSCR_FOVFE 0x00000004 #define SPEFSCR_FRMC_M 0x00000003 +#define SPEFSCR_DFLT (SPEFSCR_FINVE | SPEFSCR_FDBZE | \ + SPEFSCR_FUNFE | SPEFSCR_FOVFE) #define SPR_IBAT0U 0x210 /* .6. Instruction BAT Reg 0 Upper */ #define SPR_IBAT0L 0x211 /* .6. Instruction BAT Reg 0 Lower */ #define SPR_IBAT1U 0x212 /* .6. Instruction BAT Reg 1 Upper */ diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index 97e4caba956a..869fad96e2bd 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -1057,8 +1057,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) #endif pcb2->pcb_cpu.aim.usr_vsid = 0; #ifdef __SPE__ - pcb2->pcb_vec.vscr = SPEFSCR_FINVE | SPEFSCR_FDBZE | - SPEFSCR_FUNFE | SPEFSCR_FOVFE; + pcb2->pcb_vec.vscr = SPEFSCR_DFLT; #endif /* Setup to release spin count in fork_exit(). */ @@ -1113,8 +1112,7 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, td->td_pcb->pcb_flags = 0; #ifdef __SPE__ - td->td_pcb->pcb_vec.vscr = SPEFSCR_FINVE | SPEFSCR_FDBZE | - SPEFSCR_FUNFE | SPEFSCR_FOVFE; + td->td_pcb->pcb_vec.vscr = SPEFSCR_DFLT; #endif td->td_retval[0] = (register_t)entry; diff --git a/sys/powerpc/powerpc/swtch32.S b/sys/powerpc/powerpc/swtch32.S index 6ad781895dc3..dba0171577a4 100644 --- a/sys/powerpc/powerpc/swtch32.S +++ b/sys/powerpc/powerpc/swtch32.S @@ -224,7 +224,7 @@ ENTRY(fork_trampoline) does when allocating space for a frame pointer/saved LR */ #ifdef __SPE__ - li %r3,SPEFSCR_FINVE|SPEFSCR_FDBZE|SPEFSCR_FUNFE|SPEFSCR_FOVFE + li %r3,SPEFSCR_DFLT mtspr SPR_SPEFSCR, %r3 #endif b trapexit From owner-dev-commits-src-main@freebsd.org Sun May 30 02:54: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 4BEC264D1DD; Sun, 30 May 2021 02:54: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 4Ft30W6sxDz3Hp0; Sun, 30 May 2021 02:54: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 D0E5015D80; Sun, 30 May 2021 02:54: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 14U2s3Pa010339; Sun, 30 May 2021 02:54:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14U2s3et010338; Sun, 30 May 2021 02:54:03 GMT (envelope-from git) Date: Sun, 30 May 2021 02:54:03 GMT Message-Id: <202105300254.14U2s3et010338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 2b9a828c9949 - main - Set default SPE FP environment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b9a828c99499d3ca574575afd5d01b1539a2c66 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, 30 May 2021 02:54:04 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=2b9a828c99499d3ca574575afd5d01b1539a2c66 commit 2b9a828c99499d3ca574575afd5d01b1539a2c66 Author: Justin Hibbits AuthorDate: 2021-05-30 02:53:35 +0000 Commit: Justin Hibbits CommitDate: 2021-05-30 02:53:35 +0000 Set default SPE FP environment --- lib/msun/powerpc/fenv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/msun/powerpc/fenv.c b/lib/msun/powerpc/fenv.c index 7f7d98515995..1a5644547958 100644 --- a/lib/msun/powerpc/fenv.c +++ b/lib/msun/powerpc/fenv.c @@ -39,7 +39,11 @@ #error "This file must be compiled with C99 'inline' semantics" #endif +#ifdef __SPE__ +const fenv_t __fe_dfl_env = SPEFSCR_DFLT; +#else const fenv_t __fe_dfl_env = 0x00000000; +#endif extern inline int feclearexcept(int __excepts); extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); From owner-dev-commits-src-main@freebsd.org Sun May 30 10:31: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 8113B653051; Sun, 30 May 2021 10:31: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 4FtF8R35znz4ZCp; Sun, 30 May 2021 10:31: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 52D4E1B1F9; Sun, 30 May 2021 10:31: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 14UAVZop017227; Sun, 30 May 2021 10:31:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14UAVZ09017226; Sun, 30 May 2021 10:31:35 GMT (envelope-from git) Date: Sun, 30 May 2021 10:31:35 GMT Message-Id: <202105301031.14UAVZ09017226@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: 8e55a80e0cc5 - main - [netflow] fix gateway reporting in ng_netflow 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: 8e55a80e0cc53002979f04a2504d2167267db3c2 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, 30 May 2021 10:31:35 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=8e55a80e0cc53002979f04a2504d2167267db3c2 commit 8e55a80e0cc53002979f04a2504d2167267db3c2 Author: Alexander V. Chernikov AuthorDate: 2021-05-30 10:11:08 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-05-30 10:12:49 +0000 [netflow] fix gateway reporting in ng_netflow Reported by: Guy Yur MFC after: 3 days --- sys/netgraph/netflow/netflow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c index e9fb83773a4b..f7f0648b296f 100644 --- a/sys/netgraph/netflow/netflow.c +++ b/sys/netgraph/netflow/netflow.c @@ -360,7 +360,7 @@ hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, rt_get_inet_prefix_plen(rt, &addr, &plen, &scopeid); fle->f.fle_o_ifx = nh->nh_ifp->if_index; - if (nh->gw_sa.sa_len == AF_INET) + if (nh->gw_sa.sa_family == AF_INET) fle->f.next_hop = nh->gw4_sa.sin_addr; fle->f.dst_mask = plen; } @@ -434,7 +434,7 @@ hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r, rt_get_inet6_prefix_plen(rt, &addr, &plen, &scopeid); fle6->f.fle_o_ifx = nh->nh_ifp->if_index; - if (nh->gw_sa.sa_len == AF_INET6) + if (nh->gw_sa.sa_family == AF_INET6) fle6->f.n.next_hop6 = nh->gw6_sa.sin6_addr; fle6->f.dst_mask = plen; } From owner-dev-commits-src-main@freebsd.org Sun May 30 13:44: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 932D4656000; Sun, 30 May 2021 13:44: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 4FtKR43dnbz4mZd; Sun, 30 May 2021 13:44: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 644841DF2E; Sun, 30 May 2021 13:44: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 14UDiWaD069037; Sun, 30 May 2021 13:44:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14UDiW4l069036; Sun, 30 May 2021 13:44:32 GMT (envelope-from git) Date: Sun, 30 May 2021 13:44:32 GMT Message-Id: <202105301344.14UDiW4l069036@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: 66e2a5803b0f - main - iwn(4): Remove duplicate device entry 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: 66e2a5803b0f80fff3bb8e3659ae7411ef94cc35 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, 30 May 2021 13:44:32 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=66e2a5803b0f80fff3bb8e3659ae7411ef94cc35 commit 66e2a5803b0f80fff3bb8e3659ae7411ef94cc35 Author: Gordon Bergling AuthorDate: 2021-05-30 13:40:33 +0000 Commit: Gordon Bergling CommitDate: 2021-05-30 13:40:33 +0000 iwn(4): Remove duplicate device entry 'Intel Centrino Wireless-N 6250' is listed twice in the description section of the manual page. PR: 256257 Reported by: Daniel Cervus MFC after: 3 days --- share/man/man4/iwn.4 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/share/man/man4/iwn.4 b/share/man/man4/iwn.4 index b333aacae5fd..6e9b774bb13d 100644 --- a/share/man/man4/iwn.4 +++ b/share/man/man4/iwn.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 30, 2014 +.Dd May 30, 2021 .Dt IWN 4 .Os .Sh NAME @@ -111,7 +111,6 @@ driver provides support for: .It Intel Centrino Wireless-N 6150 .It Intel Centrino Wireless-N 6200 .It Intel Centrino Wireless-N 6250 -.It Intel Centrino Wireless-N 6250 .It Intel Centrino Wireless-N + WiMAX 6150 .It Intel Ultimate N WiFi Link 5300 .It Intel Wireless WiFi Link 4965 From owner-dev-commits-src-main@freebsd.org Sun May 30 13:47: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 368B365608E; Sun, 30 May 2021 13:47: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 4FtKVy14Q8z4mnM; Sun, 30 May 2021 13:47: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 089951DCC7; Sun, 30 May 2021 13:47: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 14UDlrXj069387; Sun, 30 May 2021 13:47:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14UDlrg9069386; Sun, 30 May 2021 13:47:53 GMT (envelope-from git) Date: Sun, 30 May 2021 13:47:53 GMT Message-Id: <202105301347.14UDlrg9069386@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: b03a41befeaf - main - libalias: Fix nameing and initialization of a constant MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b03a41befeaf17ef25da96fc7bc2dc19c9a6b253 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, 30 May 2021 13:47:54 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=b03a41befeaf17ef25da96fc7bc2dc19c9a6b253 commit b03a41befeaf17ef25da96fc7bc2dc19c9a6b253 Author: Lutz Donnerhacke AuthorDate: 2021-05-30 13:41:24 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-30 13:47:29 +0000 libalias: Fix nameing and initialization of a constant The commit 189f8eea contains a refactorisation of a constant. During later review D30283 the naming of the constant was improved and the initialization became explicit. Put this into the tree, in order to MFC the correct naming. --- sys/netinet/libalias/alias_db.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 518f221c63f9..7a84cf310d5a 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -224,9 +224,8 @@ static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); #define NO_DEST_PORT 1 #define NO_SRC_PORT 1 -/* Dummy address used for FindLinkIn/Out() and AddLink(). - The value of this variable is never used. */ -static struct in_addr const NO_ADDR; +/* Matches any/unknown address in FindLinkIn/Out() and AddLink(). */ +static struct in_addr const ANY_ADDR = { INADDR_ANY }; /* Data Structures @@ -1115,12 +1114,12 @@ _FindLinkOut(struct libalias *la, struct in_addr src_addr, lnk = _FindLinkOut(la, src_addr, dst_addr, src_port, 0, link_type, 0); if (lnk == NULL) - lnk = _FindLinkOut(la, src_addr, NO_ADDR, src_port, + lnk = _FindLinkOut(la, src_addr, ANY_ADDR, src_port, dst_port, link_type, 0); } if (lnk == NULL && (dst_port != 0 || dst_addr.s_addr != INADDR_ANY)) { - lnk = _FindLinkOut(la, src_addr, NO_ADDR, src_port, 0, + lnk = _FindLinkOut(la, src_addr, ANY_ADDR, src_port, 0, link_type, 0); } if (lnk != NULL) { @@ -1156,7 +1155,7 @@ FindLinkOut(struct libalias *la, struct in_addr src_addr, */ if (la->aliasAddress.s_addr != INADDR_ANY && src_addr.s_addr == la->aliasAddress.s_addr) { - lnk = _FindLinkOut(la, NO_ADDR, dst_addr, src_port, dst_port, + lnk = _FindLinkOut(la, ANY_ADDR, dst_addr, src_port, dst_port, link_type, replace_partial_links); } } @@ -1298,7 +1297,7 @@ FindLinkIn(struct libalias *la, struct in_addr dst_addr, */ if (la->aliasAddress.s_addr != INADDR_ANY && alias_addr.s_addr == la->aliasAddress.s_addr) { - lnk = _FindLinkIn(la, dst_addr, NO_ADDR, dst_port, alias_port, + lnk = _FindLinkIn(la, dst_addr, ANY_ADDR, dst_port, alias_port, link_type, replace_partial_links); } } @@ -1380,7 +1379,7 @@ FindFragmentIn1(struct libalias *la, struct in_addr dst_addr, LINK_FRAGMENT_ID, 0); if (lnk == NULL) { - lnk = AddLink(la, NO_ADDR, dst_addr, alias_addr, + lnk = AddLink(la, ANY_ADDR, dst_addr, alias_addr, NO_SRC_PORT, NO_DEST_PORT, ip_id, LINK_FRAGMENT_ID); } @@ -1403,7 +1402,7 @@ AddFragmentPtrLink(struct libalias *la, struct in_addr dst_addr, u_short ip_id) { LIBALIAS_LOCK_ASSERT(la); - return AddLink(la, NO_ADDR, dst_addr, NO_ADDR, + return AddLink(la, ANY_ADDR, dst_addr, ANY_ADDR, NO_SRC_PORT, NO_DEST_PORT, ip_id, LINK_FRAGMENT_PTR); } @@ -1413,7 +1412,7 @@ FindFragmentPtr(struct libalias *la, struct in_addr dst_addr, u_short ip_id) { LIBALIAS_LOCK_ASSERT(la); - return FindLinkIn(la, dst_addr, NO_ADDR, + return FindLinkIn(la, dst_addr, ANY_ADDR, NO_DEST_PORT, ip_id, LINK_FRAGMENT_PTR, 0); } @@ -1673,7 +1672,7 @@ FindOriginalAddress(struct libalias *la, struct in_addr alias_addr) struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); - lnk = FindLinkIn(la, NO_ADDR, alias_addr, + lnk = FindLinkIn(la, ANY_ADDR, alias_addr, 0, 0, LINK_ADDR, 0); if (lnk == NULL) { la->newDefaultLink = 1; @@ -1705,7 +1704,7 @@ FindAliasAddress(struct libalias *la, struct in_addr original_addr) struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); - lnk = FindLinkOut(la, original_addr, NO_ADDR, + lnk = FindLinkOut(la, original_addr, ANY_ADDR, 0, 0, LINK_ADDR, 0); if (lnk == NULL) { return (la->aliasAddress.s_addr != INADDR_ANY) ? @@ -2321,7 +2320,7 @@ LibAliasRedirectAddr(struct libalias *la, struct in_addr src_addr, struct alias_link *lnk; LIBALIAS_LOCK(la); - lnk = AddLink(la, src_addr, NO_ADDR, alias_addr, + lnk = AddLink(la, src_addr, ANY_ADDR, alias_addr, 0, 0, 0, LINK_ADDR); From owner-dev-commits-src-main@freebsd.org Sun May 30 17:19: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 0A77A63067B; Sun, 30 May 2021 17:19: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 4FtQCd6bkfz3KgY; Sun, 30 May 2021 17:19: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 CAAFE20C9B; Sun, 30 May 2021 17:19: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 14UHJvs9048389; Sun, 30 May 2021 17:19:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14UHJvpU048388; Sun, 30 May 2021 17:19:57 GMT (envelope-from git) Date: Sun, 30 May 2021 17:19:57 GMT Message-Id: <202105301719.14UHJvpU048388@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: 284cf3f18b53 - main - ext2: add missing uio_td initialization to ext2_htree_append_block 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: 284cf3f18b5395e29e128702d50342d706813773 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, 30 May 2021 17:19:58 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=284cf3f18b5395e29e128702d50342d706813773 commit 284cf3f18b5395e29e128702d50342d706813773 Author: Mateusz Guzik AuthorDate: 2021-05-30 17:14:02 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-30 17:19:31 +0000 ext2: add missing uio_td initialization to ext2_htree_append_block Reported by: pho --- sys/fs/ext2fs/ext2_htree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/ext2fs/ext2_htree.c b/sys/fs/ext2fs/ext2_htree.c index 44120940236a..84f3d26d252a 100644 --- a/sys/fs/ext2fs/ext2_htree.c +++ b/sys/fs/ext2fs/ext2_htree.c @@ -439,6 +439,7 @@ ext2_htree_append_block(struct vnode *vp, char *data, auio.uio_iovcnt = 1; auio.uio_rw = UIO_WRITE; auio.uio_segflg = UIO_SYSSPACE; + auio.uio_td = NULL; error = VOP_WRITE(vp, &auio, IO_SYNC, cnp->cn_cred); if (!error) dp->i_size = newsize; From owner-dev-commits-src-main@freebsd.org Sun May 30 20:02: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 0D143633CAF; Sun, 30 May 2021 20:02: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 4FtTq370JYz3mPP; Sun, 30 May 2021 20:02: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 D906023062; Sun, 30 May 2021 20:02: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 14UK2NIM073999; Sun, 30 May 2021 20:02:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14UK2NdN073997; Sun, 30 May 2021 20:02:23 GMT (envelope-from git) Date: Sun, 30 May 2021 20:02:23 GMT Message-Id: <202105302002.14UK2NdN073997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Sean Eric Fagan Subject: git: 505dc43562d9 - main - The zone(9) man page had two entries for uma_reclaim(), one with an argument (correct), and one without (incorrect). Pointed out by Allan Jude. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 505dc43562d9ef4ea1f72e261139456f1d35387c 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, 30 May 2021 20:02:24 -0000 The branch main has been updated by sef: URL: https://cgit.FreeBSD.org/src/commit/?id=505dc43562d9ef4ea1f72e261139456f1d35387c commit 505dc43562d9ef4ea1f72e261139456f1d35387c Author: Sean Eric Fagan AuthorDate: 2021-05-30 19:26:03 +0000 Commit: Sean Eric Fagan CommitDate: 2021-05-30 20:02:11 +0000 The zone(9) man page had two entries for uma_reclaim(), one with an argument (correct), and one without (incorrect). Pointed out by Allan Jude. --- share/man/man9/zone.9 | 2 -- 1 file changed, 2 deletions(-) diff --git a/share/man/man9/zone.9 b/share/man/man9/zone.9 index 89d5f3e2640f..77776c50bc5d 100644 --- a/share/man/man9/zone.9 +++ b/share/man/man9/zone.9 @@ -119,8 +119,6 @@ typedef void (*uma_free)(void *item, vm_size_t size, uint8_t pflag); .Fn uma_zone_set_warning "uma_zone_t zone" "const char *warning" .Ft void .Fn uma_zone_set_maxaction "uma_zone_t zone" "void (*maxaction)(uma_zone_t)" -.Ft void -.Fn uma_reclaim .In sys/sysctl.h .Fn SYSCTL_UMA_MAX parent nbr name access zone descr .Fn SYSCTL_ADD_UMA_MAX ctx parent nbr name access zone descr From owner-dev-commits-src-main@freebsd.org Sun May 30 21:52: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 79912638350; Sun, 30 May 2021 21:52: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 4FtXGM2pxbz4bQX; Sun, 30 May 2021 21:52: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 492E124820; Sun, 30 May 2021 21:52: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 14ULqhaW026362; Sun, 30 May 2021 21:52:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ULqh3g026361; Sun, 30 May 2021 21:52:43 GMT (envelope-from git) Date: Sun, 30 May 2021 21:52:43 GMT Message-Id: <202105302152.14ULqh3g026361@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: a4b07a2701f5 - main - VFS_QUOTACTL(9): allow implementation to indicate busy state changes 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: a4b07a2701f568c2c0f0c0426091f1489244a92d 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, 30 May 2021 21:52:43 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=a4b07a2701f568c2c0f0c0426091f1489244a92d commit a4b07a2701f568c2c0f0c0426091f1489244a92d Author: Jason A. Harmening AuthorDate: 2021-05-11 15:54:58 +0000 Commit: Jason A. Harmening CommitDate: 2021-05-30 21:53:47 +0000 VFS_QUOTACTL(9): allow implementation to indicate busy state changes Instead of requiring all implementations of vfs_quotactl to unbusy the mount for Q_QUOTAON and Q_QUOTAOFF, add an "mp_busy" in/out param to VFS_QUOTACTL(9). The implementation may then indicate to the caller whether it needed to unbusy the mount. Also, add stbool.h to libprocstat modules which #define _KERNEL before including sys/mount.h. Otherwise they'll pull in sys/types.h before defining _KERNEL and therefore won't have the bool definition they need for mp_busy. Reviewed By: kib, markj Differential Revision: https://reviews.freebsd.org/D30556 --- lib/libprocstat/msdosfs.c | 2 ++ lib/libprocstat/smbfs.c | 2 ++ lib/libprocstat/udf.c | 2 ++ lib/libprocstat/zfs.c | 2 ++ share/man/man9/VFS_QUOTACTL.9 | 32 ++++++++++++++++++++-- .../openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 15 ++++++++++ sys/fs/nullfs/null_vfsops.c | 30 ++++++++++++++++++-- sys/fs/smbfs/smbfs_vfsops.c | 3 +- sys/fs/unionfs/union_vfsops.c | 28 +++++++++++++++++-- sys/kern/vfs_default.c | 4 +-- sys/kern/vfs_init.c | 6 ++-- sys/kern/vfs_syscalls.c | 19 ++++++------- sys/sys/mount.h | 8 ++++-- sys/sys/param.h | 2 +- sys/ufs/ufs/quota.h | 2 +- sys/ufs/ufs/ufs_quota.c | 21 ++++++-------- sys/ufs/ufs/ufs_vfsops.c | 19 +++++-------- 17 files changed, 144 insertions(+), 53 deletions(-) diff --git a/lib/libprocstat/msdosfs.c b/lib/libprocstat/msdosfs.c index 3541f252c713..c77e8a803211 100644 --- a/lib/libprocstat/msdosfs.c +++ b/lib/libprocstat/msdosfs.c @@ -39,6 +39,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include #include diff --git a/lib/libprocstat/smbfs.c b/lib/libprocstat/smbfs.c index 86da07d62acd..990ab13a8085 100644 --- a/lib/libprocstat/smbfs.c +++ b/lib/libprocstat/smbfs.c @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include #include diff --git a/lib/libprocstat/udf.c b/lib/libprocstat/udf.c index 6cf765ce0f5f..c80156cf2d04 100644 --- a/lib/libprocstat/udf.c +++ b/lib/libprocstat/udf.c @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include #include diff --git a/lib/libprocstat/zfs.c b/lib/libprocstat/zfs.c index 066b0053a245..87be854fc743 100644 --- a/lib/libprocstat/zfs.c +++ b/lib/libprocstat/zfs.c @@ -28,6 +28,8 @@ * $FreeBSD$ */ +#include + #include #define _KERNEL #include diff --git a/share/man/man9/VFS_QUOTACTL.9 b/share/man/man9/VFS_QUOTACTL.9 index 8d0cb113ce1e..210f71631353 100644 --- a/share/man/man9/VFS_QUOTACTL.9 +++ b/share/man/man9/VFS_QUOTACTL.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2020 +.Dd May 29, 2021 .Dt VFS_QUOTACTL 9 .Os .Sh NAME @@ -39,12 +39,38 @@ .In sys/mount.h .In sys/vnode.h .Ft int -.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "void *arg" +.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "void *arg" "bool *mp_busy" .Sh DESCRIPTION Implement file system quotas. +.Pp +The +.Fa mp_busy +argument is an input/output parameter. +.Fn VFS_QUOTACTL +must be called with +.Fa mp +marked busy through +.Xr vfs_busy 9 +and +.Fa *mp_busy +set to true. +The filesystem implementation of +.Fn VFS_QUOTACTL +may then unbusy +.Fa mp +using +.Xr vfs_unbusy 9 +prior to performing quota file I/O. +In this case the implementation must set +.Fa *mp_busy +to false to indicate that the caller must not unbusy +.Fa mp +upon completion of +.Fn VFS_QUOTACTL . +.Pp See .Xr quotactl 2 -for a description of the arguments. +for a description of the remaining arguments. .Sh SEE ALSO .Xr quotactl 2 , .Xr vnode 9 diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index a537342f9678..4f2d7df87fc0 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -102,7 +102,12 @@ SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0, "ZPL_VERSION"); /* END CSTYLED */ +#if __FreeBSD_version >= 1400018 +static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, + bool *mp_busy); +#else static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg); +#endif static int zfs_mount(vfs_t *vfsp); static int zfs_umount(vfs_t *vfsp, int fflag); static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); @@ -267,7 +272,11 @@ done: } static int +#if __FreeBSD_version >= 1400018 +zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, bool *mp_busy) +#else zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) +#endif { zfsvfs_t *zfsvfs = vfsp->vfs_data; struct thread *td; @@ -291,8 +300,10 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) break; default: error = EINVAL; +#if __FreeBSD_version < 1400018 if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) vfs_unbusy(vfsp); +#endif goto done; } } @@ -351,11 +362,15 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) case Q_QUOTAON: // As far as I can tell, you can't turn quotas on or off on zfs error = 0; +#if __FreeBSD_version < 1400018 vfs_unbusy(vfsp); +#endif break; case Q_QUOTAOFF: error = ENOTSUP; +#if __FreeBSD_version < 1400018 vfs_unbusy(vfsp); +#endif break; case Q_SETQUOTA: error = copyin(arg, &dqblk, sizeof (dqblk)); diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 0bb98072edf4..0ad2385116a9 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -294,13 +294,39 @@ nullfs_root(mp, flags, vpp) } static int -nullfs_quotactl(mp, cmd, uid, arg) +nullfs_quotactl(mp, cmd, uid, arg, mp_busy) struct mount *mp; int cmd; uid_t uid; void *arg; + bool *mp_busy; { - return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg); + struct mount *lowermp; + struct null_mount *mntdata; + int error; + bool unbusy; + + mntdata = MOUNTTONULLMOUNT(mp); + lowermp = atomic_load_ptr(&mntdata->nullm_vfs); + KASSERT(*mp_busy == true, ("upper mount not busy")); + /* + * See comment in sys_quotactl() for an explanation of why the + * lower mount needs to be busied by the caller of VFS_QUOTACTL() + * but may be unbusied by the implementation. We must unbusy + * the upper mount for the same reason; otherwise a namei lookup + * issued by the VFS_QUOTACTL() implementation could traverse the + * upper mount and deadlock. + */ + vfs_unbusy(mp); + *mp_busy = false; + unbusy = true; + error = vfs_busy(lowermp, 0); + if (error == 0) + error = VFS_QUOTACTL(lowermp, cmd, uid, arg, &unbusy); + if (unbusy) + vfs_unbusy(lowermp); + + return (error); } static int diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index d19816a7869c..a1ae565c6341 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -352,11 +352,12 @@ out: */ /* ARGSUSED */ static int -smbfs_quotactl(mp, cmd, uid, arg) +smbfs_quotactl(mp, cmd, uid, arg, mp_busy) struct mount *mp; int cmd; uid_t uid; void *arg; + bool *mp_busy; { SMBVDEBUG("return EOPNOTSUPP\n"); return EOPNOTSUPP; diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index ae95bd9c005c..bd264c7bcdb5 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -371,16 +371,38 @@ unionfs_root(struct mount *mp, int flags, struct vnode **vpp) } static int -unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg) +unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg, + bool *mp_busy) { + struct mount *uppermp; struct unionfs_mount *ump; + int error; + bool unbusy; ump = MOUNTTOUNIONFSMOUNT(mp); - + uppermp = atomic_load_ptr(&ump->um_uppervp->v_mount); + KASSERT(*mp_busy == true, ("upper mount not busy")); + /* + * See comment in sys_quotactl() for an explanation of why the + * lower mount needs to be busied by the caller of VFS_QUOTACTL() + * but may be unbusied by the implementation. We must unbusy + * the upper mount for the same reason; otherwise a namei lookup + * issued by the VFS_QUOTACTL() implementation could traverse the + * upper mount and deadlock. + */ + vfs_unbusy(mp); + *mp_busy = false; + unbusy = true; + error = vfs_busy(uppermp, 0); /* * Writing is always performed to upper vnode. */ - return (VFS_QUOTACTL(ump->um_uppervp->v_mount, cmd, uid, arg)); + if (error == 0) + error = VFS_QUOTACTL(uppermp, cmd, uid, arg, &unbusy); + if (unbusy) + vfs_unbusy(uppermp); + + return (error); } static int diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index ace9ad1d37c3..63bca7810847 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1350,13 +1350,13 @@ vfs_stdstatfs (mp, sbp) } int -vfs_stdquotactl (mp, cmds, uid, arg) +vfs_stdquotactl (mp, cmds, uid, arg, mp_busy) struct mount *mp; int cmds; uid_t uid; void *arg; + bool *mp_busy; { - return (EOPNOTSUPP); } diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 3365ddb11474..112b4c76e575 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -212,12 +212,14 @@ vfs_cachedroot_sigdefer(struct mount *mp, int flags, struct vnode **vpp) } static int -vfs_quotactl_sigdefer(struct mount *mp, int cmd, uid_t uid, void *arg) +vfs_quotactl_sigdefer(struct mount *mp, int cmd, uid_t uid, void *arg, + bool *mp_busy) { int prev_stops, rc; prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); - rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_quotactl)(mp, cmd, uid, arg); + rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_quotactl)(mp, cmd, uid, arg, + mp_busy); sigallowstop(prev_stops); return (rc); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 55780b0474ee..2f4a6036ef88 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -89,8 +89,6 @@ __FBSDID("$FreeBSD$"); #include -#include - MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); static int kern_chflagsat(struct thread *td, int fd, const char *path, @@ -195,6 +193,7 @@ sys_quotactl(struct thread *td, struct quotactl_args *uap) struct mount *mp; struct nameidata nd; int error; + bool mp_busy; AUDIT_ARG_CMD(uap->cmd); AUDIT_ARG_UID(uap->uid); @@ -213,21 +212,21 @@ sys_quotactl(struct thread *td, struct quotactl_args *uap) vfs_rel(mp); return (error); } - error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg); + mp_busy = true; + error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg, &mp_busy); /* - * Since quota on operation typically needs to open quota - * file, the Q_QUOTAON handler needs to unbusy the mount point + * Since quota on/off operations typically need to open quota + * files, the implementation may need to unbusy the mount point * before calling into namei. Otherwise, unmount might be - * started between two vfs_busy() invocations (first is our, + * started between two vfs_busy() invocations (first is ours, * second is from mount point cross-walk code in lookup()), * causing deadlock. * - * Require that Q_QUOTAON handles the vfs_busy() reference on - * its own, always returning with ubusied mount point. + * Avoid unbusying mp if the implementation indicates it has + * already done so. */ - if ((uap->cmd >> SUBCMDSHIFT) != Q_QUOTAON && - (uap->cmd >> SUBCMDSHIFT) != Q_QUOTAOFF) + if (mp_busy) vfs_unbusy(mp); vfs_rel(mp); return (error); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index a1d4bfd15ddb..6b2e6e7f7f13 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -38,6 +38,7 @@ #include #include #ifdef _KERNEL +#include #include #include #include @@ -759,7 +760,8 @@ struct mntarg; typedef int vfs_cmount_t(struct mntarg *ma, void *data, uint64_t flags); typedef int vfs_unmount_t(struct mount *mp, int mntflags); typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp); -typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg); +typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg, + bool *mp_busy); typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp); typedef int vfs_sync_t(struct mount *mp, int waitfor); typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags, @@ -832,10 +834,10 @@ vfs_statfs_t __vfs_statfs; _rc = (*(MP)->mnt_op->vfs_cachedroot)(MP, FLAGS, VPP); \ _rc; }) -#define VFS_QUOTACTL(MP, C, U, A) ({ \ +#define VFS_QUOTACTL(MP, C, U, A, MP_BUSY) ({ \ int _rc; \ \ - _rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A); \ + _rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, MP_BUSY); \ _rc; }) #define VFS_STATFS(MP, SBP) ({ \ diff --git a/sys/sys/param.h b/sys/sys/param.h index 959f0b94ca70..c63452973daf 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400017 +#define __FreeBSD_version 1400018 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/ufs/ufs/quota.h b/sys/ufs/ufs/quota.h index e154f8234705..eb3db9c300d0 100644 --- a/sys/ufs/ufs/quota.h +++ b/sys/ufs/ufs/quota.h @@ -232,7 +232,7 @@ int getinoquota(struct inode *); int qsync(struct mount *); int qsyncvp(struct vnode *); int quotaoff(struct thread *, struct mount *, int); -int quotaon(struct thread *, struct mount *, int, void *); +int quotaon(struct thread *, struct mount *, int, void *, bool *); int getquota32(struct thread *, struct mount *, u_long, int, void *); int setquota32(struct thread *, struct mount *, u_long, int, void *); int setuse32(struct thread *, struct mount *, u_long, int, void *); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 4dff74f75945..143e0afbf1e3 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -492,7 +492,8 @@ chkdquot(struct inode *ip) * Q_QUOTAON - set up a quota file for a particular filesystem. */ int -quotaon(struct thread *td, struct mount *mp, int type, void *fname) +quotaon(struct thread *td, struct mount *mp, int type, void *fname, + bool *mp_busy) { struct ufsmount *ump; struct vnode *vp, **vpp; @@ -502,15 +503,11 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) struct nameidata nd; error = priv_check(td, PRIV_UFS_QUOTAON); - if (error != 0) { - vfs_unbusy(mp); + if (error != 0) return (error); - } - if ((mp->mnt_flag & MNT_RDONLY) != 0) { - vfs_unbusy(mp); + if ((mp->mnt_flag & MNT_RDONLY) != 0) return (EROFS); - } ump = VFSTOUFS(mp); dq = NODQUOT; @@ -518,7 +515,9 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, td); flags = FREAD | FWRITE; vfs_ref(mp); + KASSERT(*mp_busy, ("%s called without busied mount", __func__)); vfs_unbusy(mp); + *mp_busy = false; error = vn_open(&nd, &flags, 0, NULL); if (error != 0) { vfs_rel(mp); @@ -529,10 +528,9 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) error = vfs_busy(mp, MBF_NOWAIT); vfs_rel(mp); if (error == 0) { - if (vp->v_type != VREG) { + *mp_busy = true; + if (vp->v_type != VREG) error = EACCES; - vfs_unbusy(mp); - } } if (error != 0) { VOP_UNLOCK(vp); @@ -545,7 +543,6 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) UFS_UNLOCK(ump); VOP_UNLOCK(vp); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); - vfs_unbusy(mp); return (EALREADY); } ump->um_qflags[type] |= QTF_OPENING|QTF_CLOSING; @@ -556,7 +553,6 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) ump->um_qflags[type] &= ~(QTF_OPENING|QTF_CLOSING); UFS_UNLOCK(ump); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); - vfs_unbusy(mp); return (error); } VOP_UNLOCK(vp); @@ -640,7 +636,6 @@ again: ("quotaon: leaking flags")); UFS_UNLOCK(ump); - vfs_unbusy(mp); return (error); } diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index 0f45baed634f..33ef7bc2c3d1 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -87,17 +87,14 @@ ufs_root(mp, flags, vpp) * Do operations associated with quotas */ int -ufs_quotactl(mp, cmds, id, arg) +ufs_quotactl(mp, cmds, id, arg, mp_busy) struct mount *mp; int cmds; uid_t id; void *arg; + bool *mp_busy; { #ifndef QUOTA - if ((cmds >> SUBCMDSHIFT) == Q_QUOTAON || - (cmds >> SUBCMDSHIFT) == Q_QUOTAOFF) - vfs_unbusy(mp); - return (EOPNOTSUPP); #else struct thread *td; @@ -117,25 +114,23 @@ ufs_quotactl(mp, cmds, id, arg) break; default: - if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) - vfs_unbusy(mp); return (EINVAL); } } - if ((u_int)type >= MAXQUOTAS) { - if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) - vfs_unbusy(mp); + if ((u_int)type >= MAXQUOTAS) return (EINVAL); - } switch (cmd) { case Q_QUOTAON: - error = quotaon(td, mp, type, arg); + error = quotaon(td, mp, type, arg, mp_busy); break; case Q_QUOTAOFF: vfs_ref(mp); + KASSERT(*mp_busy, + ("%s called without busied mount", __func__)); vfs_unbusy(mp); + *mp_busy = false; vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); error = quotaoff(td, mp, type); vn_finished_write(mp); From owner-dev-commits-src-main@freebsd.org Sun May 30 22:21: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 0D9BD638A3C; Sun, 30 May 2021 22:21: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 4FtXvg72Y6z4ccd; Sun, 30 May 2021 22:21: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 D9BF824CCE; Sun, 30 May 2021 22:21: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 14UMLZxP066031; Sun, 30 May 2021 22:21:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14UMLZwS066030; Sun, 30 May 2021 22:21:35 GMT (envelope-from git) Date: Sun, 30 May 2021 22:21:35 GMT Message-Id: <202105302221.14UMLZwS066030@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: 27006229f7a4 - main - vinvalbuf: do not panic if we were unable to flush dirty buffers 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: 27006229f7a40a18a61a0e8fd270bc583326b690 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, 30 May 2021 22:21:36 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=27006229f7a40a18a61a0e8fd270bc583326b690 commit 27006229f7a40a18a61a0e8fd270bc583326b690 Author: Konstantin Belousov AuthorDate: 2021-05-30 16:52:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-30 22:20:53 +0000 vinvalbuf: do not panic if we were unable to flush dirty buffers Return EBUSY instead and let caller to handle the issue. For vgone()/vnode reclamation, caller first does vinvalbuf(V_SAVE), which return EBUSY in case dirty buffers where not flushed. Then caller calls vinvalbuf(0) due to non-zero return, which gets rid of all dirty buffers without dependencies. PR: 238565 Reviewed by: asomers, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30555 --- sys/kern/vfs_subr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 7c9604457aef..ad0f1c2a0c7c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2032,13 +2032,11 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpflag, int slptimeo) } while (error == ERELOOKUP); if (error != 0) return (error); - /* - * XXX We could save a lock/unlock if this was only - * enabled under INVARIANTS - */ BO_LOCK(bo); - if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0) - panic("vinvalbuf: dirty bufs"); + if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0) { + BO_UNLOCK(bo); + return (EBUSY); + } } } /* From owner-dev-commits-src-main@freebsd.org Sun May 30 22:49: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 19DBF6390B3; Sun, 30 May 2021 22:49: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 4FtYX20DXnz4f96; Sun, 30 May 2021 22:49: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 E429025143; Sun, 30 May 2021 22:49: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 14UMnbbn094542; Sun, 30 May 2021 22:49:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14UMnbcl094541; Sun, 30 May 2021 22:49:37 GMT (envelope-from git) Date: Sun, 30 May 2021 22:49:37 GMT Message-Id: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a20c351ea457d2beae661c197fcaa97c9ec0637 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, 30 May 2021 22:49:38 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=5a20c351ea457d2beae661c197fcaa97c9ec0637 commit 5a20c351ea457d2beae661c197fcaa97c9ec0637 Author: Alan Somers AuthorDate: 2021-05-30 21:54:46 +0000 Commit: Alan Somers CommitDate: 2021-05-30 22:49:07 +0000 [skip ci] add a CODEOWNERS file Summary: Convert MAINTAINERS into a Github CODEOWNERS file. This will automatically assign reviewers to some GH pull requests. The conversion is not 1:1; some committers don't have Github accounts (e.g. adrian), some functional areas don't neatly correspond to a set of files (e.g. kqueue), and mailing lists can't be assigned as a reviewer (e.g. secteam@). But it's a start. MFC after: 2 weeks Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30559 --- .github/CODEOWNERS | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000000..8cdb55e3b58a --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,101 @@ +# Please note that the content of this file is strictly advisory. +# No locks listed here are valid. The only strict review requirements +# are granted by core. These are documented in head/LOCKS and enforced +# by svnadmin/conf/approvers. +# +# The source tree is a community effort. However, some folks go to the +# trouble of looking after particular areas of the tree. In return for +# their active caretaking of the code it is polite to coordinate changes +# with them. This is a list of people who have expressed an interest in +# part of the code or listed their active caretaking role so that other +# committers can easily find somebody who is familiar with it. The notes +# should specify if there is a 3rd party source tree involved or other +# things that should be kept in mind. +# +# However, this is not a 'big stick', it is an offer to help and a source +# of guidance. It does not override the communal nature of the tree. +# It is not a registry of 'turf' or private property. +# +# *** +# This list is prone to becoming stale quickly. The best way to find the recent +# maintainer of a sub-system is to check recent logs for that directory or +# sub-system. +# *** +# +# *** +# Maintainers are encouraged to visit: +# https://reviews.freebsd.org/herald +# +# and configure Phabricator notifications for parts of the tree which they +# maintain. Notifications can automatically be sent when someone proposes a +# revision or makes a commit to the specified subtree. +# *** + +autofs/ @trasz +iscsi/ @trasz +kqueue/ @jmgurney +libpam/ @dag-erling +linprocfs/ @dag-erling +opencrypto/ @jmgurney +openssl/ @juikim +procfs/ @dag-erling +pseudofs/ @dag-erling +rctl/ @trasz +vmm/ @bsdjhb @grehan-freebsd +/bin/sh @jillest +/contrib/atf @ngie +/contrib/capsicum-test @ngie +/contrib/googletest @ngie +/contrib/ipfilter @cschuber +/contrib/libcxxrt @DimitryAndric @emaste +/contrib/llvm-project @DimitryAndric +/contrib/llvm-project/libunwind @DimitryAndric @emaste @bsdjhb +/contrib/llvm-project/lldb @DimitryAndric @emaste +/contrib/llvm-project/openmp @DimitryAndric @emaste +/contrib/netbsd-tests @ngie +/contrib/pjdfstest @ngie @asomers +/crypto/openssh @dag-erling +/etc/mail @gshapiro +/etc/sendmail @gshapiro +/lib/libc/sys/kevent.c @jmgurney +/lib/libdpv @devinteske +/lib/libfetch @dag-erling +/lib/libfigpar @dag-erling +/lib/libvmmapi @bsdjhb @grehan-freebsd +/sbin/mount_fusefs @asomers +/share/mk @bsdimp @bapt @bdrewery @emaste @sgerraty +/stand/forth @devinteske +/stand/lua @kevans91 +/sys/amd64/pci @bsdimp @bsdjhb +/sys/arm/allwinner @evadot +/sys/arm64/rockchip @evadot +/sys/compat/linuxkpi @hselasky +/sys/contrib/dev/ice @ricera +/sys/contrib/ipfilter @cschuber +/sys/dev/drm2 @bsdimp +/sys/dev/e1000 @ricera +/sys/dev/ice @ricera +/sys/dev/ixgbe @ricera +/sys/dev/ixl @ricera +/sys/dev/ofw @nwhitehorn +/sys/dev/pci @bsdimp @bsdjhb +/sys/dev/sound/usb @hselasky +/sys/dev/usb @hselasky +/sys/fs/fuse/ @asomers +/sys/netinet/ip_carp.c @glebius +/sys/netinet/sctp_* @tuexen +/sys/netpfil/pf @kprovost @glebius +/sys/x86/pci @bsdimp @bsdjhb +/tests @ngie +/tests/sys/fs/fusefs/ @asomers +/tools/build @bsdimp +/tools/tools/nanobsd @bsdimp +/usr.bin/dpv @devinteske +/usr.bin/top @grimreaper +/usr.sbin/bhyve @bsdjhb @grehan-freebsd +/usr.sbin/bhyvectl @bsdjhb @grehan-freebsd +/usr.sbin/bhyveload @bsdjhb @grehan-freebsd +/usr.sbin/bsdconfig @devinteske +/usr.sbin/lpr @gbergling +/usr.sbin/sysrc @devinteske +/usr/bin/fetch @dag-erling From owner-dev-commits-src-main@freebsd.org Sun May 30 22:53: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 D9581638EEA; Sun, 30 May 2021 22:53: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 4FtYch5bs7z4fpD; Sun, 30 May 2021 22:53: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 A858C2516F; Sun, 30 May 2021 22:53: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 14UMre1G007148; Sun, 30 May 2021 22:53:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14UMreIW007147; Sun, 30 May 2021 22:53:40 GMT (envelope-from git) Date: Sun, 30 May 2021 22:53:40 GMT Message-Id: <202105302253.14UMreIW007147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 425bbe9e64f7 - main - fusefs: reenable the WriteCluster.cluster_write_err test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 425bbe9e64f7af6bdb30a099bd90a32885de1ab8 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, 30 May 2021 22:53:40 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=425bbe9e64f7af6bdb30a099bd90a32885de1ab8 commit 425bbe9e64f7af6bdb30a099bd90a32885de1ab8 Author: Alan Somers AuthorDate: 2021-05-30 22:51:56 +0000 Commit: Alan Somers CommitDate: 2021-05-30 22:51:56 +0000 fusefs: reenable the WriteCluster.cluster_write_err test The underlying panic was just fixed by revision 27006229f7a40a18a61a0e8fd270bc583326b690 PR: 238565 MFC after: 1 week MFC with: 27006229f7a40a18a61a0e8fd270bc583326b690 --- tests/sys/fs/fusefs/write.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/fs/fusefs/write.cc b/tests/sys/fs/fusefs/write.cc index f0f9685000fb..fadf4648d31c 100644 --- a/tests/sys/fs/fusefs/write.cc +++ b/tests/sys/fs/fusefs/write.cc @@ -806,10 +806,10 @@ TEST_F(WriteCluster, clustering) * not panic the system on unmount */ /* - * Disabled because it panics. + * Regression test for bug 238585 * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238565 */ -TEST_F(WriteCluster, DISABLED_cluster_write_err) +TEST_F(WriteCluster, cluster_write_err) { const char FULLPATH[] = "mountpoint/some_file.txt"; const char RELPATH[] = "some_file.txt"; From owner-dev-commits-src-main@freebsd.org Sun May 30 23:21: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 A9171639AE7; Sun, 30 May 2021 23:21: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 4FtZFD4Dn1z4j1n; Sun, 30 May 2021 23:21: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 79E8325BFB; Sun, 30 May 2021 23:21: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 14UNLq1G044254; Sun, 30 May 2021 23:21:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14UNLqcK044253; Sun, 30 May 2021 23:21:52 GMT (envelope-from git) Date: Sun, 30 May 2021 23:21:52 GMT Message-Id: <202105302321.14UNLqcK044253@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: f0d577fd2d41 - main - [skip ci] volunteer to maintain POSIX AIO MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0d577fd2d41ac7ac94706ebeafbcc8bdc78b940 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, 30 May 2021 23:21:52 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=f0d577fd2d41ac7ac94706ebeafbcc8bdc78b940 commit f0d577fd2d41ac7ac94706ebeafbcc8bdc78b940 Author: Alan Somers AuthorDate: 2021-05-30 23:21:12 +0000 Commit: Alan Somers CommitDate: 2021-05-30 23:21:12 +0000 [skip ci] volunteer to maintain POSIX AIO MFC after: 2 weeks --- .github/CODEOWNERS | 2 ++ MAINTAINERS | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8cdb55e3b58a..de6f0c72f471 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -82,11 +82,13 @@ vmm/ @bsdjhb @grehan-freebsd /sys/dev/sound/usb @hselasky /sys/dev/usb @hselasky /sys/fs/fuse/ @asomers +/sys/kern/vfs_aio.c @asomers /sys/netinet/ip_carp.c @glebius /sys/netinet/sctp_* @tuexen /sys/netpfil/pf @kprovost @glebius /sys/x86/pci @bsdimp @bsdjhb /tests @ngie +/tests/sys/aio/ @asomers /tests/sys/fs/fusefs/ @asomers /tools/build @bsdimp /tools/tools/nanobsd @bsdimp diff --git a/MAINTAINERS b/MAINTAINERS index 09ee157eb128..caa19f1b1d25 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -35,6 +35,7 @@ makes a commit to the specified subtree. subsystem login notes ----------------------------- +aio(4) asomers Pre-commit review requested. ath(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org contrib/atf ngie,#test Pre-commit review requested. contrib/capsicum-test ngie,#capsicum,#test Pre-commit review requested.